#1 Re: mORMot 2 » Missing TSynCache.Add » 2023-03-11 06:09:45

My purpose is for caching, I will change to AddOrUpdate. Thx u

But maybe little correction for Find() documentation, still written call Add()

   /// find a Key in the cache entries
    // - return '' if nothing found: you may call Add() just after to insert
    // the expected value in the cache

#2 mORMot 2 » Missing TSynCache.Add » 2023-03-10 19:10:23

wienani
Replies: 2

Hallo Ab,

I can't find TSynCache.Add()

In Mormot 1 exist

#4 mORMot 1 » TTaskDialog in Mormot2 ? » 2021-06-02 16:42:42

wienani
Replies: 3

I cannot find it, any plan to include it ?

#6 Re: mORMot 1 » How to Insert by Index Array in TDocVariant ? » 2021-05-27 17:20:17

Yes Ab, I use array in TDocVariant to supply TcxCustomDataSource in cxGrid from DevExpress, their grid support Add and Insert feature

#8 Re: mORMot 1 » TSynBinaryDataSet Error [SQLite3] » 2019-09-30 18:16:11

I already state this topic concatenation https://synopse.info/forum/viewtopic.php?id=3932

The problem sqlite does not know type for concatenation or constant, you can test with SqlLiteStudio

CREATE TABLE t1 AS SELECT 1 AS KeyID, goodsname||goodstype FROM t0

Then look at structure table t1, Data Type is blank, so the solution add CAST every constant or concatenation to tell SQLite for correct data type

CREATE TABLE t1 AS SELECT CAST(1 AS NUMERIC) AS KeyID, CAST(goodsname||goodstype AS TEXT) FROM t0

And i think, at mormot perspective it should yield ColumnType=Unknown for consistency SQLite table structure

#9 Re: mORMot 1 » Help, SQLite Concatenation result cannot load to SynDBVCL » 2017-04-24 06:36:59

ab wrote:

I'm not able to reproduce it here.
I'm able to run requests like this:

select id, Name||"/"||Attributes as toto from Event where clid=10

Yes, it will able to run, what i mean is toto is known as ftUnknown in TSynBinaryDataSet.InternalInitFieldDefs. it should be ftUTF8 or something known.

ab wrote:

Please try just

SELECT Name||" / "||Code FROM PARTNER WHERE Type=1

Are both Name and Code TEXT non NULL fields?

Yes, both are non NULL fields

#10 Re: mORMot 1 » Help, SQLite Concatenation result cannot load to SynDBVCL » 2017-04-23 04:02:42

I'm sorry, here

Properties.ListSource := TDataSource.Create(Self);
Properties.ListSource.DataSet := TSynDBSQLDataSet.Create(Self);

FProps := TSQLDBSQLite3ConnectionProperties.Create(FSession.PathSession + '\cache.dat','','','');
TSynDBSQLDataSet(Properties.ListSource.DataSet).Connection  := FProps;
TSynDBSQLDataSet(Properties.ListSource.DataSet).CommandText := 'SELECT ID, Level, Name||" / "||Code as PartnerName, Code FROM PARTNER WHERE Type=1';
Properties.ListSource.DataSet.Open;  --> error raise after open

Is because SQLite is typeless ? so concatenation become unknown.

Using SQLiteStudio to identify my query, the result is unknown too for concatenation.

But when SELECT typeof( Name||" / "||Code) ... , the result is TEXT.

Sorry for my English

#11 Re: mORMot 1 » Help, SQLite Concatenation result cannot load to SynDBVCL » 2017-04-22 17:18:30

This is my code:

FProps := TSQLDBSQLite3ConnectionProperties.Create(FSession.PathSession + '\cache.dat','','','');
TSynDBSQLDataSet(Properties.ListSource.DataSet).Connection  := FProps;
TSynDBSQLDataSet(Properties.ListSource.DataSet).CommandText := 'SELECT ID, Level, Name||" / "||Code as PartnerName, Code FROM PARTNER WHERE Type=1';
Properties.ListSource.DataSet.Open;  --> error raise after open

