You are not logged in.
I tried to compile and run the extdb-bench example.
I created a Mysql test as follows:
TTestmysql = class(TTestDatabaseExternalAbstract)
private
published
procedure _SynDBmysql;
end;
procedure TTestmysql._SynDBmysql; var a:TSqlDBFireDACConnectionProperties;
begin
a:=TSqlDBFireDACConnectionProperties.Create('MySQL?Server=localhost;Port=3306','db','user','pass');
a.Parameters.Add('CharacterSet=utf8');
RunExternal(a);
end;
I noticed that the test always fails (Using Delphi 11 and MariaDB 10.6.5).
The problem is caused by the following code:
procedure TTestDatabaseExternalAbstract.ClientCreate;
var
lTables: TRawUtf8DynArray;
begin
if (Props <> nil) and (dbDropTable in Flags) then
begin
// drop only if table exist
Props.GetTableNames(lTables);
if FindPropName(lTables, 'SAMPLERECORD') >= 0 then
begin
Props.ClearConnectionPool;
Props.ThreadSafeConnection.Disconnect;
Props.ExecuteNoResult('drop table SAMPLERECORD', []);
end;
end;
inherited ClientCreate;
end;
Inside lTables, the table names are in the form dbname.tablename and it should be changed to the following:
if FindPropName(lTables, <dbname>+'.'+'SAMPLERECORD') >= 0 then
As a newbie in mormot, I am not sure if mysql config needs something more for ITables to not include the dbname or something else.
Where is the error?
By the way:
The same happens with Postgres that it is included in the example:
mormot.db.sql.postgres, is missing in uses clause
and a "public." is needed before in the same statement:
if FindPropName(lTables, <dbname>+'.'+'SAMPLERECORD') >= 0 then
Even with that direct access postgres fails
Just FYI. Thanks again.
Last edited by dcoun (2021-11-20 12:24:49)
Offline
I have just fixed this sample, and tested it with PostgreSQL.
Please check https://github.com/synopse/mORMot2/commit/779ad860
Seems to work fine by now.
Offline
I have just fixed this sample, and tested it with PostgreSQL.
Please check https://github.com/synopse/mORMot2/commit/779ad860Seems to work fine by now.
Thank you @ab
Offline