You are not logged in.
Pages: 1
Hello everybody
Someone could provide an example of a simple business rule scenario like:
products
customers
a sale with a customer and several product items
using data sharding with mormot and sqlite or mondogb even?
We're having a hard time understanding the concept and having a hard time building code correctly following this pattern.
If possible we will be very grateful
Indicating the way to do it also helps a lot.
The difficulty is in assimilating the concept, since we are from the RDBMS era with a monolithic database... Would it be a database for products with a table? How to store product data that are commonly used in JOINS?
Thanks
Hi
Can a Web Client written in PHP be able to use the 16 Server example to run SQL through the SOA Service on the Mormot Server?
If so, where do I find information to create this PHP code?
Hello guys
What would be the best way to keep the reference to the Query object without creating a new reference by assigning JSOntoDataset to a Query?
When I do MyUniQuery := JSONTODataset (something) I create a new reference and I can not access the named TFields among other things ..
How do I get the result of JSONtoDataset in the same reference of my UniQuery?
This notation used in our legacy application repeats thousands of times throughout the code.
I would like some help from you to get out of this question if possible, otherwise it will not be approved by our directors to change the legacy code to use mormot in this application
Thanks Ab
Now it works
I have one more newbie question
In this case, UniQuery1 has named added TFields, for example:
UniQuery1ID_TABLE INTEGER
UniQuery1NAME STRING
and
fService.Execute ('SELECT ID_TABLE, NAME FROM COMPANIES', True, True) returns correctly
In UniQuery1 I can correctly access the values in TUniQuery using UniQuery1.Fields [0] and UniQuery1.Fields [1]
I can also access using UniQuery1.FieldByName ('ID_TABLE') AsInteger and UniQuery1.FieldByName ('NAME') AsString and UniQuery.RecordCount is correct
But I can not directly access UniQuery1ID_TABLE.AsInteger nor UniQuery1NAME.ASString and this is used in my legacy code
The values come empty when I access the fields directly
How do we proceed?
Hi all,
We use Mormot on a new project with extreme success, but we are working on using mormot in an old legacy project that basically uses UNIQuery and IBQuery Datasets.
We want to load the records in these DataSets, but it has not worked well using the JSONTODataset implementation
It works
DbGrid1.DataSource.DataSet: = JSONToDataSet (Self, fService.Execute (aSQL, True, False));
but this does not work
UniQuery1: = TUniQuery (JSONToDataSet (Self, fService.Execute (aSQL, True, False)));
How do we proceed?
Hi all,
I changed example 16 to work with firebird, but I have received this error
First chance exception at $779017D2. Exception class EInterfaceFactoryException with message
'TInterfacedObjectFakeClient.FakeCall(IRemoteSQL.Execute) failed: '{
"errorCode":500,
"error":
{"EFirebirdException":{
"ClassName":"EFirebirdException",
"Address":"004D25F7 ",
"Message": "Firebird Error 140000F9: Dynamic SQL Error. SQL error code = -502. Invalid cursor declaration. Statement already has a cursor SYNDB assigned. [ SQLCODE=-502 (The cursor identified in an OPEN statement is already open.) ]"
}}
}''.
Process ProComm.exe (8308)
I believe it is some failure of my implementation, I need help to get out of this dead end
My SQL Interface
unit U_SQL_Interface;
interface
uses
SynCommons,
mORMot;
type
TRemoteSQLEngine = (rseOleDB, rseODBC, rseOracle, rseSQlite3, rseJet, rseFireBird, rseMSSQL);
IRemoteSQL = interface(IInvokable)
['{7CEFA011-7EDD-44F0-9802-DC4F25365D71}']
procedure Connect(aEngine: TRemoteSQLEngine; const aServerName, aDatabaseName,
aUserID, aPassWord: RawUTF8);
function GetTableNames: TRawUTF8DynArray;
function Execute(const aSQL: RawUTF8; aExpectResults, aExpanded: Boolean): RawJSON;
end;
const
ROOT_NAME = 'rootServ01';
PORT_NAME = '8085';
implementation
end.
{ TServiceRemoteSQL }
procedure TServiceRemoteSQL.Connect(aEngine: TRemoteSQLEngine;
const aServerName, aDatabaseName, aUserID, aPassWord: RawUTF8);
const // rseOleDB, rseODBC, rseOracle, rseSQlite3, rseJet, rseMSSQL
//(rseOleDB, rseODBC, rseOracle, rseSQlite3, rseJet, rseFireBird, rseMySQL, rsePostGreSQL, rseMSSQL);
TYPES: array[TRemoteSQLEngine] of TSQLDBConnectionPropertiesClass = (
TOleDBConnectionProperties, TODBCConnectionProperties,
TSQLDBOracleConnectionProperties, TSQLDBSQLite3ConnectionProperties,
{$ifdef WIN64}nil{$else}TOleDBJetConnectionProperties{$endif},
TSQLDBFirebirdConnectionProperties,
TOleDBMSSQL2008ConnectionProperties);
begin
if fProps<>nil then
raise Exception.Create('Connect called more than once');
if TYPES[aEngine]=nil then
raise Exception.CreateFmt('aEngine=%s is not supported',
[GetEnumName(TypeInfo(TRemoteSQLEngine),ord(aEngine))^]);
fProps := TYPES[aEngine].Create(aServerName,aDatabaseName,aUserID,aPassWord);
end;
Connect Call
fSettings.fEngine := rseFireBird;
fSettings.fServerName := StringToUTF8('localhost/3050:C:\Commerce\Database\Procomm.gdb');
fSettings.fDatabaseName := '';
fSettings.fUserID := StringToUTF8('sysdba');
fSettings.fPassword := StringToUTF8('masterkey');
with fSettings do
fService.Connect(Engine,ServerName,DatabaseName,UserID,PassWord);
Call that the error occurs
fService.Execute('SELECT * FROM EMPRESAS',True,False);
What is my mistake?
Thanks
My TSQLRecords
unit U_Cad_Neo_01;
interface
uses
U_Tipo_Cad,
{$IFDEF MSWINDOWS}
mORMot, SynCommons;
{$ENDIF}
{$IFNDEF MSWINDOWS}
SynCrossPlatformREST;
{$ENDIF}
type
TSQLCad_Neo_01 = class(TSQLRecord)
private
FDescricao: RawUTF8;
// FTipo_Cad: Integer;
FTipo_Cad: TSQLTipo_Cad;
FData_Cad: TDateTime;
FValor_Cad: Currency;
{$IFDEF MSWINDOWS}
fVersion: TRecordVersion;
{$ENDIF}
published
property Descricao: RawUTF8 index 200 read FDescricao write FDescricao;
// property Tipo_Cad: Integer read FTipo_Cad write FTipo_Cad;
property Tipo_Cad: TSQLTipo_Cad read FTipo_Cad write FTipo_Cad;
property Data_Cad: TDateTime read FData_Cad write FData_Cad;
property Valor_Cad: Currency read FValor_Cad write FValor_Cad;
{$IFDEF MSWINDOWS}
property Version: TRecordVersion read fVersion write fVersion;
{$ENDIF}
end;
implementation
end.
and
unit U_Tipo_Cad;
interface
uses
{$IFDEF MSWINDOWS}
mORMot, SynCommons;
{$ENDIF}
{$IFNDEF MSWINDOWS}
SynCrossPlatformREST;
{$ENDIF}
type
TSQLTipo_Cad = class(TSQLRecord)
private
FDescricao: RawUTF8;
{$IFDEF MSWINDOWS}
fVersion: TRecordVersion;
{$ENDIF}
published
property Descricao: RawUTF8 index 50 read FDescricao write FDescricao;
{$IFDEF MSWINDOWS}
property Version: TRecordVersion read fVersion write fVersion;
{$ENDIF}
end;
implementation
end.
Can it be the TRecordVersion field?
Thanks Ab
Hi all,
I use this code in Delphi Berlin, FMX Aplication, target Android. My device is a Zenfone 3 with Android Oreo 8.0...
procedure TFrm_Prot_Neo_01_Cli_Fire.TabLancamentosClick(Sender: TObject);
var
ListItem: TListViewItem;
begin
{$IFDEF MSWINDOWS}
Lista_Cad_Neo := TSQLCad_Neo_01.CreateAndFillPrepare(Dm.BaseDados, ' ID > -1 ORDER BY ID ');
Lista_Cad_Tipo_Cad := TSQLTipo_Cad.CreateAndFillPrepare(Dm.BaseDados, ' ID > -1 ORDER BY ID ');
{$ENDIF}
{$IFNDEF MSWINDOWS}
Lista_Cad_Neo := TSQLCad_Neo_01.CreateAndFillPrepare(Dm.BaseDados, '', ' ID > -1 ORDER BY ID ', []);
Lista_Cad_Tipo_Cad := TSQLTipo_Cad.CreateAndFillPrepare(Dm.BaseDados, '', ' ID > -1 ORDER BY ID ', []);
{$ENDIF}
ListLancamentos.Items.Clear;
ListLancamentos.BeginUpdate;
while Lista_Cad_Neo.FillOne do
begin
ListItem := ListLancamentos.Items.Add;
ListItem.Text := IntToStr(Lista_Cad_Neo.ID) + ' - ' + UTF8ToString(Lista_Cad_Neo.Descricao) + ' - ' + DateToStr(Lista_Cad_Neo.Data_Cad);
end;
end;
In FillOne line, i received in the device an error:
JSONVariantData.Data(20<>JSONVariant)
I'm attaching an image with the error screen..
Removing fillone no error occurs
In Windows 32 bit, this code works!
What could be happening? Can someone help me?
Guys, I got the concept! Perfect, sorry for ignorance, but it's all new to me! I took a look at the SOLID and DDD principle, the MVC concept really makes sense to me now! I have one doubt, I realized that I will have several models and several REST servers. The relationship between the HTTP Server and each REST Server is one to one? In that case would I have multiple HTTP servers responding on multiple TCP ports through my application? or would it be an HTTP Server only?
Ab,
I think this time I understood the concept, but ..
How would you implement that for an ERP with Mormot, using ORM? multiple models, each with its TRestServerDB, and in HttpServer, multiple instances of TRestServerDB? In that case would there be no limitation of 256 instances of TRestServerDB too? I'm confused ..
To use ORM we can not break the limit of 256 tables? An ERP application easily passes 256 tables .. When using SQL manual via SOA-based services, how do I keep the possibility of exchanging databases with a line of code? It's possible ? How to handle manual SQL via SOA without losing the possibility of the application running in multiple databases?
Hi all,
DateToStr conversion in this case... Is wrong?
Is the correct way UTF8 conversion to MyDateTimeField ? vValues.Values is TVariantDynArray...
EMartin
How do I get access to this property?
Mauricio
Yes, using JSONToDataset works, but this method uses the unit MormotVCL and I migrated the example to an FMX client, and the JSONtoDataset method does not work with FMX so I am trying to use the ToDataset method and directly manipulate the return in DocVariantData. If there is any other alternative for FMX clients I'm happy to find out
Hi Mauricio,
Yes, I had seen this property, however it did not work properly in this case
Without any data in the table, the RetrieveList and vValues.InitJson method returns the following:
(275, [dvoIsObject, dvoReturnNullForUnknownProperty, dvoValueCopiedByReference], ('fieldCount', 'values',' rowCount '), (5,' ["ID", "Acronym", "Description", "Type", "Id_Merc") ', 0), 3)
And the count property returns the number 3, but there is no record in the table
Hi all
I solve using this code:
for i := 0 to high(vValues.Values) do
vValues.Values[i].MyDateTimeField := DateToStr(Iso8601ToDateTime(vValues.Values[i].MyDateTimeField));
Hi
for display in the client application, what is the best way to convert the date that returns via RetrievelistJSON from a SQLite database to the format dd/mm/yyyy?
Date format displayed is yyyy-mm-dd
This data is displayed in a DBGrid, and the problem is just the display!
To manipulate the data in ISO format that Mormot uses, everything is perfect!
The view I believe should be done in the client application, am I correct?
I already tried masks in DBGrid.DataSource.DataSet, I tried to bring the DocVariantData data with the set dbFieldsTypes but it did not work at all!
I did not want to have to bring the data to a TSQLTable or another TDataSet to process! This would bring an extra layer of data processing!
How to proceed?
Thanks
Rodrigo
Hi all
I Use this code:
var vValues: TDocVariantData;
vValues.InitJSON(MyModelHttpClient.RetrieveListJSON(TSQLMyRecord,'',''),JSON_OPTIONS[true]);
but in some cases, result of RetriveListJSON call is 0 records.
In this cases, some information is added in vValues. I use vValues to fill a DbGrid.DataSource.DataSet :
MyGrid.DataSource.DataSet := ToDataSet(self,vValues.Values,[],[]);
when 0 records is the result of RetrieveListJSON call, i have a exception _Self(0<>1) ...
Is there any way to find out if the number of records returned by RetrieveListJSON = 0 ?
Thanks
Rodrigo
Hi mpv,
When work with FMX?
MormMotMidasVCL or MormotVCL don´t work
In this case, how to proceed?
Thank´s
Thanks for help!!!
I change access permissions to allow all for all users but the error persist
I change development environment to fpc 3.0.4 and lazarus 1.8.0, ndk for r14b
I pass, new sample project compile ok!
But on declare in uses Mormot i received that error:
mORMot.pas(60619,0) Error: Error while assembling exitcode 1
I think I'm doing something wrong but I need some help here :-)
How to post All verbose messages on compiling: file .txt ou on quoted text? code text?
{}s
Rodrigo
Ok, thanks for your help
I use Lazarus 1.9.0 with FPC 3.1.1
I use fpcupdeluxe with lazarus and fpc trunk
I install LAMW and laz4droid modules by fpcupdeluxe too
I use JDK 1.7.0.80, SDK x86 Win update today, installed today too, NDK r9c and ANT 1.10.1
My OS is Windows 10 32 bits
I receive that error message on compiling
Project checks, Hints: 3
Note: passing compiler option -M twice with different values
Note: passing compiler option -FU twice with different values
Note: passing compiler option -o twice with different values
Compile Project, OS: android, CPU: arm, Target: C:\DCUsOutFPC\mORMotOnAndroid: Exit code 1, Errors: 3
And_Jni.pas(553,0) Error: Can't create assembler file: output\And_Jni.s
And_Jni.pas(553,0) Error: Compilation raised exception internally
Fatal: I/O error: File not open
Hi,
I need help to adapt Project Sample 16 (Run SQL - Interfaces Based Services) to connect via Unidac, Firedac or ZeosLib in several RDBMS (PostGreSQL, Firebird, MariaDB, etc.)
Can someone help me?
Thanks,
Rodrigo
How to proceed? Is this the best way?
Hi,
Has anyone implemented this yet?
Can anyone post an example of how to implement this in SynCrossPlatform using Delphi FMX for Android compilation?
I want to fill a TFDMemTable with TSQLTableJSON returned by a Mormot Server...
Thanks
I have implemented the failover in DB backend
But, on the server level?
How to implement this?
Hi,
I use Delphi Berlin 10.1 and SGBDs like Firebird or PostGreSQL
"State of the art" is the focus of this new project, best performance and multi clients (Desktop, WEB, FMX, ... )
Server tier in a Cloud and maybe database "tier" in a Cloud too
This project is a ERP Based solution
We don´t use ORM by personal issues
Can somebody help us and clear the way?
Thank´s
Rodrigo (Sorry by English, I´m Brazilian)
Pages: 1