#1 2023-11-14 08:00:03

sgavrilov
Member
Registered: 2019-05-24
Posts: 14

'stored AS_UNIQUE' and OrmMapExternal

Hello,

Environment: Delphi XE2, TRestServerDB, SQLite3 database, 4 tables in a model, a table has a field defined as 'stored AS_UNIQUE'.

If the database is created in the constructor of the server

  server := TRestServerDB.Create(aModel, 'c:\temp\test.db', False);
  server.Server.CreateMissingTables;

then everything works as expected: the uniqueness index is created in the test.db.

But if connection properties and the OrmMapExternal are used

  aConnProps := TSQLDBSQLite3ConnectionProperties.Create('c:\temp\test.db', '', '', '');
  ...
  OrmMapExternal(aModel, [ list of tables ], aConnProps);

  server := TRestServerDB.Create(aModel, SQLITE_MEMORY_DATABASE_NAME, False);
  server.Server.CreateMissingTables;

then no index for 'AS_UNIQUE' field is created. It does not matter if the target database is SQLIte3 or MS SQL.

Best regards,
Sergey

Offline

Board footer

Powered by FluxBB