sqldbtoolsunit.pas 18 KB

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