#12 mORMot 1 » Help, SQLite Concatenation result cannot load to SynDBVCL » 2017-04-22 16:42:34

wienani
Replies: 6

Example:
  SELECT Name||" / "||Code AS PartnerName FROM Partner.

Raise an error in (InternalInitFieldDefs) --> GetFieldData ColumnType = Unknown

#13 Re: mORMot 1 » TestSQL3.dpr tests abend on invalid Variant » 2016-01-06 18:24:12

Hi Ab, I have same error using _Count and _Kind if JSON per line ( _(n) ) is not dvArray or dvObject.

Example:
- "Test" : "abc" --> this will raise 'invalid variant operation'
- "Test" : [{..},{..}] --> not raise error
- "Test" : {"..":".."} --> not raise error

Maybe same problem with above

#14 Re: mORMot 1 » Current Level only _JSON » 2015-11-17 14:03:56

Sorry ab, I only find Reduce method in TDocVariantData, but the result still have nested inside.

begin
  fVar := _JSon('{"aaa":0,"bbb":1,"ccc":{c1:0,c2:1,c3:{c31:0,c32:1}}}');
  _Safe(fVar)^.Reduce(['ccc'], false, fOut);
  showmessage(fOut.tojson);
end

Result still have nested 'c3'

 {"ccc":{c1:0,c2:1,c3:{c31:0,c32:1}}}

I need a function maybe look like

showmessage(fVar.ccc.CurrentLevel);

ccc   -> {c1:0,c2:1}
root* -> {"aaa":0,"bbb":1}
c3    -> {c31:0,c32:1}

#15 mORMot 1 » Current Level only _JSON » 2015-11-12 01:44:56

wienani
Replies: 3

Is there any options for _JSON for resulting current level from nested json source ? i mean no nested result just current level. sorry my bad english.

Source :
{
   "aaa": 0,
   "bbb": 1,
   "ccc" : {
       c1: 0,
       c2: 1,
       c3: {
          c31: 0,
          c32: 1
       }
    }
}

Output expected for "var.ccc"
{
   "c1": 0,
   "c2": 1
}

#16 Re: mORMot 1 » Problem no such table in ExecureList » 2013-07-11 20:54:12

ab wrote:

Sounds like an issue at Zeos level...

I found this in SynDBZeos.ExecutePrepared

   ...

    for i := 1 to fResultInfo.GetColumnCount do begin
      name := fResultInfo.GetColumnName(i);   --> change to GetColumnLabel(i) then OK
      if name='' then
        name := fResultInfo.GetColumnLabel(i);
      PSQLDBColumnProperty(fColumn.AddAndMakeUniqueName(StringToUTF8(name)))^.
        ColumnType := Props.TZSQLTypeToTSQLDBFieldType(fResultInfo.GetColumnType(i));
    end;
   ...

if I change to GetColumLabel(i) then result is right for alias/label.

#17 Re: mORMot 1 » Problem no such table in ExecureList » 2013-07-11 20:24:44

ab wrote:

For such a query, do not use FDatabase, but the TSQLDBZEOSConnectionProperties instance used to initialize the external table.

You have full and direct access to the FireBird engine with it, via the NewThreadSafeStatementPrepared() method.
The statement is able to return the whole JSON content from ISQLDBRows.FetchAllAsJSON().

Or you can use FDatabase.StaticDataServer[TmoSysRole].ExecuteList() which should work in your case, with an "pure Firebird" SQL statement.

I tried both and the result same and not handling field alias (sql AS statement).

Result "b.USERNAME AS CREATENAME, c.USERNAME AS EDITNAME " is USERNAME and USERNAME_1 not CREATENAME and EDITNAME

Is there anything that can handle AS statement ?

Thank you

#19 Re: mORMot 1 » Problem no such table in ExecureList » 2013-07-11 08:39:13

ab wrote:

FDatabase accesses the "internal" SQLite3 engine, not the external engine.
Therefore, from the "internal" engine, the table is a virtual table, which name is probably MOSYSROLE (from TmoSysRole).

