#1 2021-09-13 09:35:44

flydev
Member
From: France
Registered: 2020-11-27
Posts: 73
Website

Update to latest mORMot2 doesn't create External Tables

Hi,

I updated my project to the latest mORMot2 with SQLite static libs 3.36 and the latest Zeos lib and it look like that External Tables are not created anymore, it's possible that I missed something between two updates of the framework, I didn't saw a note about that.

With VERBOSE logs enabled, when the server start (CreateMissingTable log line reduced) :

> Old version :

[...]

20210913 11135418 DB            mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) CreateMissingTables on {"TSqlDatabase(0378b490)"}
20210913 11135418 DB            mormot.orm.sqlite3.TRestOrmServerDB(02de2b80) GetTables=["AuthGroup","AuthUser","PlateRawData"]
20210913 11135418  +            mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData
20210913 11135418 info                  mormot.orm.sql.TRestStorageExternal(0344a720) TOrmPlateRawData as PlateRawData {"TSqlDBZeosConnectionProperties(02d54ec0)":
{Engine:"SqlDBZeos",ServerName:"localhost",DatabaseNameSafe:"remotesagas",UserID:"foobar",Dbms:"dMySQL",DbmsEngineName:"MySQL",BatchSendingAbilities:["cCreate"],BatchMaxSentAtOnce:4096,LoggedSqlMaxSize:2048,UseCache:true,StatementMaxMemory:536870912,RollbackOnDisconnect:true,DateTimeFirstChar:84,DBMSName:"mysql"}} 
Server={"TRestOrmServerDB(02de2b80)":{StaticVirtualTableDirect:true,DB:{"TSqlDatabase(0378b490)":
{FileName:"vremotesagas.db",UseCache:true,UseCacheSize:16777216,CacheSize:10000,PageSize:4096,PageCount:22,FileSize:90112,Synchronous:"smFull",LockingMode:"lmNormal",OpenV2Flags:6,SQLite3Library:{"TSqlite3LibraryStatic(02d833a0)":{Version:"TSqlite3LibraryStatic 3.35.5 with internal MM"}}}}}}

[...]

20210913 11135419  +            mormot.db.sql.zeos TSqlDBZeosStatement.Step (1203)
Server is now running on mykingspark.fr:61337/root

> New Version

20210913 11130122 SQL           mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 206us vremotesagas.db returned 14 rows SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20210913 11130122 DB            mormot.orm.sqlite3.TRestOrmServerDB(02e32040) CreateMissingTables on {"TSqlDatabase(035fce30)"}
20210913 11130122 DB            mormot.orm.sqlite3.TRestOrmServerDB(02e32040) GetTables=["AuthGroup","AuthUser","LprPlateRawData"]
20210913 11130122 SQL           mormot.db.raw.sqlite3.TSqlDatabase(035fce30) 4us vremotesagas.db PRAGMA locking_mode=NORMAL; = true
20210913 11130122  -            00.000.278
20210913 11130124 info          Server is now running on localhost:61337/root

There is no errors in logs.

Statement "mormot.orm.sql.TRestStorageExternal(0344a720).Create TOrmPlateRawData" is missing on the log on new version.
Statement "mormot.db.sql.zeos TSqlDBZeosStatement.Step" is missing on the log on new version.


Any hint ?

Last edited by flydev (2021-09-13 09:43:14)

Offline

#2 2021-09-13 09:58:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,652
Website

Re: Update to latest mORMot2 doesn't create External Tables

Did you setup the tables as external?

Offline

#3 2021-09-13 10:12:33

flydev
Member
From: France
Registered: 2020-11-27
Posts: 73
Website

Re: Update to latest mORMot2 doesn't create External Tables

I think I am doing things as it should. To be honest, I just pulled mORMot2 and compiled.

Model:

function DataModel: TOrmModel;
begin
  Result := TOrmModel.Create([
      TOrmLprPlateRawData
    ], ROOT_NAME);
end;

Server Initialization:

  // get the shared data model
  fModel := DataModel;

  // use external database for all tables
  VirtualTableExternalRegisterAll(fModel, fProps);

  // create the main mORMot server with authentication required
  fRestServer := TRestServerDB.Create(fModel, 'vremotesagas.db', true);

  fHttpServer := TSQLHTTPServer.Create(PORT_NAME, [fRestServer], SERVER_URL, useBidirSocket, 32, secNone);
  fHttpServer.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries

  // create tables or fields if missing
  fRestServer.CreateMissingTables;

PS:  To explain the different table name between the two version, I renamed it on new version.


Edit:

Pastebin of the full start log of the server :  https://pastebin.com/jSgCvjWR

Last edited by flydev (2021-09-13 10:33:45)

Offline

#4 2021-09-13 12:26:06

flydev
Member
From: France
Registered: 2020-11-27
Posts: 73
Website

Re: Update to latest mORMot2 doesn't create External Tables

Ok, back from resto, I cloned mORMot2-3.35.5, compiled the project, and everything is working as expected.

Then I switched to mORMot-3.36.0, compiled the project, and it works as expected too ... externals tables are created.


So everything is working, sorry this post..  if someone has a hint on what could be happening.. like a MySQL cache "issue" or something do not hesitate to write a comments. Thanks.

PS: The only things I didn't tested it's to restart the database server.

Last edited by flydev (2021-09-13 12:27:18)

Offline

Board footer

Powered by FluxBB