sqldbtoolsunit.pas 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561
  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[ftWord] := 'WORD';
  230. FieldtypeDefinitions[ftCurrency] := 'CURRENCY';
  231. FieldtypeDefinitions[ftBytes] := 'BINARY(5)';
  232. FieldtypeDefinitions[ftVarBytes] := 'VARBINARY(10)';
  233. FieldtypeDefinitions[ftMemo] := 'CLOB'; //or TEXT SQLite supports both, but CLOB is sql standard (TEXT not)
  234. FieldtypeDefinitions[ftWideString] := 'NVARCHAR(10)';
  235. FieldtypeDefinitions[ftWideMemo] := 'NCLOB';
  236. end;
  237. end;
  238. if SQLConnType in [mysql40,mysql41] then
  239. begin
  240. // Mysql versions prior to 5.0.3 removes the trailing spaces on varchar
  241. // fields on insertion. So to test properly, we have to do the same
  242. for i := 0 to testValuesCount-1 do
  243. testStringValues[i] := TrimRight(testStringValues[i]);
  244. end;
  245. if SQLServerType in [ssMySQL] then
  246. begin
  247. // Some DB's do not support milliseconds in datetime and time fields.
  248. for i := 0 to testValuesCount-1 do
  249. begin
  250. testTimeValues[i] := copy(testTimeValues[i],1,8)+'.000';
  251. testValues[ftTime,i] := copy(testTimeValues[i],1,8)+'.000';
  252. if length(testValues[ftDateTime,i]) > 19 then
  253. testValues[ftDateTime,i] := copy(testValues[ftDateTime,i],1,19)+'.000';
  254. end;
  255. end;
  256. if SQLServerType in [ssFirebird, ssInterbase, ssMSSQL, ssPostgreSQL, ssSybase] then
  257. begin
  258. // Some db's do not support times > 24:00:00
  259. testTimeValues[3]:='13:25:15.000';
  260. testValues[ftTime,3]:='13:25:15.000';
  261. if SQLServerType in [ssFirebird, ssInterbase] then
  262. begin
  263. // Firebird does not support time = 24:00:00
  264. testTimeValues[2]:='23:00:00.000';
  265. testValues[ftTime,2]:='23:00:00.000';
  266. end;
  267. end;
  268. if SQLServerType in [ssMSSQL, ssSybase] then
  269. // Some DB's do not support datetime values before 1753-01-01
  270. for i := 18 to testValuesCount-1 do
  271. begin
  272. testValues[ftDate,i] := testValues[ftDate,0];
  273. testValues[ftDateTime,i] := testValues[ftDateTime,0];
  274. end;
  275. // DecimalSeparator must correspond to monetary locale (lc_monetary) set on PostgreSQL server
  276. // Here we assume, that locale on client side is same as locale on server
  277. if SQLServerType in [ssPostgreSQL] then
  278. for i := 0 to testValuesCount-1 do
  279. testValues[ftCurrency,i] := QuotedStr(CurrToStr(testCurrencyValues[i]));
  280. // SQLite does not support fixed length CHAR datatype
  281. // MySQL by default trimms trailing spaces on retrieval; so set sql-mode="PAD_CHAR_TO_FULL_LENGTH" - supported from MySQL 5.1.20
  282. // MSSQL set SET ANSI_PADDING ON
  283. // todo: verify Sybase behaviour
  284. if SQLServerType in [ssSQLite] then
  285. for i := 0 to testValuesCount-1 do
  286. testValues[ftFixedChar,i] := PadRight(testValues[ftFixedChar,i], 10);
  287. end;
  288. procedure TSQLDBConnector.CreateFTransaction;
  289. begin
  290. Ftransaction := tsqltransaction.create(nil);
  291. with Ftransaction do
  292. database := Fconnection;
  293. end;
  294. Function TSQLDBConnector.CreateQuery : TSQLQuery;
  295. begin
  296. Result := TSQLQuery.create(nil);
  297. with Result do
  298. begin
  299. database := Fconnection;
  300. transaction := Ftransaction;
  301. PacketRecords := -1; // To avoid: "Connection is busy with results for another hstmt" (ODBC,MSSQL)
  302. end;
  303. end;
  304. procedure TSQLDBConnector.SetTestUniDirectional(const AValue: boolean);
  305. begin
  306. FUniDirectional:=avalue;
  307. FQuery.UniDirectional:=AValue;
  308. end;
  309. function TSQLDBConnector.GetTestUniDirectional: boolean;
  310. begin
  311. result := FUniDirectional;
  312. end;
  313. procedure TSQLDBConnector.CreateNDatasets;
  314. var CountID : Integer;
  315. begin
  316. try
  317. Ftransaction.StartTransaction;
  318. TryDropIfExist('FPDEV');
  319. Fconnection.ExecuteDirect('create table FPDEV (' +
  320. ' ID INT NOT NULL, ' +
  321. ' NAME VARCHAR(50), ' +
  322. ' PRIMARY KEY (ID) ' +
  323. ')');
  324. FTransaction.CommitRetaining;
  325. for countID := 1 to MaxDataSet do
  326. Fconnection.ExecuteDirect('insert into FPDEV (ID,NAME)' +
  327. 'values ('+inttostr(countID)+',''TestName'+inttostr(countID)+''')');
  328. Ftransaction.Commit;
  329. except
  330. if Ftransaction.Active then Ftransaction.Rollback
  331. end;
  332. end;
  333. procedure TSQLDBConnector.CreateFieldDataset;
  334. var CountID : Integer;
  335. FType : TFieldType;
  336. Sql,sql1: String;
  337. begin
  338. try
  339. Ftransaction.StartTransaction;
  340. TryDropIfExist('FPDEV_FIELD');
  341. Sql := 'create table FPDEV_FIELD (ID INT NOT NULL,';
  342. for FType := low(TFieldType)to high(TFieldType) do
  343. if FieldtypeDefinitions[FType]<>'' then
  344. sql := sql + 'F' + Fieldtypenames[FType] + ' ' +FieldtypeDefinitions[FType]+ ',';
  345. Sql := Sql + 'PRIMARY KEY (ID))';
  346. FConnection.ExecuteDirect(Sql);
  347. FTransaction.CommitRetaining;
  348. for countID := 0 to testValuesCount-1 do
  349. begin
  350. Sql := 'insert into FPDEV_FIELD (ID';
  351. Sql1 := 'values ('+IntToStr(countID);
  352. for FType := low(TFieldType)to high(TFieldType) do
  353. if FieldtypeDefinitions[FType]<>'' then
  354. begin
  355. sql := sql + ',F' + Fieldtypenames[FType];
  356. if testValues[FType,CountID] <> '' then
  357. if FType in [ftCurrency] then
  358. sql1 := sql1 + ',' + testValues[FType,CountID]
  359. else
  360. sql1 := sql1 + ',' + QuotedStr(testValues[FType,CountID])
  361. else
  362. sql1 := sql1 + ',NULL';
  363. end;
  364. Sql := sql + ')';
  365. Sql1 := sql1+ ')';
  366. Fconnection.ExecuteDirect(sql + ' ' + sql1);
  367. end;
  368. Ftransaction.Commit;
  369. except
  370. on E: Exception do begin
  371. //writeln(E.Message);
  372. if Ftransaction.Active then Ftransaction.Rollback;
  373. end;
  374. end;
  375. end;
  376. procedure TSQLDBConnector.DropNDatasets;
  377. begin
  378. if assigned(FTransaction) then
  379. begin
  380. try
  381. if Ftransaction.Active then Ftransaction.Rollback;
  382. Ftransaction.StartTransaction;
  383. Fconnection.ExecuteDirect('DROP TABLE FPDEV');
  384. Ftransaction.Commit;
  385. Except
  386. if Ftransaction.Active then Ftransaction.Rollback
  387. end;
  388. end;
  389. end;
  390. procedure TSQLDBConnector.DropFieldDataset;
  391. begin
  392. if assigned(FTransaction) then
  393. begin
  394. try
  395. if Ftransaction.Active then Ftransaction.Rollback;
  396. Ftransaction.StartTransaction;
  397. Fconnection.ExecuteDirect('DROP TABLE FPDEV_FIELD');
  398. Ftransaction.Commit;
  399. Except
  400. if Ftransaction.Active then Ftransaction.Rollback
  401. end;
  402. end;
  403. end;
  404. function TSQLDBConnector.InternalGetNDataset(n: integer): TDataset;
  405. begin
  406. Result := CreateQuery;
  407. with (Result as TSQLQuery) do
  408. begin
  409. sql.clear;
  410. sql.add('SELECT * FROM FPDEV WHERE ID < '+inttostr(n+1));
  411. UniDirectional:=TestUniDirectional;
  412. end;
  413. end;
  414. function TSQLDBConnector.InternalGetFieldDataset: TDataSet;
  415. begin
  416. Result := CreateQuery;
  417. with (Result as TSQLQuery) do
  418. begin
  419. sql.clear;
  420. sql.add('SELECT * FROM FPDEV_FIELD');
  421. tsqlquery(Result).UniDirectional:=TestUniDirectional;
  422. end;
  423. end;
  424. procedure TSQLDBConnector.TryDropIfExist(ATableName: String);
  425. begin
  426. // This makes life soo much easier, since it avoids the exception if the table already
  427. // exists. And while this exeption is in a try..except statement, the debugger
  428. // always shows the exception, which is pretty annoying.
  429. try
  430. case SQLServerType of
  431. ssFirebird:
  432. begin
  433. // This only works with Firebird 2+
  434. FConnection.ExecuteDirect('execute block as begin if (exists (select 1 from rdb$relations where rdb$relation_name=''' + ATableName + ''')) '+
  435. 'then execute statement ''drop table ' + ATableName + ';'';end');
  436. FTransaction.CommitRetaining;
  437. end;
  438. ssMSSQL:
  439. begin
  440. // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
  441. // which leads to the rollback not referring to the right transaction=>SQL error
  442. // Use SQL92 ISO standard INFORMATION_SCHEMA:
  443. FConnection.ExecuteDirect(
  444. 'if exists (select * from INFORMATION_SCHEMA.TABLES where TABLE_TYPE=''BASE TABLE'' AND TABLE_NAME=''' + ATableName + ''') '+
  445. 'begin '+
  446. 'drop table ' + ATableName + ' '+
  447. 'end');
  448. end;
  449. ssSybase:
  450. begin
  451. // Checking is needed here to avoid getting "auto rollback" of a subsequent CREATE TABLE statement
  452. // which leads to the rollback not referring to the right transaction=>SQL error
  453. // Can't use SQL standard information_schema; instead query sysobjects for User tables
  454. FConnection.ExecuteDirect(
  455. 'if exists (select * from sysobjects where type = ''U'' and name=''' + ATableName + ''') '+
  456. 'begin '+
  457. 'drop table ' + ATableName + ' '+
  458. 'end');
  459. end;
  460. end;
  461. except
  462. FTransaction.RollbackRetaining;
  463. end;
  464. end;
  465. procedure TSQLDBConnector.CommitDDL;
  466. begin
  467. // Commits schema definition and manipulation statements;
  468. // Firebird/Interbase need a commit after a DDL statement. Not necessary for the other connections
  469. if SQLServerType in [ssFirebird, ssInterbase] then
  470. Transaction.CommitRetaining;
  471. end;
  472. destructor TSQLDBConnector.Destroy;
  473. begin
  474. if assigned(FTransaction) then
  475. begin
  476. try
  477. if Ftransaction.Active then Ftransaction.Rollback;
  478. Ftransaction.StartTransaction;
  479. Fconnection.ExecuteDirect('DROP TABLE FPDEV2');
  480. Ftransaction.Commit;
  481. Except
  482. if Ftransaction.Active then Ftransaction.Rollback;
  483. end; // try
  484. end;
  485. inherited Destroy;
  486. FreeAndNil(FQuery);
  487. FreeAndNil(FTransaction);
  488. FreeAndNil(FConnection);
  489. end;
  490. constructor TSQLDBConnector.Create;
  491. begin
  492. FConnection := nil;
  493. CreateFConnection;
  494. CreateFTransaction;
  495. FQuery := CreateQuery;
  496. FConnection.Transaction := FTransaction;
  497. Inherited;
  498. end;
  499. initialization
  500. RegisterClass(TSQLDBConnector);
  501. end.