But you should better not use such SQL statement, but rely on ORM methods, which will also faster, since they are able
to detect that the table is external, therefore will directly access FireBird, and bypass the internal SQlite3 virtual table.

Actually i do want make complex query join, as you suggest from several post ini this forum
to use ExecuteList, but you are right i just know that virtual table create using class name TmoSysRole --> MOSYSROLE

But after i change to TSysRole, then resulting AV Error for join query

  Result := FDatabase.ExecuteList([TSYS_ROLE, TSYS_USER],
    'SELECT a.ID, a.ROLENAME, a.POLICY, a.NOTES, a.CREATEDATE, a.EDITDATE, ' +
           'b.USERNAME AS CREATENAME, c.USERNAME AS EDITNAME ' +
    'FROM SYS_ROLE a LEFT JOIN SYS_USER b ON a.CREATEUSERID=b.ID ' +
                    'LEFT JOIN SYS_USER c ON a.EDITUSERID=c.ID'
  );

Is there another function like ExecuteList that directly access to Firebird ? because i want to use EXECUTE BLOCK
feature in firebird.

Thank you.

#20 mORMot 1 » Problem no such table in ExecureList » 2013-07-11 04:34:18

wienani
Replies: 8

Hallo ab, I tried two code

VirtualTableExternalRegister(FModel, TmoSysRole, AConProps, 'SYS_ROLE');
...
Result := FDatabase.MultiFieldValues(TmoSysRole, AFieldsOrder, AWhereClause);

Success

VirtualTableExternalRegister(FModel, TmoSysRole, AConProps, 'SYS_ROLE');
...
Result := FDatabase.ExecuteList([TmoSysRole],
    'SELECT * FROM SYS_ROLE'
);

Fail with error: no such table: SYS_ROLE, look like that sqllite error message

Why ? table SYS_ROLE is already in database.
I'm using SynDBZeos with Firebird

Thank you

#21 mORMot 1 » Request feature TSQLTable.InsertRecord » 2013-05-02 23:52:45

wienani
Replies: 1

Hi AB,

NewRecord only append, can I request for Inserting ? like TSQLTable.InsertRecord(APos: integer; RecordType: TSQLRecordClass=nil)

I need this feature for inserting row in unbound devexpress grid.

Sorry my bad english.
TIA - Hanny

#22 Re: mORMot 1 » Connect Firebird » 2013-02-25 03:36:25

Woww.. finally Firebird native connection.

Thank you Arnaud

#23 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-18 15:46:46

Hi Arnaud,

After upgrade to 1.18, No such Column:ID error is gone now. But using my SynDBFIBPlus still error No such Column:ID. But at least i have reference now. Thx you.

#24 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-18 15:02:15

ab wrote:

how is the data in your db?
there should be an ID column in the table.

Yes, there is an ID in the .mdb table

ab wrote:

also please report the exact error message and code line.

there was now issue with jet on our tests about a missing column.

column ID is an integer, and you should use the corresponding create  instead of manual id=? query.

I'll check the code tomorrow..

D:\Bledec\Projects\BledecXEServer.exe 1.0.0.0 (2012-09-18 21:41:24)
Host=HANNY-NB User=Hanny Wibisono CPU=8*0-6-10759 OS=12.1=6.1.7601 Wow64=0 Freq=1948740
TSynLog 1.17 2012-09-18T21:43:04

20120918 21430448 EXC   ESQLite3Exception ("no such column: ID") at 0056B467  stack trace 00556B70 005E111A 005E066D 005DFE6C 00459999 004080C2 7784ED6C 77B9377B 77B9374E 
D:\Bledec\Projects\BledecXEServer.exe 1.0.0.0 (2012-09-18 21:41:24)
Host=HANNY-NB User=Hanny Wibisono CPU=8*0-6-10759 OS=12.1=6.1.7601 Wow64=0 Freq=1948740
TSynLog 1.17 2012-09-18T21:42:59

