You are not logged in.
On my experiments I added the Auth tables to my model. That fixed the issue. Looks like the behavior is different when using SQLite, the Auth tables are created if you are using authentication even if you don’t add the tables to the model... Hope that helps.
Hello!
Another simple question... How do I prevent the insertion of an invalid ID on a table that has a reference to another one (foreign key)?
My test tables:
TSQLClienteRecord = class(TSQLRecord)
private
fNome: RawUTF8;
fIdade: Int64;
fNotas: RawUTF8;
published
property Nome: RawUTF8 index 100 read fNome write fNome stored AS_UNIQUE;
property Idade: Int64 read fIdade write fIdade;
property Notas: RawUTF8 read fNotas write fNotas;
end;
TSQLEncomendaRecord = class(TSQLRecord)
private
fCliente: TSQLClienteRecord;
fNif: Int64;
fMorada: RawUTF8;
published
property fkCli: TSQLClienteRecord read fCliente write fCliente;
property Nif: Int64 read fNif write fNif;
property Morada: RawUTF8 read fMorada write fMorada;
end;When I insert a record on EncomendaRecord using Postman for example, I can send any value to fkCli and no error occurs, and the record is inserted on the table. I expected an error to be automatically raised, preventing the insertion of that invalid foreign key.
And how do I do other validation that raise errors to the client AJAX app, like type differences, or string length, etc...
Thank you!
I can´t see the tables on firebird, but the authentication works, I can add users and login with them... I opened all tables in firebird and I can't find the users.
That makes perfect sense, I was just switching from SQLite to Firebird for some performance testing and that never came to mind.
Do you have any idea way the user tables are not being created on when using Firebird? They are created normally when I switch to SQLite.
Thank you!
Hello, I'm starting with mORMot and now I'm trying to use a firebird database (Zeos). My AuthUser/AuthGroup tables are not being created, what's missing from that code below?
var
fbDatabase: TSQLDBZEOSConnectionProperties;
begin
Model := CreateDataModel;
fbDatabase := TSQLDBZEOSConnectionProperties.Create(
TSQLDBZEOSConnectionProperties.URI(dFirebird, '', '.\Firebird\fbclient.dll', true),
'fbDB.fdb',
'sysdba',
'masterkey');
fbDatabase.ThreadingMode := tmMainConnection;
VirtualTableExternalRegisterAll(Model, fbDatabase,[regMapAutoKeywordFields]);
Server := TSQLRestServerDB.Create(Model, SQLITE_MEMORY_DATABASE_NAME, true);
Server.CreateMissingTables;
AddToServerWrapperMethod(Server, ['D:\Dev\mormot\CrossPlatform\templates']);
HTTPServer := TSQLHttpServer.Create('8080', [Server], '+', useHttpApiRegisteringURI);
HTTPServer.AccessControlAllowOrigin := '*';One other difficulty I'm having with Firebird is that I can't index/unique my string fields (RawUTF8), I'm getting errors with the TSQLRecord below:
TSQLClienteRecord = class(TSQLRecord)
private
fNome: RawUTF8;
fIdade: Int64;
fNotas: RawUTF8;
published
property Nome: RawUTF8 read fNome write fNome stored AS_UNIQUE;
property Idade: Int64 read fIdade write fIdade;
property Notas: RawUTF8 read fNotas write fNotas;
end;These are some newbie questions I'm sure, sorry... And thank you ![]()
Nice, I will experiment with that today, thank you.
Maybe I'm not the right guy to help with this...
The mORMotClient.pas seems Ok.
The compilation errors are on the SynCrossPlatformSpecific.pas and SynCrossPlatformREST.pas.
System.Date seems to have been renamed to System.DateUtils?
The VarIsValidRef function does not exists anymore (or so it seems).
The decodeURIComponent function is now part of the class TString, TString.decodeURIComponent.
And finally, this function: function Add(Value: TSQLRecord; SendData: boolean; ForceID: boolean=false; const FieldNames: string=''): TID; virtual;
Is triggering: Syntax Error: const parameter cannot have a default value [line: 804, column: 46, file: SynCrossPlatformREST]
Is there a way to produce a js file to use on a VUE/REACT application? Put in another way, what is the best approach to build a client web app, other than using SMS?
I'm very new to this ORM and things, but I'm liking it so far.
Hello! I'm evaluating mORMot and SMS 3 for a new project.
I tried the CopySynCrossPlatformUnits.bat file to copy the required .pas files to SMS but the locations appear to be wrong. I then copied the files manually to “C:\ProgramData\The Smart Company\Smart Mobile Studio\Libraries” and then SMS was able to find them.
When compiling the mORMotClient.pas file I get the following errors:
Syntax Error: Unit "System.Date" referenced in unit "SynCrossPlatformSpecific" not found [line: 100, column: 12, file: SynCrossPlatformSpecific]
Syntax Error: const parameter cannot have a default value [line: 804, column: 31, file: SynCrossPlatformREST]
Syntax Error: Unknown name "encodeURIComponent" [line: 1439, column: 13, file: SynCrossPlatformREST]
What am I doing wrong?
Thank you.