mysqlconn.inc 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669
  1. {$mode objfpc}{$H+}
  2. {$MACRO on}
  3. interface
  4. uses
  5. Classes, SysUtils,sqldb,db,
  6. {$IfDef mysql50}
  7. mysql50dyn;
  8. {$DEFINE TConnectionName:=TMySQL50Connection}
  9. {$DEFINE TTransactionName:=TMySQL50Transaction}
  10. {$DEFINE TCursorName:=TMySQL50Cursor}
  11. {$ELSE}
  12. {$IfDef mysql41}
  13. mysql41dyn;
  14. {$DEFINE TConnectionName:=TMySQL41Connection}
  15. {$DEFINE TTransactionName:=TMySQL41Transaction}
  16. {$DEFINE TCursorName:=TMySQL41Cursor}
  17. {$ELSE}
  18. {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
  19. mysql40dyn;
  20. {$DEFINE TConnectionName:=TMySQLConnection}
  21. {$DEFINE TTransactionName:=TMySQLTransaction}
  22. {$DEFINE TCursorName:=TMySQLCursor}
  23. {$ELSE}
  24. mysql40dyn;
  25. {$DEFINE TConnectionName:=TMySQL40Connection}
  26. {$DEFINE TTransactionName:=TMySQL40Transaction}
  27. {$DEFINE TCursorName:=TMySQL40Cursor}
  28. {$EndIf}
  29. {$EndIf}
  30. {$EndIf}
  31. Type
  32. TTransactionName = Class(TSQLHandle)
  33. protected
  34. end;
  35. TCursorName = Class(TSQLCursor)
  36. protected
  37. FQMySQL : PMySQL;
  38. FRes: PMYSQL_RES; { Record pointer }
  39. FNeedData : Boolean;
  40. FStatement : String;
  41. Row : MYSQL_ROW;
  42. RowsAffected : QWord;
  43. LastInsertID : QWord;
  44. end;
  45. TConnectionName = class (TSQLConnection)
  46. private
  47. FDialect: integer;
  48. FHostInfo: String;
  49. FServerInfo: String;
  50. FMySQL : PMySQL;
  51. function GetClientInfo: string;
  52. function GetServerStatus: String;
  53. procedure ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
  54. protected
  55. function StrToStatementType(s : string) : TStatementType; override;
  56. Procedure ConnectToServer; virtual;
  57. Procedure SelectDatabase; virtual;
  58. function MySQLDataType(AType: enum_field_types; ASize: Integer; var NewType: TFieldType; var NewSize: Integer): Boolean;
  59. function MySQLWriteData(AType: enum_field_types; ASize: Integer; Source, Dest: PChar): Integer;
  60. // SQLConnection methods
  61. procedure DoInternalConnect; override;
  62. procedure DoInternalDisconnect; override;
  63. function GetHandle : pointer; override;
  64. Function AllocateCursorHandle : TSQLCursor; override;
  65. Procedure DeAllocateCursorHandle(var cursor : TSQLCursor); override;
  66. Function AllocateTransactionHandle : TSQLHandle; override;
  67. procedure PrepareStatement(cursor: TSQLCursor;ATransaction : TSQLTransaction;buf : string; AParams : TParams); override;
  68. procedure UnPrepareStatement(cursor:TSQLCursor); override;
  69. procedure FreeFldBuffers(cursor : TSQLCursor); override;
  70. procedure Execute(cursor: TSQLCursor;atransaction:tSQLtransaction;AParams : TParams); override;
  71. procedure AddFieldDefs(cursor: TSQLCursor; FieldDefs : TfieldDefs); override;
  72. function Fetch(cursor : TSQLCursor) : boolean; override;
  73. function LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer) : boolean; override;
  74. function GetTransactionHandle(trans : TSQLHandle): pointer; override;
  75. function Commit(trans : TSQLHandle) : boolean; override;
  76. function RollBack(trans : TSQLHandle) : boolean; override;
  77. function StartdbTransaction(trans : TSQLHandle; AParams : string) : boolean; override;
  78. procedure CommitRetaining(trans : TSQLHandle); override;
  79. procedure RollBackRetaining(trans : TSQLHandle); override;
  80. procedure UpdateIndexDefs(var IndexDefs : TIndexDefs;TableName : string); override;
  81. Public
  82. Property ServerInfo : String Read FServerInfo;
  83. Property HostInfo : String Read FHostInfo;
  84. property ClientInfo: string read GetClientInfo;
  85. property ServerStatus : String read GetServerStatus;
  86. published
  87. property Dialect : integer read FDialect write FDialect;
  88. property DatabaseName;
  89. property HostName;
  90. property KeepConnection;
  91. property LoginPrompt;
  92. property Params;
  93. property OnLogin;
  94. end;
  95. EMySQLError = Class(Exception);
  96. implementation
  97. uses dbconst;
  98. { TConnectionName }
  99. Resourcestring
  100. SErrServerConnectFailed = 'Server connect failed.';
  101. SErrDatabaseSelectFailed = 'failed to select database: %s';
  102. SErrDatabaseCreate = 'Failed to create database: %s';
  103. SErrDatabaseDrop = 'Failed to drop database: %s';
  104. SErrNoData = 'No data for record';
  105. SErrExecuting = 'Error executing query: %s';
  106. SErrFetchingdata = 'Error fetching row data: %s';
  107. SErrGettingResult = 'Error getting result set: %s';
  108. SErrNoQueryResult = 'No result from query.';
  109. SErrNotversion50 = 'TMySQL50Connection can not work with the installed MySQL client version (%s).';
  110. SErrNotversion41 = 'TMySQL41Connection can not work with the installed MySQL client version (%s).';
  111. SErrNotversion40 = 'TMySQL40Connection can not work with the installed MySQL client version (%s).';
  112. Procedure MySQlError(R : PMySQL;Msg: String;Comp : TComponent);
  113. Var
  114. MySQLMsg : String;
  115. begin
  116. If (R<>Nil) then
  117. begin
  118. MySQLMsg:=Strpas(mysql_error(R));
  119. DatabaseErrorFmt(Msg,[MySQLMsg],Comp);
  120. end
  121. else
  122. DatabaseError(Msg,Comp);
  123. end;
  124. function TConnectionName.StrToStatementType(s : string) : TStatementType;
  125. begin
  126. S:=Lowercase(s);
  127. if s = 'show' then exit(stSelect);
  128. result := inherited StrToStatementType(s);
  129. end;
  130. function TConnectionName.GetClientInfo: string;
  131. begin
  132. // To make it possible to call this if there's no connection yet
  133. InitialiseMysql;
  134. Result:=strpas(mysql_get_client_info());
  135. ReleaseMysql;
  136. end;
  137. function TConnectionName.GetServerStatus: String;
  138. begin
  139. CheckConnected;
  140. Result := mysql_stat(FMYSQL);
  141. end;
  142. procedure TConnectionName.ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
  143. begin
  144. HMySQL := mysql_init(HMySQL);
  145. HMySQL:=mysql_real_connect(HMySQL,PChar(H),PChar(U),Pchar(P),Nil,0,Nil,0);
  146. If (HMySQL=Nil) then
  147. MySQlError(Nil,SErrServerConnectFailed,Self);
  148. end;
  149. procedure TConnectionName.ConnectToServer;
  150. Var
  151. H,U,P : String;
  152. begin
  153. H:=HostName;
  154. U:=UserName;
  155. P:=Password;
  156. ConnectMySQL(FMySQL,pchar(H),pchar(U),pchar(P));
  157. FServerInfo := strpas(mysql_get_server_info(FMYSQL));
  158. FHostInfo := strpas(mysql_get_host_info(FMYSQL));
  159. end;
  160. procedure TConnectionName.SelectDatabase;
  161. begin
  162. if mysql_select_db(FMySQL,pchar(DatabaseName))<>0 then
  163. MySQLError(FMySQL,SErrDatabaseSelectFailed,Self);
  164. end;
  165. procedure TConnectionName.DoInternalConnect;
  166. begin
  167. InitialiseMysql;
  168. {$IFDEF mysql50}
  169. if copy(strpas(mysql_get_client_info()),1,3)<>'5.0' then
  170. Raise EInOutError.CreateFmt(SErrNotversion50,[strpas(mysql_get_client_info())]);
  171. {$ELSE}
  172. {$IFDEF mysql41}
  173. if copy(strpas(mysql_get_client_info()),1,3)<>'4.1' then
  174. Raise EInOutError.CreateFmt(SErrNotversion41,[strpas(mysql_get_client_info())]);
  175. {$ELSE}
  176. if copy(strpas(mysql_get_client_info()),1,3)<>'4.0' then
  177. Raise EInOutError.CreateFmt(SErrNotversion40,[strpas(mysql_get_client_info())]);
  178. {$ENDIF}
  179. {$ENDIF}
  180. inherited DoInternalConnect;
  181. ConnectToServer;
  182. SelectDatabase;
  183. end;
  184. procedure TConnectionName.DoInternalDisconnect;
  185. begin
  186. inherited DoInternalDisconnect;
  187. mysql_close(FMySQL);
  188. FMySQL:=Nil;
  189. ReleaseMysql;
  190. end;
  191. function TConnectionName.GetHandle: pointer;
  192. begin
  193. Result:=FMySQL;
  194. end;
  195. function TConnectionName.AllocateCursorHandle: TSQLCursor;
  196. begin
  197. Result:=TCursorName.Create;
  198. end;
  199. Procedure TConnectionName.DeAllocateCursorHandle(var cursor : TSQLCursor);
  200. begin
  201. FreeAndNil(cursor);
  202. end;
  203. function TConnectionName.AllocateTransactionHandle: TSQLHandle;
  204. begin
  205. // Result:=TTransactionName.Create;
  206. Result := nil;
  207. end;
  208. procedure TConnectionName.PrepareStatement(cursor: TSQLCursor;
  209. ATransaction: TSQLTransaction; buf: string;AParams : TParams);
  210. begin
  211. if assigned(AParams) and (AParams.count > 0) then
  212. DatabaseError('Parameters (not) yet supported for the MySQL SqlDB connection.',self);
  213. With Cursor as TCursorName do
  214. begin
  215. FStatement:=Buf;
  216. if FStatementType=stSelect then
  217. FNeedData:=True;
  218. ConnectMySQL(FQMySQL,FMySQL^.host,FMySQL^.user,FMySQL^.passwd);
  219. if mysql_select_db(FQMySQL,pchar(DatabaseName))<>0 then
  220. MySQLError(FQMySQL,SErrDatabaseSelectFailed,Self);
  221. end
  222. end;
  223. procedure TConnectionName.UnPrepareStatement(cursor: TSQLCursor);
  224. begin
  225. // not necessary
  226. end;
  227. procedure TConnectionName.FreeFldBuffers(cursor: TSQLCursor);
  228. Var
  229. C : TCursorName;
  230. begin
  231. C:=Cursor as TCursorName;
  232. if c.FStatementType=stSelect then
  233. c.FNeedData:=False;
  234. If (C.FRes<>Nil) then
  235. begin
  236. C.FRes:=Nil;
  237. end;
  238. if (c.FQMySQL <> Nil) then
  239. begin
  240. mysql_close(c.FQMySQL);
  241. c.FQMySQL:=Nil;
  242. end;
  243. If (C.FRes<>Nil) then
  244. begin
  245. Mysql_free_result(C.FRes);
  246. C.FRes:=Nil;
  247. end;
  248. end;
  249. procedure TConnectionName.Execute(cursor: TSQLCursor;
  250. atransaction: tSQLtransaction;AParams : TParams);
  251. Var
  252. C : TCursorName;
  253. begin
  254. C:=Cursor as TCursorName;
  255. If (C.FRes=Nil) then
  256. begin
  257. if mysql_query(c.FQMySQL,Pchar(C.FStatement))<>0 then
  258. MySQLError(c.FQMYSQL,Format(SErrExecuting,[StrPas(mysql_error(c.FQMySQL))]),Self)
  259. else
  260. begin
  261. C.RowsAffected := mysql_affected_rows(c.FQMYSQL);
  262. C.LastInsertID := mysql_insert_id(c.FQMYSQL);
  263. if C.FNeedData then
  264. C.FRes:=mysql_use_result(c.FQMySQL);
  265. end;
  266. end;
  267. end;
  268. function TConnectionName.MySQLDataType(AType: enum_field_types; ASize: Integer;
  269. var NewType: TFieldType; var NewSize: Integer): Boolean;
  270. begin
  271. Result := True;
  272. case AType of
  273. FIELD_TYPE_TINY, FIELD_TYPE_SHORT, FIELD_TYPE_LONG, FIELD_TYPE_LONGLONG,
  274. FIELD_TYPE_INT24:
  275. begin
  276. NewType := ftInteger;
  277. NewSize := 0;
  278. end;
  279. FIELD_TYPE_DECIMAL, FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE:
  280. begin
  281. NewType := ftFloat;
  282. NewSize := 0;
  283. end;
  284. FIELD_TYPE_TIMESTAMP, FIELD_TYPE_DATETIME:
  285. begin
  286. NewType := ftDateTime;
  287. NewSize := 0;
  288. end;
  289. FIELD_TYPE_DATE:
  290. begin
  291. NewType := ftDate;
  292. NewSize := 0;
  293. end;
  294. FIELD_TYPE_TIME:
  295. begin
  296. NewType := ftTime;
  297. NewSize := 0;
  298. end;
  299. FIELD_TYPE_VAR_STRING, FIELD_TYPE_STRING, FIELD_TYPE_ENUM, FIELD_TYPE_SET:
  300. begin
  301. NewType := ftString;
  302. NewSize := ASize;
  303. end;
  304. else
  305. Result := False;
  306. end;
  307. end;
  308. procedure TConnectionName.AddFieldDefs(cursor: TSQLCursor;
  309. FieldDefs: TfieldDefs);
  310. var
  311. C : TCursorName;
  312. I, FC: Integer;
  313. field: PMYSQL_FIELD;
  314. DFT: TFieldType;
  315. DFS: Integer;
  316. begin
  317. // Writeln('MySQL: Adding fielddefs');
  318. C:=(Cursor as TCursorName);
  319. If (C.FRes=Nil) then
  320. begin
  321. // Writeln('res is nil');
  322. MySQLError(c.FQMySQL,SErrNoQueryResult,Self);
  323. end;
  324. // Writeln('MySQL: have result');
  325. FC:=mysql_num_fields(C.FRes);
  326. For I:= 0 to FC-1 do
  327. begin
  328. field := mysql_fetch_field_direct(C.FRES, I);
  329. // Writeln('MySQL: creating fielddef ',I+1);
  330. if MySQLDataType(field^.ftype, field^.length, DFT, DFS) then
  331. TFieldDef.Create(FieldDefs, field^.name, DFT, DFS, False, I+1);
  332. end;
  333. // Writeln('MySQL: Finished adding fielddefs');
  334. end;
  335. function TConnectionName.Fetch(cursor: TSQLCursor): boolean;
  336. Var
  337. C : TCursorName;
  338. begin
  339. C:=Cursor as TCursorName;
  340. C.Row:=MySQL_Fetch_row(C.FRes);
  341. Result:=(C.Row<>Nil);
  342. end;
  343. function TConnectionName.LoadField(cursor : TSQLCursor;
  344. FieldDef : TfieldDef;buffer : pointer) : boolean;
  345. var
  346. I, FC, CT: Integer;
  347. field: PMYSQL_FIELD;
  348. row : MYSQL_ROW;
  349. C : TCursorName;
  350. begin
  351. // Writeln('LoadFieldsFromBuffer');
  352. C:=Cursor as TCursorName;
  353. if C.Row=nil then
  354. begin
  355. // Writeln('LoadFieldsFromBuffer: row=nil');
  356. MySQLError(c.FQMySQL,SErrFetchingData,Self);
  357. end;
  358. Row:=C.Row;
  359. FC := mysql_num_fields(C.FRES);
  360. for I := 0 to FC-1 do
  361. begin
  362. field := mysql_fetch_field_direct(C.FRES, I);
  363. if field^.name=FieldDef.name then break;
  364. Inc(Row);
  365. end;
  366. CT := MySQLWriteData(field^.ftype, field^.length, Row^, Buffer);
  367. result := true;
  368. end;
  369. function InternalStrToFloat(S: string): Extended;
  370. var
  371. I: Integer;
  372. Tmp: string;
  373. begin
  374. Tmp := '';
  375. for I := 1 to Length(S) do
  376. begin
  377. if not (S[I] in ['0'..'9', '+', '-', 'E', 'e']) then
  378. Tmp := Tmp + DecimalSeparator
  379. else
  380. Tmp := Tmp + S[I];
  381. end;
  382. Result := StrToFloat(Tmp);
  383. end;
  384. function InternalStrToDate(S: string): TDateTime;
  385. var
  386. EY, EM, ED: Word;
  387. begin
  388. EY := StrToInt(Copy(S,1,4));
  389. EM := StrToInt(Copy(S,6,2));
  390. ED := StrToInt(Copy(S,9,2));
  391. if (EY = 0) or (EM = 0) or (ED = 0) then
  392. Result:=0
  393. else
  394. Result:=EncodeDate(EY, EM, ED);
  395. end;
  396. function InternalStrToDateTime(S: string): TDateTime;
  397. var
  398. EY, EM, ED: Word;
  399. EH, EN, ES: Word;
  400. begin
  401. EY := StrToInt(Copy(S, 1, 4));
  402. EM := StrToInt(Copy(S, 6, 2));
  403. ED := StrToInt(Copy(S, 9, 2));
  404. EH := StrToInt(Copy(S, 11, 2));
  405. EN := StrToInt(Copy(S, 14, 2));
  406. ES := StrToInt(Copy(S, 17, 2));
  407. if (EY = 0) or (EM = 0) or (ED = 0) then
  408. Result := 0
  409. else
  410. Result := EncodeDate(EY, EM, ED);
  411. Result := Result + EncodeTime(EH, EN, ES, 0);
  412. end;
  413. function InternalStrToTime(S: string): TDateTime;
  414. var
  415. EH, EM, ES: Word;
  416. begin
  417. EH := StrToInt(Copy(S, 1, 2));
  418. EM := StrToInt(Copy(S, 4, 2));
  419. ES := StrToInt(Copy(S, 7, 2));
  420. Result := EncodeTime(EH, EM, ES, 0);
  421. end;
  422. function InternalStrToTimeStamp(S: string): TDateTime;
  423. var
  424. EY, EM, ED: Word;
  425. EH, EN, ES: Word;
  426. begin
  427. EY := StrToInt(Copy(S, 1, 4));
  428. EM := StrToInt(Copy(S, 5, 2));
  429. ED := StrToInt(Copy(S, 7, 2));
  430. EH := StrToInt(Copy(S, 9, 2));
  431. EN := StrToInt(Copy(S, 11, 2));
  432. ES := StrToInt(Copy(S, 13, 2));
  433. if (EY = 0) or (EM = 0) or (ED = 0) then
  434. Result := 0
  435. else
  436. Result := EncodeDate(EY, EM, ED);
  437. Result := Result + EncodeTime(EH, EN, ES, 0);;
  438. end;
  439. function TConnectionName.MySQLWriteData(AType: enum_field_types;ASize: Integer; Source, Dest: PChar): Integer;
  440. var
  441. VI: Integer;
  442. VF: Double;
  443. VD: TDateTime;
  444. Src : String;
  445. begin
  446. Result := 0;
  447. If (Source<>Nil) Then
  448. Src:=StrPas(Source)
  449. else
  450. Src:='';
  451. case AType of
  452. FIELD_TYPE_TINY, FIELD_TYPE_SHORT, FIELD_TYPE_LONG, FIELD_TYPE_LONGLONG,
  453. FIELD_TYPE_INT24:
  454. begin
  455. Result:=SizeOf(Integer);
  456. if (Src<>'') then
  457. VI := StrToInt(Src)
  458. else
  459. VI := 0;
  460. Move(VI, Dest^, Result);
  461. end;
  462. FIELD_TYPE_DECIMAL, FIELD_TYPE_FLOAT, FIELD_TYPE_DOUBLE:
  463. begin
  464. Result := SizeOf(Double);
  465. if Src <> '' then
  466. VF := InternalStrToFloat(Src)
  467. else
  468. VF := 0;
  469. Move(VF, Dest^, Result);
  470. end;
  471. FIELD_TYPE_TIMESTAMP:
  472. begin
  473. Result := SizeOf(TDateTime);
  474. if Src <> '' then
  475. VD := InternalStrToTimeStamp(Src)
  476. else
  477. VD := 0;
  478. Move(VD, Dest^, Result);
  479. end;
  480. FIELD_TYPE_DATETIME:
  481. begin
  482. Result := SizeOf(TDateTime);
  483. if Src <> '' then
  484. VD := InternalStrToDateTime(Src)
  485. else
  486. VD := 0;
  487. Move(VD, Dest^, Result);
  488. end;
  489. FIELD_TYPE_DATE:
  490. begin
  491. Result := SizeOf(TDateTime);
  492. if Src <> '' then
  493. VD := InternalStrToDate(Src)
  494. else
  495. VD := 0;
  496. Move(VD, Dest^, Result);
  497. end;
  498. FIELD_TYPE_TIME:
  499. begin
  500. Result := SizeOf(TDateTime);
  501. if Src <> '' then
  502. VD := InternalStrToTime(Src)
  503. else
  504. VD := 0;
  505. Move(VD, Dest^, Result);
  506. end;
  507. FIELD_TYPE_VAR_STRING, FIELD_TYPE_STRING, FIELD_TYPE_ENUM, FIELD_TYPE_SET:
  508. begin
  509. Result := ASize;
  510. { Write('Moving string of size ',asize,' : ');
  511. P:=Source;
  512. If (P<>nil) then
  513. While P[0]<>#0 do
  514. begin
  515. Write(p[0]);
  516. inc(p);
  517. end;
  518. Writeln;
  519. } if Src<> '' then
  520. Move(Source^, Dest^, Result)
  521. else
  522. Dest^ := #0;
  523. end;
  524. end;
  525. end;
  526. procedure TConnectionName.UpdateIndexDefs(var IndexDefs : TIndexDefs;TableName : string);
  527. var qry : TSQLQuery;
  528. begin
  529. if not assigned(Transaction) then
  530. DatabaseError(SErrConnTransactionnSet);
  531. qry := tsqlquery.Create(nil);
  532. qry.transaction := Transaction;
  533. qry.database := Self;
  534. with qry do
  535. begin
  536. ReadOnly := True;
  537. sql.clear;
  538. sql.add('show index from ' + TableName);
  539. open;
  540. end;
  541. while not qry.eof do with IndexDefs.AddIndexDef do
  542. begin
  543. Name := trim(qry.fieldbyname('Key_name').asstring);
  544. Fields := trim(qry.fieldbyname('Column_name').asstring);
  545. If Name = 'PRIMARY' then options := options + [ixPrimary];
  546. If qry.fieldbyname('Non_unique').asinteger = 0 then options := options + [ixUnique];
  547. qry.next;
  548. { while (name = qry.fields[0].asstring) and (not qry.eof) do
  549. begin
  550. Fields := Fields + ';' + trim(qry.Fields[2].asstring);
  551. qry.next;
  552. end;}
  553. end;
  554. qry.close;
  555. qry.free;
  556. end;
  557. function TConnectionName.GetTransactionHandle(trans: TSQLHandle): pointer;
  558. begin
  559. Result:=Nil;
  560. end;
  561. function TConnectionName.Commit(trans: TSQLHandle): boolean;
  562. begin
  563. // Do nothing.
  564. end;
  565. function TConnectionName.RollBack(trans: TSQLHandle): boolean;
  566. begin
  567. // Do nothing
  568. end;
  569. function TConnectionName.StartdbTransaction(trans: TSQLHandle; AParams : string): boolean;
  570. begin
  571. // Do nothing
  572. end;
  573. procedure TConnectionName.CommitRetaining(trans: TSQLHandle);
  574. begin
  575. // Do nothing
  576. end;
  577. procedure TConnectionName.RollBackRetaining(trans: TSQLHandle);
  578. begin
  579. // Do nothing
  580. end;
  581. end.