20120918 21425901 DB    CreateDatabase for "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TestMormot\Bledec.mdb;User Id=Admin;Password=;" returned 1
20120918 21425906  +    00569E85 
20120918 21425906  -    0056A2F5  00.000.811
20120918 21425906  +    TSQLDatabase(01E26A80).00569792 
20120918 21425906 SQL   	SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20120918 21425906  -    TSQLDatabase(01E26A80).00569809  00.000.631
20120918 21425906 debug TSQLDatabase(01E26A80) TableNames=[]
20120918 21425906  +    TSQLDatabase(01E26A80).00569684 
20120918 21425906 SQL   	BEGIN TRANSACTION;
20120918 21425906  -    TSQLDatabase(01E26A80).005696F4  00.000.017
20120918 21425906  +    TSQLDatabase(01E26A80).00569684 
20120918 21425906 SQL   	CREATE VIRTUAL TABLE Sys_UserProfile USING External(SiteID INTEGER, RoleID INTEGER, EmployeeID INTEGER, UserName TEXT COLLATE SYSTEMNOCASE, UserLogin TEXT COLLATE SYSTEMNOCASE, UserPassword TEXT COLLATE SYSTEMNOCASE, RecoveryEmail TEXT COLLATE SYSTEMNOCASE, NumOfLogin INTEGER, Deposit FLOAT, Notes TEXT COLLATE SYSTEMNOCASE, Status INTEGER, CreateDate TEXT COLLATE ISO8601, CreateUserID INTEGER, EditDate TEXT COLLATE ISO8601, EditUserID INTEGER, DataSource INTEGER);
20120918 21425906  +    	TOleDBConnection(01E26C78).006863E6 
20120918 21425906 info  		null
20120918 21425906  -    	TOleDBConnection(01E26C78).0068648F  00.000.008
20120918 21425906  +    	TOleDBConnection(01E26C78).00686140 
20120918 21425907  -    	TOleDBConnection(01E26C78).0068630D  00.005.815
20120918 21425907  +    	TOleDBStatement(01DC87D0).CreateAccessor
20120918 21425907  -    	TOleDBStatement(01DC87D0).CreateAccessor 00.000.026
20120918 21425907  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425907 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425907  -    	TOleDBStatement(01DC87D0).006857AF  00.000.007
20120918 21425907  +    	TOleDBStatement(01DC87D0).CreateAccessor
20120918 21425907  -    	TOleDBStatement(01DC87D0).CreateAccessor 00.000.014
20120918 21425907  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425907 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425907  -    	TOleDBStatement(01DC87D0).006857AF  00.000.005
20120918 21425907  +    	TOleDBStatement(01DC87D0).00684B1F 
20120918 21425907 SQL   		TOleDBStatement(01DC87D0) CREATE TABLE Sys_UserProfile (ID  Decimal(19,0) PRIMARY KEY, SiteID Decimal(19,0),RoleID Decimal(19,0),EmployeeID Decimal(19,0),UserName VarChar(20),UserLogin VarChar(20),UserPassword VarChar(32),RecoveryEmail VarChar(128),NumOfLogin Decimal(19,0),Deposit Currency,Notes LongText,Status Decimal(19,0),CreateDate DateTime,CreateUserID Decimal(19,0),EditDate DateTime,EditUserID Decimal(19,0),DataSource Decimal(19,0))
20120918 21425909  -    	TOleDBStatement(01DC87D0).006850BE  00.042.365
20120918 21425909  +    	TOleDBStatement(01DC88A0).CreateAccessor
20120918 21425910  -    	TOleDBStatement(01DC88A0).CreateAccessor 00.005.661
20120918 21425910  +    	TOleDBStatement(01DC88A0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC88A0) Total rows = 17
20120918 21425910  -    	TOleDBStatement(01DC88A0).006857AF  00.000.009
20120918 21425910  +    	TOleDBStatement(01DC88A0).CreateAccessor
20120918 21425910  -    	TOleDBStatement(01DC88A0).CreateAccessor 00.000.065
20120918 21425910  +    	TOleDBStatement(01DC88A0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC88A0) Total rows = 1
20120918 21425910  -    	TOleDBStatement(01DC88A0).006857AF  00.000.005
20120918 21425910  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425910  -    	TOleDBStatement(01DC87D0).006857AF  00.000.027
D:\Bledec\Projects\BledecXEServer.exe 1.0.0.0 (2012-09-18 21:41:24)
Host=HANNY-NB User=Hanny Wibisono CPU=8*0-6-10759 OS=12.1=6.1.7601 Wow64=0 Freq=1948740
TSynLog 1.17 2012-09-18T21:42:59

