You are not logged in.
@ab
In test.core.crypt.pas check line 2299 and 2301
Check(st2.Revoke(c3.GetSerial...
I change to
Check(st2.Revoke(c3, ...
to compile test
Lazarus 2.2
FPC 3.2.3
Firebird 3.0.7.33374
Can you try with Laz 2.0.12 and Fpc 3.2 as recommended version and trunk version of mormot2
do I need any compiler directive to compile Zeos?
No, I just install Zeos from Online package manager, open mormot2 package in custom options uncheck NOSYNDBZEOS, add zdbc as required package, add include path for zeos.inc and recompile mormot2 package.
did you try firebird embedded or via network (like my test)?
I try with network localhost:3040, Fb4 version is set to 3040 port.
Do you have test database created before test. I think Zeos only create db file in embedded mode. In network mode you must create database before test.
Also check db file owner, must be firebird:firebird. If you create db in embedded mode owner will be current user.
Yes for Fb4 Ibx is 20-30% faster, for Fb3 10-20% slower. Zeos have better optimized parameters setting. I try low level direct buffer setting for integer, currency and utf8 string and performance is same, but remove that code and keep fbintf param setting for safety and type conversion.
Firebird and FPC/Lazarus version?
Can't confirm on Win32/64, Fb3, Fb4, Lazarus 2.0.12. FPC 3.2.2, same Zoes 7.2.14
All tests pass (Zeos and Ibx).
You can also try IBX driver, I just push new commit with IBatch interface use for Fb4
https://github.com/TTomas/mORMot2/blob/ … ql.ibx.pas
I create new pull request https://github.com/synopse/mORMot2/pull/75
With Firebird v4 batch Insert and Update use new IBatch interface. Using IBatch interface double insert performance.
Insertion speed (rows/second)
Firebird 4 using execute block for batch Insert
Direct Batch Trans Batch Trans
Ibx firebird 1745 22317 2946 22017
Firebird 4 using IBatch interface
Direct Batch Trans Batch Trans
Ibx firebird 1726 46499 6309 46763You don't need to set cFIREBIRDEMBEDDEDDLL = '' if you have only one instance/version of firebirdsql
You run test in non embedded mode, cFirebirdServerZeos = '127.0.0.1';
In this case multithreaded connection pool is created and drop table will fail in firebird if you have active connection to db.
RunWrites(trans, batch) is called 4 times in test. First run will pass, but second can fail if you have active connection to db.
You can see code in procedure TTestDatabaseExternalAbstract.ClientCreate; line 765
Try to change line 385 in procedure TTestFirebird.ZeosFirebird; to Flags := [dbPropUntouched];
Test 4 times drop table and insert 10000 rows. With this changes your test will only insert rows.
You can also uncomment lines 386,387 to delete db file on start. You will need firebird user permission to delete file.
You can also try to change threadingMode of ConnectionProperties to tmMainConnection
Thanks @ab, this will solve the problem.
Can you please at line 1740 add
if head<>'' then
fOutput.Header := fOutput.Header + #13#10 + head;In case when CustomOutHttpHeader := '' mvc application raise exception:
{ "errorCode":500, "errorText":"Unsafe HTTP header rejected [Content-Type: text/html; charset=UTF-8$0d$0a$0d$0aETag: \"57A6E6D8\"]" }
In same method depend of business logic I insert none, one or many response headers.
Any hint how to add Response Header from MVCApplication.
context := ServiceRunningContext;
context.Request.Call^.OutHead := context.Request.Call^.OutHead + #13#10 + 'Test: test';Trying this code from MVCApplication method, mORMot2/FPC, don't return Test Header.
I'm playing with htmx for client side (htmx.org) and need to trigger some events on client with response header.
https://htmx.org/docs/#requests
I need to send response header from mvc controller depending of business logic in mvc method.
In my pull request https://github.com/synopse/mORMot2/pull/58
I convert sample 15 and results are:
Running tests using Synopse mORMot framework 2.0.1, compiled with Free Pascal 3.2 64 bit, against SQLite 3.36.0, on Manjaro Linux - Linux 5.4.148-1-MANJARO, at 2021-09-30 01:44:36.
Insertion speed (rows/second)
Direct Batch Trans Batch Trans
Sqlite file full 304 15413 29067 82673
Sqlite file off 4027 69256 35187 90535
Sqlite file off exc 12478 82022 35143 90420
Sqlite file off exc aes 8005 73736 35028 88832
Sqlite in memory 28583 90438 35340 91195
In memory static 82611 183708 85679 183769
In memory virtual 80202 170404 84334 170010
External sqlite file full 305 7638 31593 99072
External sqlite file off 5352 67390 39135 106364
External sqlite file off exc 17633 92354 38797 105929
External sqlite in memory 32937 107940 38307 106935
Remote sqlite socket 5587 49019 5781 42242
Read speed (rows/second)
By one All Virtual All Direct
Sqlite file full 24912 281563 275360
Sqlite file off 25301 289184 290528
Sqlite file off exc 42320 292620 293083
Sqlite file off exc aes 42133 296155 298169
Sqlite in memory 42353 289502 300300
In memory static 91441 551876 554692
In memory virtual 90920 211855 212539
External sqlite file full 50652 130589 286057
External sqlite file off 50972 131665 286368
External sqlite file off exc 51019 131585 286763
External sqlite in memory 49759 130938 286944
Remote sqlite socket 6518 117181 227489But you have closed the pull request.
Is it on purpose?
Sorry not much experience with github. I add 1 more commit, move type out of class declaration and yes I close, can I reopen pull request or need to create new? Not on purpose :-)
I create new pull request https://github.com/synopse/mORMot2/pull/58
Please ignore #57
I just pull request https://github.com/synopse/mORMot2/pull/57
Included conversion of sample 15 and this is results:
Running tests using Synopse mORMot framework 2.0.1, compiled with Free Pascal 3.2 64 bit, against SQLite 3.36.0, on Windows 10 64bit (6.2.9200), at 2021-09-26 21:29:48.
Insertion speed (rows/second)
Direct Batch Trans Batch Trans
Ibx firebird 3128 39378 22353 41027
Zeos firebird 3035 39629 24809 38625
Read speed (rows/second)
By one All Virtual All Direct
Ibx firebird 12283 122989 179513
Zeos firebird 30407 162522 209178Expected result for Read speed-By one (this is read of 5000 records one by one with start/read/commit transaction in Ibx, in this test Zeos never Commit or CommitRetaining transaction)
@EgonHugeist
I test with Zeos 7.2-patches.
8.0-patches have a problem with Batch inserts. Data is corrupted in table after batch inserts, also a lot of records are missing (not 5000 records after Batch). I try with and without MORMOT2 define, same problem.
Tested with Firebird 3.0.7 in embedded mode
i7-4700MQCPU
Same test on i3-8145U
Running tests using Synopse mORMot framework 2.0.1, compiled with Free Pascal 3.2 64 bit, against SQLite 3.36.0, on Manjaro Linux - Linux 5.4.148-1-MANJARO, at 2021-09-25 19:18:03.
Insertion speed (rows/second)
Direct Batch Trans Batch Trans
Ibx firebird 1549 12895 3170 13066
Zeos firebird 1925 15533 2119 16242
Read speed (rows/second)
By one All Virtual All Direct
Ibx firebird 1663 42024 71331
Zeos firebird 1954 72547 96491Sorry for delay, busy day.
I send pull request with some bugfix and added Zeos and Ibx project files for mvc-blog example.
https://github.com/synopse/mORMot2/pull … 4015d14588
Main goal with mvc-blog sample is OK. Server create 32 thread pull connections after many hits, and zero (0) active transactions on idle, Zeos always keep 32+ started transactions.
Monitored with
select * from [MON$ATTACHMENTS, MON$TRANSACTIONS, MON$STATEMENTS]
This query's are really nice to find forgotten statement/cursor/transaction, usually by missing ReleaseRows in code like:
if step then
DoSomething();
// missing ReleaseRows
I test with code from test.orm.extdb.pas, USEZEOS define part, all pass.
Tested only on Windows with Fpc and Firebird 3, for now. Delphi users welcome to test, fbintf can be installed on D2010>=
This is numbers of 5 tests, Batch add/receive of 1111 rows.
https://gist.github.com/TTomas/b77f951b … 2ae5f29adc
Only interesting is Test1 (BatchAdd of 1111 records), Zeos is really fast, thanks to @EgonHugeist.
Need some testing to tune number of statements in execute block.
I'm planning to implement new Firebird4 IBatch interface also
Test2 is expected to be slower 1111 Retrieve, because Ibx driver for every statement (1111) StartTransaction, Execute and Commit,
Zeos only Execute statement, monitoring this with trace and audit on Firebird server.
Second Ibx test is with ZEOSTRANS define to simulate same behavior.
Real Performance 15-Samples is in ToDo list
Inspired by transaction handling of ZeosLib and Firebird by this topic
and goal to have zero started transaction on Firebird server when nobody is connected
I create this mORMot2 database connection for FirebirdSQL.
For low level connection I use MWA Software Firebird Pascal API package (fbintf),
part of IBX for Lazarus.
More details on https://www.mwasoftware.co.uk/fb-pascal-api
- With explicit StartTransaction (Batch) all statements in connection
is executed with this main transaction owned by connection.
- If no explicit StartTransaction is called, all statements create internal transaction
on prepare and COMMIT after execution or Eof or ReleseRows. This is sotware simulated auto commit.
This internal transaction is owned by Statement.
- TSqlDBIbxConnectionProperties.CreateDescendingPK if set to True (Default is False)
will create only one descending PK index using statement
PRIMARY KEY(ID) using desc index PK_TableName
default dFirebird create two indexes on ID, one ascending, second descending
nedded for select max(ID)
see http://www.firebirdfaq.org/faq205
@ab
This feature need some change in mormot.orm.sql.pas at line 1883
For testing in my code i now have this improvisation, I change fEngineName when set this property :-)
dFirebird:
// see http://www.firebirdfaq.org/faq205
if fProperties.Engine='IBX1' then
begin
result := true;
exit;
end
else
Descending := true;
- Batch implemented for insert,update,delete using execute block
- ToDo Firebird4 API interface have new IBatch interface for insert/update
also implemented in fbintf package.
- You must patch FB30Statement.pas and FB25Statement.pas of fbintf, I'm waiting
for response of MWA Software. fbintf raise exception if Execute is executed
with different transaction then Prepare transaction.
Just comment this lines in InternalExecute and InternalOpenCursor and rebuild package.
more details on https://forum.lazarus.freepascal.org/in … 267.0.html
Source code mormot.db.sql.ibx.pas: https://gist.github.com/TTomas/2cb88c1c … a98f17a5b1
One more ReleaseRow missing
https://synopse.info/forum/viewtopic.php?id=5978
@ab in mormot.db.sql.pas, function TSqlDBConnection.GetServerDateTime: TDateTime;
line 6700 ReleseRows is missing
if Step then
fServerTimestampOffset := ColumnDateTime(0) - Current;
ReleaseRows;I notice this not release statement in Zeos Firebird "select current_timestamp from rdb$database" and keep open transaction/statement.
Maybe related to
https://github.com/bellard/quickjs/issues/89
After boot of VM you need this commands:
sudo apt update
sudo apt upgrade
sudo apt install lxde
sudo apt install xrdp
sudo passwd ubuntu
# you will add pw for gui login to default ubuntu user
# Lazarus dependency
sudo apt install make binutils build-essential gdb subversion zip unzip libx11-dev libgtk2.0-dev libgdk-pixbuf2.0-dev libcairo2-dev libpango1.0-dev
wget fpcupdeluxe aarch64 and be happy
Yes rdp tcp port 3389 is not public I use ssh port forwarding to my PC
Linux: ssh -L 3389:localhost:3389 -i mykey ubuntu@myip
Windows: Configure Putty-Connection.SSH.Tunnels
You can publish any port in OCI config and Ubuntu FW, not recommended for rdp :-)
1€ only for verification, try several times. I see this problem on some youtube video.
Try Netherlands as home
Just open account on Oracle Cloud and create new compute VM: 4 ARMv8.2 CPU 3GHz, 24GB Ram (yes 24GB).
This is always free VM (you can combine this 4 cores and 24GB Ram to 1 or many (4) VM).
Install Ubuntu 20.04 server, then install LXDE and XRdp for remote access.
Now I have nice speed workstation. Install fpcupdeluxe then fpc 3.2.2/laz 2.0.12, all OK. fpcup build is faster then my local pc build :-)
mormot2 compile package OK, build mormot2_test OK.
mormot2test freeze on 2.7. Client server access: , I must press ^C
log end screen stdout: http://halkyon.com/download/mormot2test.zip
This OCI VM can be great mormot application server for some projects. I don't have any connection to Oracle just test there product.
This is Lazarus bug! Any hint how to set custom defines in mormot2test project in Lazarus/Windows.
When I click on Defines in Custom Options I have error:
Error parsing custom options: Option 11047 is not found in set -v
Try with Lazarus v2.0.12 and v2.0.13 (Laz2fix)
I need to define USEZEOS and add USEIBX, I'm working on FirebirdSQL external connection based on Lazarus IBX2 (FB Pascal API interface) mormot.db.sql.ibx.pas
http://halkyon.com/download/lazerr.jpg
Better to report Issue in quickjs repo.
If you add setlocale(LC_ALL, 'C') this will impact every app using mORMot2 or can be set only for quickjs?
OK I see you edit post, SetLibcNumericLocale is nice workaround.
My locale.conf is:
LANG=en_US.UTF-8
LC_NUMERIC=mk_MK.UTF-8
LC_TIME=mk_MK.UTF-8
LC_PAPER=mk_MK.UTF-8
LC_NAME=mk_MK.UTF-8
LC_ADDRESS=mk_MK.UTF-8
LC_TELEPHONE=mk_MK.UTF-8
LC_MEASUREMENT=mk_MK.UTF-8
LC_IDENTIFICATION=mk_MK.UTF-8
English language with locale formatings only. With this config I have 1000 fails 777<>777.777
When I change locales for numbers line LC_NUMERIC= is missing from locale.conf
3.1. Core script:
- Quick JS low level: 40,057 assertions passed 1.10s
Total failed: 0 / 40,057 - Core script PASSED 1.10sTry with
LANG=de_DE.UTF8
LC_NUMERIC=en_US.UTF-8
It's strange I know, 777 come from quickjs, after change locale test fails, but after linux restart test is OK. Try reboot.
I return locale for numbers to my country and test fail again after reboot. Look like quickjs use locale internally for some conversions!
@ab @stj, about 777.777, I have the same error, this is not cpu related only Locales settings, I change in Manjaro Settings Manager - Locale Settings change settings for Numbers and Currency to en_US and test pass no more 777<>777.777. How many times we will have problem with decimal dot or comma, my country locale is decimal comma :-)
Check your /etc/locale.conf
@damiand, I have the same debugger error when try to debug MVC Blog demo with mORMot2.
In Lazarus menu Tools-Options in Debugger-General options try to change InternalStartBreak to gdsbMain.
@ab Thanks and Thanks for adding OnBeforeRender in MVC it will help a lot when using htmx, hotwire turbo or similar libraries where we need to serve different html response depend of request headers.
@ab this simple test project work in mORMot1 but in mORMot2 raise exception
aModel := CreateModel;
try
aServer := TRestServerDB.Create(aModel,Executable.ProgramFilePath+'MVCServer.db');
try
aServer.DB.Synchronous := smNormal;
aServer.DB.LockingMode := lmExclusive;
aServer.Server.CreateMissingTables;
try
Article := TOrmArticle.Create;
try
if aServer.Orm.Retrieve(666,Article) then begin
writeln(article.GetJsonValues(true,true,ooSelect)); // This is OK Author: 1
writeln(FormatUTF8('%', [ObjectToJson(Article)])); // exception
end;
finally
Article.Free;
end;
readln;
finally
aServer.Free;
end;
finally
aModel.Free;
end;Can someone check what is a problem with serialization of TOrmArticle, problem is in procedure _JS_ID serialization of ID.
I create new test simple rest server project to exclude MVCApp, using same sqlite db and MVCModel, same problem.
TOrmArticle use FTS, I create new class TOrmArttest same as TOrmArticle (copy/paste) without FTS, same problem.
I try to change TOrmArttest = class(TOrmContent) to TOrmArttest = class(TOrm) and add all published property from inherited classes, same problem.
I'm experimenting with htmx.org, alpinejs, windi, vite project served by MVC mORMot and want to use mORMot2, some changes must be done in MCV App for serving htmx request, every URI must have 2 mustache templates, 1 for htmx request (HX-data in header of request) only returning iframe/partial and 2 for page reload/refresh full page as now.
Thanks, just to notice TOrmArticle serialization this is not MVC related
RestModel.Orm.Retrieve(ID,Article);
writeln(FormatUTF8('%', [ObjectToJson(Article)])); // << is broken, test in ArticleView
I'm testing mormot2 with FPC Win and Linux and convert 30-MVC Server sample to PUREMORMOT2
You can download converted sample from http://halkyon.com/download/MVCServer.zip
In MVCViewModel.pas
1. Default URI is OK
2. AuthorView is broken with "out Author: TOrmAuthor" parameter, I changed to "var Author: TOrmAuthor" and now is OK (line 42)
3. ArticleView is broken, exception on TObjectList parameter create in ExecuteJson.
In mormot.core.json.pas line 9203, function _New_ObjectList(Rtti: TRttiCustom): pointer;
I change
result := TObjectList(Rtti.ValueClass).Create;
to
result := Rtti.ValueClass.Create;
Now TObjectList is created and ArticleView method is executed, but new exception is raised on serialization of var Article: TOrmArticle in mormot.core.json
line 4966 in procedure _JS_ID
Ctxt.W.Add(Data^); here Data heve value of $09, Can not access memory at address $09.
Is this typo in post or in your code
.MapField('TypeKW', 'Type')
vs
.MapField('Type', 'TypeKW')
Thank's a lot @ab for your response and this wonderful framework. My confusion is I don' see any Uri from PrivateRaley or PublicRaley to proxy, only address and port. Nginx now proxy / to node vue application, /api to mORMot method based service, /intf to mORMot interface service and I need ex. /relay to PublicRelay server. I already see https://synopse.info/forum/viewtopic.ph … 669#p27669
Where can I post Case Study made by mORMot project's?
Any sample of nginx conf for private relay as client, what uri/location to proxy. I already serv / and some other uri's.
Can I put Public Relay (TPublicRelay) behind Nginx proxy server and how to configure nginx?
In TPublicRelay.Create I see aClientsPort and aServerPort. aServerPort is port where TPrivateRelay connect, correct?
Can this be configured if only 443 port is enabled in nginx or I need additional port on nginx?
My idea is to enable on my public web server microservice to connect to private microservice and don't open additional port on web server. Only to open Nginx port to public on web server. In case of Public Relay and client on same web server, I don't need aClientsPort in nginx configuration. What uri to configure in nginx/proxy_pass for PrivateRelay to connect?
@ab waiting for 38 - WebSockets Relay Sample :-)
hello.
Could you provide a unit complete source code for this.
I Urge to use it in my lazarus project.
Already merged in trunk https://github.com/synopse/mORMot/pull/327
This is my code how I open/create TBufDataset
function TDBConn.OpenAttOpt(aId: integer): TBufDataset;
var Stmt: ISQLDBRows;
begin
Stmt := fProps.Execute('SELECT ID_ATT, WWVALUE, LABEL '+
'FROM WWATT_OPT '+
'WHERE ID_ATT=? ORDER BY ID_ATT, WWVALUE', [aID]);
if not Assigned(fAttOptDataSet) then begin
fAttOptDataSet := TBufDataset.Create(nil);
fAttOptDataSet.FieldDefs.Add('ID_ATT',ftInteger);
fAttOptDataSet.FieldDefs.Add('WWVALUE',ftString, 25);
fAttOptDataSet.FieldDefs.Add('LABEL',ftString, 40);
fAttOptDataSet.CreateDataSet;
fAttOptDataSet.Fields[0].Visible:=False;
fAttOptDataSet.Fields[1].DisplayLabel:='Value';
fAttOptDataSet.Fields[1].DisplayWidth:=25;
fAttOptDataSet.Fields[2].DisplayLabel:='Label';
fAttOptDataSet.Fields[2].DisplayWidth:=40;
end;
if ToClientDataSet(fAttOptDataSet, Stmt.Instance, 0, cdsReplace, false) then
result := fAttOptDataSet
else
result := nil;
end; Note: If SQL is empty autocreated fields is Bad, I always create fields manually
Done
https://github.com/synopse/mORMot/pull/327
Also added changes in SynDBVCL, SynDBMidas for use FPC TBufDataset. Current units don't compile in FPC.With this changes I can use SynDB, SynDBRemote to TBufDataset in FPC.
@ab
I just investigate SynDBMidasVCL and find a bug for fpc to work.
{$endif FPC} in line 193 must be moved to line 226. First 3 ToClientDataSet functions are Delphi midas dependent. Also exclude add {$ifndef fpc} in implementation for first 3. Last 2 functions works fine with fpc and TBufDataset.
Is the above not suitable ?
Not suitable this time. TSQLProject is TSQLRecord descendant, I don't use ORM in this db, it is existing ERP database. I use TSQLDBServerSockets from SynDBRemote on server side and TSQLDBSocketConnectionProperties on client. Now I load data in T..ObjectDynArray and display data in VirtualStringTree like a DBGrid. Works well and fast but need a lot of boilerplate code. You define dataset fields from TSQLRecord props. I will try from data in ISQLDBRows interface.
Thanks AOG, but this unit is not replacement for SynDBMidasVCL I need dataset from SynDB server to execute any query in existing not ORM Firebird DB.
I am using the mORMot for filling DBGrids with Lazarus.
The TBufDataset is very suitable. It is used in SynDBMidasVCL.
Works very well.
@AOG I can't compile trunk mORMot SynDBMidasVCL.pas with Lazarus 2fix, fpc 3.2fix. Do you have custom version, can you upload your version. SynDBMidasVCL use SynDBVCL and first error is in PSGetTableName, function GetTableNameFromSQL come from dbcommon Delphi only, I change to:
result := {$ifdef fpc}'' {$else} GetTableNameFromSQL(fCommandText){$endif};
Next error is in SynDBMidasVCL line 281 function From don't exist.
Any hint how you use dataset in Lazarus.
I have TSQLRecord with published TNullableUTF8Text property and inserted some null values.
MultiFieldValues or RetrieveDocVariantArray returns JSON "field_name": '', not "field_name": null.
I checked db with DB Browser for SQLite, fields are NULL in db. This result are for FPC 3.2fix, Win32/64 and Linux64.
I checked select * from table with SynDBExplorer build with Delphi 2007 and Export to JSON returns null as I expect.
Is this a bug or expected for FPC?
I try TSQLRecordFTS5Unicode61 with FTS4WithoutContent.
Table and triggers are created but any insert raise exception docid column don't exists in search table from insert trigger.
Reading FTS5 documentation i make this changes. Main diffeence, FTS4 use docid, FTS5 use rowid.
diff --git "a/SQLite3/mORMot.pas" "b/SQLite3/mORMot.pas"
index 4b8f9288..7d4dfc61 100644
--- "a/SQLite3/mORMot.pas"
+++ "b/SQLite3/mORMot.pas"
@@ -31214,8 +31217,12 @@ begin
case Props.Kind of
rFTS3, rFTS4, rFTS5: begin
if (Props.fFTSWithoutContentFields<>'') and (Props.fFTSWithoutContentTableIndex>=0) then
+ begin
result := FormatUTF8('%content="%",',[result,
aModel.Tables[Props.fFTSWithoutContentTableIndex].SQLTableName]);
+ if Props.Kind = rFTS5 then
+ result := FormatUTF8('%content_rowid="ID",',[result]);
+ end;
for i := 0 to fields.Count-1 do
result := result+fields.List[i].Name+',';
tokenizer := 'simple';
@@ -49266,18 +49273,36 @@ begin
fts := Props.Props.SQLTableName;
ftsfields := Props.Props.SQLTableSimpleFieldsNoRowID;
// see http://www.sqlite.org/fts3.html#*fts4content
- Server.ExecuteFmt('CREATE TRIGGER %_bu BEFORE UPDATE ON % '+
- 'BEGIN DELETE FROM % WHERE docid=old.rowid; END;',
- [main,main,fts]);
- Server.ExecuteFmt('CREATE TRIGGER %_bd BEFORE DELETE ON % '+
- 'BEGIN DELETE FROM % WHERE docid=old.rowid; END;',
- [main,main,fts]);
- Server.ExecuteFmt('CREATE TRIGGER %_au AFTER UPDATE ON % '+
- 'BEGIN INSERT INTO %(docid,%) VALUES(new.rowid%); END;',
- [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
- Server.ExecuteFmt('CREATE TRIGGER %_ai AFTER INSERT ON % '+
- 'BEGIN INSERT INTO %(docid,%) VALUES(new.rowid%); END;',
- [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
+ if Props.Kind=rFTS5 then
+ begin
+ Server.ExecuteFmt('CREATE TRIGGER %_bu BEFORE UPDATE ON % '+
+ 'BEGIN INSERT INTO %(%,rowid,%) VALUES(''delete'',old.rowid%); END;',
+ [main,main,fts,fts,ftsfields, StringReplaceAll(Props.fFTSWithoutContentFields, 'new.', 'old.')]);
+ Server.ExecuteFmt('CREATE TRIGGER %_bd BEFORE DELETE ON % '+
+ 'BEGIN INSERT INTO %(%,rowid,%) VALUES(''delete'',old.rowid%); END;',
+ [main,main,fts,fts,ftsfields, StringReplaceAll(Props.fFTSWithoutContentFields, 'new.', 'old.')]);
+ Server.ExecuteFmt('CREATE TRIGGER %_au AFTER UPDATE ON % '+
+ 'BEGIN INSERT INTO %(rowid,%) VALUES(new.rowid%); END;',
+ [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
+ Server.ExecuteFmt('CREATE TRIGGER %_ai AFTER INSERT ON % '+
+ 'BEGIN INSERT INTO %(rowid,%) VALUES(new.rowid%); END;',
+ [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
+ end
+ else
+ begin
+ Server.ExecuteFmt('CREATE TRIGGER %_bu BEFORE UPDATE ON % '+
+ 'BEGIN DELETE FROM % WHERE docid=old.rowid; END;',
+ [main,main,fts]);
+ Server.ExecuteFmt('CREATE TRIGGER %_bd BEFORE DELETE ON % '+
+ 'BEGIN DELETE FROM % WHERE docid=old.rowid; END;',
+ [main,main,fts]);
+ Server.ExecuteFmt('CREATE TRIGGER %_au AFTER UPDATE ON % '+
+ 'BEGIN INSERT INTO %(docid,%) VALUES(new.rowid%); END;',
+ [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
+ Server.ExecuteFmt('CREATE TRIGGER %_ai AFTER INSERT ON % '+
+ 'BEGIN INSERT INTO %(docid,%) VALUES(new.rowid%); END;',
+ [main,main,fts,ftsfields,Props.fFTSWithoutContentFields]);
+ end;
end;@ab You make my day
Just tested TestSQL3
Manjaro Linux - Linux 5.4.36-1-MANJARO (cp65001)
4 x Intel(R) Core(TM) i3-8145U CPU @ 2.10GHz (x64)
Using mORMot 1.18.5970
TSQLite3LibraryStatic 3.31.0 with internal MM
Generated with: Free Pascal 3.2 64 bit compiler
Time elapsed for all tests: 2m36
Total assertions failed for all test suits: 0 / 43,251,504
with mormot.core.fpcx64mm.pas
Time elapsed for all tests: 1m04
Total assertions failed for all test suits: 0 / 43,253,899
I can't bеlieve this speed boost :-)
Notice total No. of test is different?
Do you try i see it is valid date in postgres but maybe some check in zeosdbo, syndbzeos or...
Can you change some date to day<13, all bad dates have day > 12(months) just a hint
Interesting project
https://blog.alexellis.io/raspberry-pi- … l-gateway/
Datetime field in insert batch is: '2019-11-02T05:55:51'
In Update batch is: '2019-11-02 06:03:28' without T
Can someone suggest working revisions for Raspbian Pi3. I try FPC 40491 with Lazarus2fix with fpcupdeluxe and mormot trunk git from yesterday. Lazarus build is OK, SynDB application build but same error in execution. What version of mormot is working on Pi arm? I think I need older version of mormot.
I'm thinking about Universal Front Aggregate Rest (Interface) Server with API to register/unregister backend servers.
All backend server on start will register there API to front gateway server and unregister on end.
On API update we will just stop backend server and start new version of backend server and new API will be registered on gateway.
Also you can start multiple instances of backend server with same API and gateway will become proxy server.
I have a dream! Can my dream become reality?
This is () hack
Role := TSQLRole.CreateAndFillPrepareMany(Client,'ID = ?) order by (DispOrder',[],[aId]);