You are not logged in.
Pages: 1
Hi Arnaud,
I just want to switch from SQLite to MySQL in my REST - Server.
I wrote this code, but I'm not Sure if it is correct to pass a SQLITE_MEMORY_DATABASE_NAME to TSQLRestServerDB.Create as i did.
Model1 := CreateModel1;
Model2 := CreateModel2;
fConnection := TSQLDBUniDACConnectionProperties.Create(TSQLDBUniDACConnectionProperties.URI(dMySQL,'localhost:3306'),'test','root','');
VirtualTableExternalRegisterAll(Model1, fConnection);
VirtualTableExternalRegisterAll(Model2, fConnection);
SQLDB1 := TSQLDatabase.Create(SQLITE_MEMORY_DATABASE_NAME,'');
// SQLDB1.UseCache := True;
Model1DB := TSQLRestServerDB.Create(Model1,lSQLDB,false);
Model1DB.CreateMissingTables(0);
SQLDB2 := TSQLDatabase.Create(SQLITE_MEMORY_DATABASE_NAME,'');
// SQLDB2.UseCache := True;
Model2DB := TSQLRestServerDB.Create(TSJobsDataModel,jSQLDB,false);
Model2.CreateMissingTables(0);
Server := TSQLHttpServer.Create('8080',[Model1DB, Model2DB],'+',useHttpApiRegisteringURI, 32, secNone);
Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
Can you please look at this code an optimize it ?
Rad Studio 12.3 Athens / 13.0 Ganymede
Offline
Sounds fine to me.
Since VirtualTableExternalRegisterAll() will redirect all tables to MySQL, you do not need to persist any data within the main SQlite3 databases.
So SQLITE_MEMORY_DATABASE_NAME is a perfectly valid option here.
AFAIR, ODBC MySQL or ZEOS MySQL are faster than UniDAC MySQL to access the DB.
See http://blog.synopse.info/post/2014/03/0 … PostgreSQL
Offline
Pages: 1