20120918 21425901 DB    CreateDatabase for "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TestMormot\Bledec.mdb;User Id=Admin;Password=;" returned 1
20120918 21425906  +    00569E85 
20120918 21425906  -    0056A2F5  00.000.811
20120918 21425906  +    TSQLDatabase(01E26A80).00569792 
20120918 21425906 SQL   	SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20120918 21425906  -    TSQLDatabase(01E26A80).00569809  00.000.631
20120918 21425906 debug TSQLDatabase(01E26A80) TableNames=[]
20120918 21425906  +    TSQLDatabase(01E26A80).00569684 
20120918 21425906 SQL   	BEGIN TRANSACTION;
20120918 21425906  -    TSQLDatabase(01E26A80).005696F4  00.000.017
20120918 21425906  +    TSQLDatabase(01E26A80).00569684 
20120918 21425906 SQL   	CREATE VIRTUAL TABLE Sys_UserProfile USING External(SiteID INTEGER, RoleID INTEGER, EmployeeID INTEGER, UserName TEXT COLLATE SYSTEMNOCASE, UserLogin TEXT COLLATE SYSTEMNOCASE, UserPassword TEXT COLLATE SYSTEMNOCASE, RecoveryEmail TEXT COLLATE SYSTEMNOCASE, NumOfLogin INTEGER, Deposit FLOAT, Notes TEXT COLLATE SYSTEMNOCASE, Status INTEGER, CreateDate TEXT COLLATE ISO8601, CreateUserID INTEGER, EditDate TEXT COLLATE ISO8601, EditUserID INTEGER, DataSource INTEGER);
20120918 21425906  +    	TOleDBConnection(01E26C78).006863E6 
20120918 21425906 info  		null
20120918 21425906  -    	TOleDBConnection(01E26C78).0068648F  00.000.008
20120918 21425906  +    	TOleDBConnection(01E26C78).00686140 
20120918 21425907  -    	TOleDBConnection(01E26C78).0068630D  00.005.815
20120918 21425907  +    	TOleDBStatement(01DC87D0).CreateAccessor
20120918 21425907  -    	TOleDBStatement(01DC87D0).CreateAccessor 00.000.026
20120918 21425907  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425907 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425907  -    	TOleDBStatement(01DC87D0).006857AF  00.000.007
20120918 21425907  +    	TOleDBStatement(01DC87D0).CreateAccessor
20120918 21425907  -    	TOleDBStatement(01DC87D0).CreateAccessor 00.000.014
20120918 21425907  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425907 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425907  -    	TOleDBStatement(01DC87D0).006857AF  00.000.005
20120918 21425907  +    	TOleDBStatement(01DC87D0).00684B1F 
20120918 21425907 SQL   		TOleDBStatement(01DC87D0) CREATE TABLE Sys_UserProfile (ID  Decimal(19,0) PRIMARY KEY, SiteID Decimal(19,0),RoleID Decimal(19,0),EmployeeID Decimal(19,0),UserName VarChar(20),UserLogin VarChar(20),UserPassword VarChar(32),RecoveryEmail VarChar(128),NumOfLogin Decimal(19,0),Deposit Currency,Notes LongText,Status Decimal(19,0),CreateDate DateTime,CreateUserID Decimal(19,0),EditDate DateTime,EditUserID Decimal(19,0),DataSource Decimal(19,0))
20120918 21425909  -    	TOleDBStatement(01DC87D0).006850BE  00.042.365
20120918 21425909  +    	TOleDBStatement(01DC88A0).CreateAccessor
20120918 21425910  -    	TOleDBStatement(01DC88A0).CreateAccessor 00.005.661
20120918 21425910  +    	TOleDBStatement(01DC88A0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC88A0) Total rows = 17
20120918 21425910  -    	TOleDBStatement(01DC88A0).006857AF  00.000.009
20120918 21425910  +    	TOleDBStatement(01DC88A0).CreateAccessor
20120918 21425910  -    	TOleDBStatement(01DC88A0).CreateAccessor 00.000.065
20120918 21425910  +    	TOleDBStatement(01DC88A0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC88A0) Total rows = 1
20120918 21425910  -    	TOleDBStatement(01DC88A0).006857AF  00.000.005
20120918 21425910  +    	TOleDBStatement(01DC87D0).00685729 
20120918 21425910 DB    		TOleDBStatement(01DC87D0) Total rows = 0
20120918 21425910  -    	TOleDBStatement(01DC87D0).006857AF  00.000.027
20120918 21425910  -    TSQLDatabase(01E26A80).005696F4  00.058.711
20120918 21425910  +    TSQLDatabase(01E26A80).00569684 
20120918 21425910 SQL   	CREATE TABLE AuthUser(ID INTEGER PRIMARY KEY AUTOINCREMENT, LogonName TEXT COLLATE SYSTEMNOCASE UNIQUE, DisplayName TEXT COLLATE SYSTEMNOCASE, PasswordHashHexa TEXT COLLATE SYSTEMNOCASE, GroupRights INTEGER, Data BLOB);
20120918 21425910  -    TSQLDatabase(01E26A80).005696F4  00.000.552
20120918 21425910  +    TSQLDatabase(01E26A80).00569684 
20120918 21425910 SQL   	CREATE TABLE AuthGroup(ID INTEGER PRIMARY KEY AUTOINCREMENT, Ident TEXT COLLATE SYSTEMNOCASE UNIQUE, SessionTimeout INTEGER, AccessRights TEXT COLLATE SYSTEMNOCASE);
20120918 21425910  -    TSQLDatabase(01E26A80).005696F4  00.000.308
20120918 21425910  +    TSQLDatabase(01E26A80).005695BC 
20120918 21425910 SQL   	CREATE INDEX IF NOT EXISTS IndexAuthUserGroupRights ON AuthUser(GroupRights);
20120918 21425910  -    TSQLDatabase(01E26A80).0056962E  00.000.196
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (:('Admin'):,:(10):,:('11,1,2,3,4,5,6,7,8,9,10,11,12,... cut ... ,253,254,255,256,0'):); prepared as INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (?,?,?); with 3 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=1
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (:('Supervisor'):,:(60):,:('10,1,2,3,4,5,6,7,8,9,10,11,12,... cut ... ,,254,255,256,0'):); prepared as INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (?,?,?); with 3 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=2
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (:('User'):,:(60):,:('10,1,4,5,6,7,8,9,10,11,12... cut ... ,,254,255,256,0'):); prepared as INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (?,?,?); with 3 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=3
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (:('Guest'):,:(60):,:('0,1,4,5,6,7,8,9,10,11,12,... cut ... ,,254,255,256,0,,,'):); prepared as INSERT INTO AuthGroup (Ident,SessionTimeout,AccessRights) VALUES (?,?,?); with 3 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=4
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (:('Admin'):,:('Admin'):,:('67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd'):,:(1):); prepared as INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (?,?,?,?); with 4 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=1
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (:('Supervisor'):,:('Supervisor'):,:('67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd'):,:(2):); prepared as INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (?,?,?,?); with 4 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=2
20120918 21425910 SQL   TSQLRestServerDB(01D445C0) INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (:('User'):,:('User'):,:('67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd'):,:(3):); prepared as INSERT INTO AuthUser (LogonName,DisplayName,PasswordHashHexa,GroupRights) VALUES (?,?,?,?); with 4 param
20120918 21425910 DB    TSQLDatabase(01E26A80) LastInsertRowID=3
20120918 21425910  +    TSQLDatabase(01E26A80).00569684 
20120918 21425910 SQL   	COMMIT TRANSACTION;
20120918 21425910  -    TSQLDatabase(01E26A80).005696F4  00.007.085
20120918 21425910  +    TOleDBStatement(01DC8CB0).00684B1F 
20120918 21425910 SQL   	TOleDBStatement(01DC8CB0) CREATE UNIQUE INDEX IX_SYS_USERPROFILE_USERLOGIN ON Sys_UserProfile(USERLOGIN)
20120918 21425910  -    TOleDBStatement(01DC8CB0).006850BE  00.001.054
20120918 21425910  +    TOleDBStatement(01DC8CB0).00685729 
20120918 21425910 DB    	TOleDBStatement(01DC8CB0) Total rows = 0
20120918 21425910  -    TOleDBStatement(01DC8CB0).006857AF  00.000.028
20120918 21430319 cache TSQLDatabase(01E26A80) not in cache
20120918 21430319 SQL   TSQLRestServerDB(01D445C0) SELECT ID,LogonName,DisplayName,PasswordHashHexa,GroupRights FROM AuthUser WHERE LogonName=:('User'): LIMIT 1; prepared as SELECT ID,LogonName,DisplayName,PasswordHashHexa,GroupRights FROM AuthUser WHERE LogonName=? LIMIT 1; with 1 param
20120918 21430319 res   TSQLDatabase(01E26A80) [{"ID":3,"LogonName":"User","DisplayName":"User","PasswordHashHexa":"67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd","GroupRights":3}] 
20120918 21430319 cache TSQLDatabase(01E26A80) not in cache
20120918 21430319 SQL   TSQLRestServerDB(01D445C0) SELECT * FROM AuthGroup WHERE RowID=:(3):; prepared as SELECT * FROM AuthGroup WHERE RowID=?; with 1 param
20120918 21430319 res   TSQLDatabase(01E26A80) [{"ID":3,"Ident":"User","SessionTimeout":60,"AccessRights":"10,1,4,5,6,7,8,9,10,11,12,... cut ... ,,254,255,256,0"}] 
20120918 21430448 cache TSQLDatabase(01E26A80) not in cache
20120918 21430448 SQL   TSQLRestServerDB(01D445C0) SELECT * FROM Sys_UserProfile WHERE ID=:('1'): LIMIT 1; prepared as SELECT * FROM Sys_UserProfile WHERE ID=? LIMIT 1; with 1 param
20120918 21430448 res   null
20120918 21431300  +    00569D83 
20120918 21431300  -    00569E0F  00.005.699
20120918 21431300 ERROR Missing TOleDBConnection.Destroy call = 1 stack trace API 005404B0 00687E63 00407BE0 00407FAA 7784ED6C 77B9377B 77B9374E 

