The continuation of the topic is mainly the syntax of SQL, the reason for the hasty ending is that the brain has entered the intraweb world.
The related memo will be added at any time below:
Reference code to connect multiple databases: Fdconnection1.execsql (' ATTACH ' c:hr.sdb ' as HR ');
Fdconnection1.execsql (' ATTACH ' c:cust.sdb ' as Cust '); Fdquery1.open (' select * from ' Orders ' o ' + ' left join HR. ') Employees "E on o.employeeid = E.employeeid ' + ' left join Cust."
Customers "C on o.customerid = C.customerid"); Sqlite_onauthorize Reference Code:procedureTform1.formcreate (Sender:tobject);beginfdconnection1.connected: = True; Tsqlitedatabase (FDCONNECTION1.CONNECTIONINTF.CLIOBJ).
Onautorize: = doauthorize; Fdquery1.open; End;procedureTform1.doauthorize (adb:tsqlitedatabase; Acode:integer;ConstAArg1, AArg2, AArg3, aarg4:string;varAresult:integer);beginMEMO1.LINES.ADD (Format ('%d-%s-%s-%s-%s ', [Acode, AArg1, AArg2, AArg3, AArg4]);ifAcode = Sqlite_deletethenAresult: = Sqlite_denyElseAresult: = SQLITE_OK; End; Sqlite_onupdate Reference Code:procedureTform1.formcreate (Sender:tobject);beginfdconnection1.connected: = True; Tsqlitedatabase (FDCONNECTION1.CONNECTIONINTF.CLIOBJ).
OnUpdate: = DoUpdate; Fdquery1.open; End;procedureTform1.doupdate (adb:tsqlitedatabase; Aoper:integer;ConstAdatabase, atable:string; Arowid:sqlite3_int64);beginMEMO1.LINES.ADD (Format ('%d-%s-%s-%u ', [Aoper, Adatabase, ATable, Arowid]); End; Quick Select to row: SELECT * from Orders WHERE ROWID =: RID//tfdmemtable replaces TClientDataSet class= "Delphi" " Procedure tform1.formcreate (sender:tobject);
Begin with
FDMemTable1.FieldDefs.AddFieldDef do begin Name: = ' word ';
DataType: = ftstring;
Size: = 50;
End ; with
FDMemTable1.FieldDefs.AddFieldDef do begin Name: = ' ph ';
DataType: = ftstring;
Size: = 50;
End ; with
FDMemTable1.FieldDefs.AddFieldDef do begin Name: = ' note ';
DataType: = ftstring;
Size: = 255;
End ; with
FDMemTable1.FieldDefs.AddFieldDef do begin Name: = ' num ';
DataType: = Ftinteger;
End ;
FDMEMTABLE1.INDEXDEFS.ADD (' index_1 ', ' word ', [ixprimary]);
Fdmemtable1.createdataset;
End ;
Concurrency Related: http://docwiki.embarcadero.com/RADStudio/XE6/en/Using_SQLite_with_FireDAC#Locking_and_Concurrent_Updates
Author:cnblogs in case
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/Delphi/