sqldbtoolsunit.pas 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560
  1. unit SQLDBToolsUnit;
  2. {$mode objfpc}{$H+}
  3. interface
  4. uses
  5. Classes, SysUtils, toolsunit
  6. ,db, sqldb
  7. ,mysql40conn, mysql41conn, mysql50conn, mysql51conn, mysql55conn,ibconnection
  8. {$IFNDEF WIN64}
  9. {See packages\fcl-db\src\sqldb\postgres\fpmake.pp: postgres connector won't be present on Win64}
  10. ,pqconnection
  11. {$ENDIF WIN64}
  12. ,odbcconn
  13. {$IFNDEF WIN64}
  14. {See packages\fcl-db\fpmake.pp: Oracle connector is not built if PostgreSQL connectoris not built}
  15. ,oracleconnection
  16. {$ENDIF WIN64}
  17. ,sqlite3conn
  18. {$IFNDEF WIN64}
  19. {This won't be available on Windows 64, either; perhaps other systems as well}
  20. ,mssqlconn
  21. {$ENDIF WIN64}
  22. ;
  23. type
  24. TSQLConnType = (mysql40,mysql41,mysql50,mysql51,mysql55,postgresql,interbase,odbc,oracle,sqlite3,mssql,sybase);
  25. TSQLServerType = (ssFirebird, ssInterbase, ssMSSQL, ssMySQL, ssOracle, ssPostgreSQL, ssSQLite, ssSybase, ssUnknown);
  26. const MySQLConnTypes = [mysql40,mysql41,mysql50,mysql51,mysql55];
  27. SQLConnTypesNames : Array [TSQLConnType] of String[19] =
  28. ('MYSQL40','MYSQL41','MYSQL50','MYSQL51','MYSQL55','POSTGRESQL','INTERBASE','ODBC','ORACLE','SQLITE3','MSSQL','SYBASE');
  29. FieldtypeDefinitionsConst : Array [TFieldType] of String[20] =
  30. (
  31. '',
  32. 'VARCHAR(10)',
  33. 'SMALLINT',
  34. 'INTEGER',
  35. '', // ftWord
  36. 'BOOLEAN',
  37. 'DOUBLE PRECISION', // ftFloat
  38. '', // ftCurrency
  39. 'DECIMAL(18,4)',// ftBCD
  40. 'DATE',
  41. 'TIME',
  42. 'TIMESTAMP', // ftDateTime
  43. '', // ftBytes
  44. '', // ftVarBytes
  45. '', // ftAutoInc
  46. 'BLOB', // ftBlob
  47. 'BLOB', // ftMemo
  48. 'BLOB', // ftGraphic
  49. '',
  50. '',
  51. '',
  52. '',
  53. '',
  54. 'CHAR(10)', // ftFixedChar
  55. '', // ftWideString
  56. 'BIGINT', // ftLargeInt
  57. '',
  58. '',
  59. '',
  60. '',
  61. '',
  62. '',
  63. '',
  64. '',
  65. '',
  66. '', // ftGuid
  67. 'TIMESTAMP', // ftTimestamp
  68. 'NUMERIC(18,6)',// ftFmtBCD
  69. '', // ftFixedWideChar
  70. '' // ftWideMemo
  71. );
  72. type
  73. { TSQLDBConnector }
  74. TSQLDBConnector = class(TDBConnector)
  75. private
  76. FConnection : TSQLConnection;
  77. FTransaction : TSQLTransaction;
  78. FQuery : TSQLQuery;
  79. FUniDirectional: boolean;
  80. procedure CreateFConnection;
  81. procedure CreateFTransaction;
  82. Function CreateQuery : TSQLQuery;
  83. protected
  84. procedure SetTestUniDirectional(const AValue: boolean); override;
  85. function GetTestUniDirectional: boolean; override;
  86. procedure CreateNDatasets; override;
  87. procedure CreateFieldDataset; override;
  88. procedure DropNDatasets; override;
  89. procedure DropFieldDataset; override;
  90. Function InternalGetNDataset(n : integer) : TDataset; override;
  91. Function InternalGetFieldDataset : TDataSet; override;
  92. procedure TryDropIfExist(ATableName : String);
  93. public
  94. destructor Destroy; override;
  95. constructor Create; override;
  96. procedure CommitDDL;
  97. property Connection : TSQLConnection read FConnection;
  98. property Transaction : TSQLTransaction read FTransaction;
  99. property Query : TSQLQuery read FQuery;
  100. end;
  101. var SQLConnType : TSQLConnType;
  102. SQLServerType : TSQLServerType;
  103. FieldtypeDefinitions : Array [TFieldType] of String[20];
  104. implementation
  105. uses StrUtils;
  106. type
  107. TSQLServerTypesMapItem = record
  108. s: string;
  109. t: TSQLServerType;
  110. end;
  111. const
  112. // names as returned by ODBC SQLGetInfo(..., SQL_DBMS_NAME, ...) and GetConnectionInfo(citServerType)
  113. SQLServerTypesMap : array [0..7] of TSQLServerTypesMapItem = (
  114. (s: 'Firebird'; t: ssFirebird),
  115. (s: 'Interbase'; t: ssInterbase),
  116. (s: 'Microsoft SQL Server'; t: ssMSSQL),
  117. (s: 'MySQL'; t: ssMySQL),
  118. (s: 'Oracle'; t: ssOracle),
  119. (s: 'PostgreSQL'; t: ssPostgreSQL),
  120. (s: 'SQLite3'; t: ssSQLite),
  121. (s: 'ASE'; t: ssSybase)
  122. );
  123. // fall back mapping (e.g. in case GetConnectionInfo(citServerType) is not implemented)
  124. SQLConnTypeToServerTypeMap : array[TSQLConnType] of TSQLServerType =
  125. (ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssMySQL,ssPostgreSQL,ssFirebird,ssUnknown,ssOracle,ssSQLite,ssMSSQL,ssSybase);
  126. { TSQLDBConnector }
  127. procedure TSQLDBConnector.CreateFConnection;
  128. var t : TSQLConnType;
  129. i : integer;
  130. s : string;
  131. begin
  132. for t := low(SQLConnTypesNames) to high(SQLConnTypesNames) do
  133. if UpperCase(dbconnectorparams) = SQLConnTypesNames[t] then SQLConnType := t;
  134. if SQLConnType = MYSQL40 then Fconnection := TMySQL40Connection.Create(nil);
  135. if SQLConnType = MYSQL41 then Fconnection := TMySQL41Connection.Create(nil);
  136. if SQLConnType = MYSQL50 then Fconnection := TMySQL50Connection.Create(nil);
  137. if SQLConnType = MYSQL51 then Fconnection := TMySQL51Connection.Create(nil);
  138. if SQLConnType = MYSQL55 then Fconnection := TMySQL55Connection.Create(nil);
  139. if SQLConnType = SQLITE3 then Fconnection := TSQLite3Connection.Create(nil);
  140. if SQLConnType = POSTGRESQL then Fconnection := TPQConnection.Create(nil);
  141. if SQLConnType = INTERBASE then Fconnection := TIBConnection.Create(nil);
  142. if SQLConnType = ODBC then Fconnection := TODBCConnection.Create(nil);
  143. {$IFNDEF Win64}
  144. if SQLConnType = ORACLE then Fconnection := TOracleConnection.Create(nil);
  145. {$ENDIF Win64}
  146. if SQLConnType = MSSQL then Fconnection := TMSSQLConnection.Create(nil);
  147. if SQLConnType = SYBASE then Fconnection := TSybaseConnection.Create(nil);
  148. if not assigned(Fconnection) then writeln('Invalid database type, check if a valid database type for your achitecture was provided in the file ''database.ini''');
  149. with Fconnection do
  150. begin
  151. DatabaseName := dbname;
  152. UserName := dbuser;
  153. Password := dbpassword;
  154. HostName := dbhostname;
  155. if (dbhostname='') and (SQLConnType=interbase) then
  156. begin
  157. // Firebird embedded: create database file if it doesn't yet exist
  158. // Note: pagesize parameter has influence on behavior. We're using
  159. // Firebird default here.
  160. if not(fileexists(dbname)) then
  161. CreateDB; //Create testdb
  162. end;
  163. if length(dbQuoteChars)>1 then
  164. FieldNameQuoteChars:=dbQuoteChars;
  165. Open;
  166. end;
  167. // determine remote SQL Server to which we are connected
  168. s := Fconnection.GetConnectionInfo(citServerType);
  169. if s = '' then
  170. SQLServerType := SQLConnTypeToServerTypeMap[SQLConnType] // if citServerType isn't implemented
  171. else
  172. for i := low(SQLServerTypesMap) to high(SQLServerTypesMap) do
  173. if SQLServerTypesMap[i].s = s then
  174. SQLServerType := SQLServerTypesMap[i].t;
  175. FieldtypeDefinitions := FieldtypeDefinitionsConst;
  176. case SQLServerType of
  177. ssFirebird:
  178. begin
  179. FieldtypeDefinitions[ftBoolean] := '';
  180. FieldtypeDefinitions[ftMemo] := 'BLOB SUB_TYPE TEXT';
  181. end;
  182. ssInterbase:
  183. begin
  184. FieldtypeDefinitions[ftMemo] := 'BLOB SUB_TYPE TEXT';
  185. FieldtypeDefinitions[ftLargeInt] := 'NUMERIC(18,0)';
  186. end;
  187. ssMSSQL, ssSybase:
  188. // todo: Sybase: copied over MSSQL; verify correctness
  189. begin
  190. FieldtypeDefinitions[ftBoolean] := 'BIT';
  191. FieldtypeDefinitions[ftFloat] := 'FLOAT';
  192. FieldtypeDefinitions[ftCurrency]:= 'MONEY';
  193. FieldtypeDefinitions[ftDate] := 'DATETIME';
  194. FieldtypeDefinitions[ftTime] := '';
  195. FieldtypeDefinitions[ftDateTime]:= 'DATETIME';
  196. FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
  197. FieldtypeDefinitions[ftVarBytes]:= 'VARBINARY(10)';
  198. FieldtypeDefinitions[ftBlob] := 'IMAGE';
  199. FieldtypeDefinitions[ftMemo] := 'TEXT';
  200. FieldtypeDefinitions[ftGraphic] := '';
  201. end;
  202. ssMySQL:
  203. begin
  204. //MySQL recognizes BOOLEAN, but as synonym for TINYINT, not true sql boolean datatype
  205. FieldtypeDefinitions[ftBoolean] := '';
  206. // Use 'DATETIME' for datetime-fields instead of timestamp, because
  207. // mysql's timestamps are only valid in the range 1970-2038.
  208. // Downside is that fields defined as 'TIMESTAMP' aren't tested
  209. FieldtypeDefinitions[ftDateTime] := 'DATETIME';
  210. FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
  211. FieldtypeDefinitions[ftVarBytes] := 'VARBINARY(10)';
  212. FieldtypeDefinitions[ftMemo] := 'TEXT';
  213. end;
  214. ssOracle:
  215. begin
  216. FieldtypeDefinitions[ftBoolean] := '';
  217. FieldtypeDefinitions[ftTime] := 'TIMESTAMP';
  218. FieldtypeDefinitions[ftMemo] := 'CLOB';
  219. end;
  220. ssPostgreSQL:
  221. begin
  222. FieldtypeDefinitions[ftCurrency] := 'MONEY';
  223. FieldtypeDefinitions[ftBlob] := 'BYTEA';
  224. FieldtypeDefinitions[ftMemo] := 'TEXT';
  225. FieldtypeDefinitions[ftGraphic] := '';
  226. end;
  227. ssSQLite:
  228. begin
  229. FieldtypeDefinitions[ftCurrency] := 'CURRENCY';
  230. FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
  231. FieldtypeDefinitions[ftVarBytes] := 'VARBINARY(10)';
  232. FieldtypeDefinitions[ftMemo] := 'CLOB'; //or TEXT SQLite supports both, but CLOB is sql standard (TEXT not)
  233. FieldtypeDefinitions[ftWideString] := 'NVARCHAR(10)';
  234. FieldtypeDefinitions[ftWideMemo] := 'NCLOB';
  235. end;
  236. end;
  237. if SQLConnType in [mysql40,mysql41] then
  238. begin
  239. // Mysql versions prior to 5.0.3 removes the trailing spaces on varchar
  240. // fields on insertion. So to test properly, we have to do the same
  241. for i := 0 to testValuesCount-1 do
  242. testStringValues[i] := TrimRight(testStringValues[i]);
  243. end;
  244. if SQLServerType in [ssMySQL] then
  245. begin
  246. // Some DB's do not support milliseconds in datetime and time fields.
  247. for i := 0 to testValuesCount-1 do
  248. begin
  249. testTimeValues[i] := copy(testTimeValues[i],1,8)+'.000';
  250. testValues[ftTime,i] := copy(testTimeValues[i],1,8)+'.000';
  251. if length(testValues[ftDateTime,i]) > 19 then
  252. testValues[ftDateTime,i] := copy(testValues[ftDateTime,i],1,19)+'.000';
  253. end;
  254. end;
  255. if SQLServerType in [ssFirebird, ssInterbase, ssMSSQL, ssPostgreSQL, ssSybase] then
  256. begin
  257. // Some db's do not support times > 24:00:00
  258. testTimeValues[3]:='13:25:15.000';
  259. testValues[ftTime,3]:='13:25:15.000';
  260. if SQLServerType in [ssFirebird, ssInterbase] then
  261. begin
  262. // Firebird does not support time = 24:00:00
  263. testTimeValues[2]:='23:00:00.000';
  264. testValues[ftTime,2]:='23:00:00.000';
  265. end;
  266. end;
  267. if SQLServerType in [ssMSSQL, ssSybase] then
  268. // Some DB's do not support datetime values before 1753-01-01
  269. for i := 18 to testValuesCount-1 do
  270. begin
  271. testValues[ftDate,i] := testValues[ftDate,0];
  272. testValues[ftDateTime,i] := testValues[ftDateTime,0];
  273. end;
  274. // DecimalSeparator must correspond to monetary locale (lc_monetary) set on PostgreSQL server
  275. // Here we assume, that locale on client side is same as locale on server
  276. if SQLServerType in [ssPostgreSQL] then
  277. for i := 0 to testValuesCount-1 do
  278. testValues[ftCurrency,i] := QuotedStr(CurrToStr(testCurrencyValues[i]));
  279. // SQLite does not support fixed length CHAR datatype
  280. // MySQL by default trimms trailing spaces on retrieval; so set sql-mode="PAD_CHAR_TO_FULL_LENGTH" - supported from MySQL 5.1.20
  281. // MSSQL set SET ANSI_PADDING ON
  282. // todo: verify Sybase behaviour
  283. if SQLServerType in [ssSQLite] then
  284. for i := 0 to testValuesCount-1 do
  285. testValues[ftFixedChar,i] := PadRight(testValues[ftFixedChar,i], 10);
  286. end;
  287. procedure TSQLDBConnector.CreateFTransaction;
  288. begin
  289. Ftransaction := tsqltransaction.create(nil);
  290. with Ftransaction do
  291. database := Fconnection;
  292. end;
  293. Function TSQLDBConnector.CreateQuery : TSQLQuery;
  294. begin
  295. Result := TSQLQuery.create(nil);
  296. with Result do
  297. begin
  298. database := Fconnection;
  299. transaction := Ftransaction;
  300. PacketRecords := -1; // To avoid: "Connection is busy with results for another hstmt" (ODBC,MSSQL)
  301. end;
  302. end;
  303. procedure TSQLDBConnector.SetTestUniDirectional(const AValue: boolean);
  304. begin
  305. FUniDirectional:=avalue;
  306. FQuery.UniDirectional:=AValue;
  307. end;
  308. function TSQLDBConnector.GetTestUniDirectional: boolean;
  309. begin
  310. result := FUniDirectional;
  311. end;
  312. procedure TSQLDBConnector.CreateNDatasets;
  313. var CountID : Integer;
  314. begin
  315. try
  316. Ftransaction.StartTransaction;
  317. TryDropIfExist('FPDEV');
  318. Fconnection.ExecuteDirect('create table FPDEV (' +
  319. ' ID INT NOT NULL, ' +
  320. ' NAME VARCHAR(50), ' +
  321. ' PRIMARY KEY (ID) ' +
  322. ')');
  323. FTransaction.CommitRetaining;
  324. for countID := 1 to MaxDataSet do
  325. Fconnection.ExecuteDirect('insert into FPDEV (ID,NAME)' +
  326. 'values ('+inttostr(countID)+',''TestName'+inttostr(countID)+''')');
  327. Ftransaction.Commit;
  328. except
  329. if Ftransaction.Active then Ftransaction.Rollback
  330. end;
  331. end;
  332. procedure TSQLDBConnector.CreateFieldDataset;
  333. var CountID : Integer;
  334. FType : TFieldType;
  335. Sql,sql1: String;
  336. begin
  337. try
  338. Ftransaction.StartTransaction;
  339. TryDropIfExist('FPDEV_FIELD');
  340. Sql := 'create table FPDEV_FIELD (ID INT NOT NULL,';
  341. for FType := low(TFieldType)to high(TFieldType) do
  342. if FieldtypeDefinitions[FType]<>'' then
  343. sql := sql + 'F' + Fieldtypenames[FType] + ' ' +FieldtypeDefinitions[FType]+ ',';
  344. Sql := Sql + 'PRIMARY KEY (ID))';
  345. FConnection.ExecuteDirect(Sql);
  346. FTransaction.CommitRetaining;
  347. for countID := 0 to testValuesCount-1 do
  348. begin
  349. Sql := 'insert into FPDEV_FIELD (ID';
  350. Sql1 := 'values ('+IntToStr(countID);
  351. for FType := low(TFieldType)to high(TFieldType) do
  352. if FieldtypeDefinitions[FType]<>'' then
  353. begin
  354. sql := sql + ',F' + Fieldtypenames[FType];
  355. if testValues[FType,CountID] <> '' then
  356. if FType in [ftCurrency] then
  357. sql1 := sql1 + ',' + testValues[FType,CountID]
  358. else
  359. sql1 := sql1 + ',' + QuotedStr(testValues[FType,CountID])
  360. else
  361. sql1 := sql1 + ',NULL';
  362. end;
  363. Sql := sql + ')';
  364. Sql1 := sql1+ ')';
  365. Fconnection.ExecuteDirect(sql + ' ' + sql1);
  366. end;
  367. Ftransaction.Commit;
  368. except
  369. on E: Exception do begin
  370. //writeln(E.Message);
  371. if Ftransaction.Active then Ftransaction.Rollback;
  372. end;
  373. end;
  374. end;
  375. procedure TSQLDBConnector.DropNDatasets;
  376. begin
  377. if assigned(FTransaction) then
  378. begin
  379. try
  380. if Ftransaction.Active then Ftransaction.Rollback;
  381. Ftransaction.StartTransaction;
  382. Fconnection.ExecuteDirect('DROP TABLE FPDEV');
  383. Ftransaction.Commit;
  384. Except
  385. if Ftransaction.Active then Ftransaction.Rollback
  386. end;
  387. end;
  388. end;
  389. procedure TSQLDBConnector.DropFieldDataset;
  390. begin
  391. if assigned(FTransaction) then
  392. begin
  393. try
  394. if Ftransaction.Active then Ftransaction.Rollback;
  395. Ftransaction.StartTransaction;
  396. Fconnection.ExecuteDirect('DROP TABLE FPDEV_FIELD');
  397. Ftransaction.Commit;
  398. Except
  399. if Ftransaction.Active then Ftransaction.Rollback
  400. end;
  401. end;
  402. end;
  403. function TSQLDBConnector.InternalGetNDataset(n: integer): TDataset;
  404. begin
  405. Result := CreateQuery;
  406. with (Result as TSQLQuery) do
  407. begin
  408. sql.clear;
  409. sql.add('SELECT * FROM FPDEV WHERE ID < '+inttostr(n+1));
  410. UniDirectional:=TestUniDirectional;
  411. end;
  412. end;
  413. function TSQLDBConnector.InternalGetFieldDataset: TDataSet;
  414. begin
  415. Result := CreateQuery;
  416. with (Result as TSQLQuery) do
  417. begin
  418. sql.clear;
  419. sql.add('SELECT * FROM FPDEV_FIELD');
  420. tsqlquery(Result).UniDirectional:=TestUniDirectional;
  421. end;
  422. end;
  423. procedure TSQLDBConnector.TryDropIfExist(ATableName: String);
  424. begin
  425. // This makes life soo much easier, since it avoids the exception if the table already
  426. // exists. And while this exeption is in a try..except statement, the debugger
  427. // always shows the exception, which is pretty annoying.
  428. try
  429. case SQLServerType of
  430. ssFirebird:
  431. begin
  432. // This only works with Firebird 2+
  433. FConnection.ExecuteDirect('execute block as begin if (exists (select 1 from rdb$relations where rdb$relation_name=''' + ATableName + ''')) '+
  434. 'then execute statement ''drop table ' + ATableName + ';'';end');
  435. FTransaction.CommitRetaining;
  436. end;
  437. ssMSSQL:
  438. begin
  439. // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
  440. // which leads to the rollback not referring to the right transaction=>SQL error
  441. // Use SQL92 ISO standard INFORMATION_SCHEMA:
  442. FConnection.ExecuteDirect(
  443. 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_TYPE=''BASE TABLE'' AND TABLE_NAME=''' + ATableName + ''') '+
  444. 'begin '+
  445. 'drop table ' + ATableName + ' '+
  446. 'end');
  447. end;
  448. ssSybase:
  449. begin
  450. // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
  451. // which leads to the rollback not referring to the right transaction=>SQL error
  452. // Can't use SQL standard information_schema; instead query sysobjects for User tables
  453. FConnection.ExecuteDirect(
  454. 'if exists (select * from sysobjects where type = ''U'' and name=''' + ATableName + ''') '+
  455. 'begin '+
  456. 'drop table ' + ATableName + ' '+
  457. 'end');
  458. end;
  459. end;
  460. except
  461. FTransaction.RollbackRetaining;
  462. end;
  463. end;
  464. procedure TSQLDBConnector.CommitDDL;
  465. begin
  466. // Commits schema definition and manipulation statements;
  467. // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
  468. if SQLServerType in [ssFirebird, ssInterbase] then
  469. Transaction.CommitRetaining;
  470. end;
  471. destructor TSQLDBConnector.Destroy;
  472. begin
  473. if assigned(FTransaction) then
  474. begin
  475. try
  476. if Ftransaction.Active then Ftransaction.Rollback;
  477. Ftransaction.StartTransaction;
  478. Fconnection.ExecuteDirect('DROP TABLE FPDEV2');
  479. Ftransaction.Commit;
  480. Except
  481. if Ftransaction.Active then Ftransaction.Rollback;
  482. end; // try
  483. end;
  484. inherited Destroy;
  485. FreeAndNil(FQuery);
  486. FreeAndNil(FTransaction);
  487. FreeAndNil(FConnection);
  488. end;
  489. constructor TSQLDBConnector.Create;
  490. begin
  491. FConnection := nil;
  492. CreateFConnection;
  493. CreateFTransaction;
  494. FQuery := CreateQuery;
  495. FConnection.Transaction := FTransaction;
  496. Inherited;
  497. end;
  498. initialization
  499. RegisterClass(TSQLDBConnector);
  500. end.