#25 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-16 12:39:24

Hi Arnaud,

I try using TOleDBJetConnectionProperties, raise same error "ESQLite3Exception: no such column: ID"


*** For Server ***

procedure TfmMainServer.enStartClick(Sender: TObject);
begin
//    FB := TSQLFIBConnectionProperties.Create('', 'D:\TestMormot\Test.fdb', 'sysdba', 'masterkey');
    FB := TOleDBJetConnectionProperties.Create('D:\TestMormot\Test.mdb', '', 'Admin', '');

    Model := TSQLModel.Create([TSQLSys_UserProfile]);

    VirtualTableExternalRegister(Model, TSQLSys_UserProfile, FB, 'Sys_UserProfile');

    DB := TSQLRestServerDB.Create(Model, ChangeFileExt(paramstr(0),'.data'), true);
    DB.CreateMissingTables(0);
    DB.CreateSQLIndex(TSQLSys_UserProfile, 'USERLOGIN', True, 'IX_SYS_USERPROFILE_USERLOGIN');

    Server := TSQLite3HttpServer.Create('9000', [DB]);
end;


*** For Client ***

  Model := TSQLModel.Create([TSQLSys_UserProfile]);

  Database := TSQLite3HttpClient.Create('127.0.0.1','9000', Model);
  TSQLite3HttpClient(Database).SetUser('User','synopse');

  ShowMessage('Ready To Fetch');

//   Rec := TSQLSys_UserProfile.Create(Database, 'UserLogin=?', [StringToUTF8(enHost.Text)]);   // ==> Success, but ID always 0
   Rec := TSQLSys_UserProfile.Create(Database, 'ID=?', [StringToUTF8(enHost.Text)]);            // ==> FAILED "ESQLite3Exception: no such column: ID"  

  showmessage('ID=' + IntToStr(Rec.ID) + ' - ' + Rec.GetSQLSet);


*** For Model ***

  TSQLSys_UserProfile = class(TSQLRecord)
  protected
    fSiteID: integer;
    fRoleID: integer;
    fEmployeeID: integer;
    fUserName: RawUTF8;
    fUserLogin: RawUTF8;
    fUserPassword: RawUTF8;
    fRecoveryEmail: RawUTF8;
    fNumOfLogin: integer;
    fDeposit: currency;
    fNotes: RawUTF8;
    fStatus: integer;
    fCreateDate: TDateTime;
    fCreateUserID: integer;
    fEditDate: TDateTime;
    fEditUserID: integer;
    fDataSource: integer;

  published
    property SiteID: integer read fSiteID write fSiteID;
    property RoleID: integer read fRoleID write fRoleID;
    property EmployeeID: integer read fEmployeeID write fEmployeeID;
    property UserName: RawUTF8 index 20 read fUserName write fUserName;
    property UserLogin: RawUTF8 index 20 read fUserLogin write fUserLogin;
    property UserPassword: RawUTF8 index 32 read fUserPassword write fUserPassword;
    property RecoveryEmail: RawUTF8 index 128 read fRecoveryEmail write fRecoveryEmail;
    property NumOfLogin: integer read fNumOfLogin write fNumOfLogin;
    property Deposit: currency read fDeposit write fDeposit;
    property Notes: RawUTF8 read fNotes write fNotes;
    property Status: integer read fStatus write fStatus;
    property CreateDate: TDateTime read fCreateDate write fCreateDate;
    property CreateUserID: integer read fCreateUserID write fCreateUserID;
    property EditDate: TDateTime read fEditDate write fEditDate;
    property EditUserID: integer read fEditUserID write fEditUserID;
    property DataSource: integer read fDataSource write fDataSource;
  end;

#26 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-10 06:06:09

ab wrote:

perhaps your testing code is wrong: you do not have to publish by yourself an ID: integer field in your TSQLRecord. It is defined in the parent, in a special way.

No i cannot publish an ID, because your code already block it : "TSQLxx should not include a ID published property"

#27 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-10 06:01:32

ab wrote:

But I do not like the fact that the FIBPlus components are not Open Source.
It could not be included as-this in our source code repository: re-factoring will be needed.

big_smile I understand Arnoud, but my reason made SynDBFIBPlus because I feel still need long time for your framework support Firebird and second I feel your ORM have great basic design to communicate with other DB direct component (sure i need extra time to coding) like OCI.

So I wish if you add "Simple" interfacing framework and guidance to others DB direct component rather than your default DB connection. I think that make your ORM more ready with all type of database with everyone have own SynDBxxx.

I'm sorry about English sad  maybe my idea is from DevExpress QuantumGrid's ProviderMode framework, so i can use my own datasource (XML, Stringlist, JSON etc) not depend from TDataset only.

#28 Re: mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-09-10 05:37:59

After a lot of tracing, i found "GetVirtualTableSQLCreate" not create ID INTEGER for "function vt_Create", so I realize i cannot use WHERE ID=1, always raise an error : "ESQLite3Exception: no such column: ID" at "TSQLRequest.Prepare". Please help me Arnaud, maybe i miss something about creating ID INTEGER ?

Thanks.

#29 mORMot 1 » ID always return 0 (using SynDBFIBPlus.. :D) » 2012-08-31 05:50:27

wienani
Replies: 9

Hi Arnaud,

I try to make connection to Firebird using FIBPlus component, so I make SynDBFIBPlus.pas based on SynDBOracle.pas. As far I can save record and read back. But I'm stuck that ID always returning 0. Please give me a hint to trace it. Thanks

Sorry my bad English

Board footer

Powered by FluxBB