|
@@ -1,3 +1,12 @@
|
|
|
|
+{$IFDEF MYSQL56_UP}
|
|
|
|
+ {$DEFINE MYSQL55_UP}
|
|
|
|
+{$ENDIF}
|
|
|
|
+{$IFDEF MYSQL55_UP}
|
|
|
|
+ {$DEFINE MYSQL51_UP}
|
|
|
|
+{$ENDIF}
|
|
|
|
+{$IFDEF MYSQL51_UP}
|
|
|
|
+ {$DEFINE MYSQL50_UP}
|
|
|
|
+{$ENDIF}
|
|
|
|
|
|
{$mode objfpc}{$H+}
|
|
{$mode objfpc}{$H+}
|
|
|
|
|
|
@@ -5,9 +14,12 @@ interface
|
|
|
|
|
|
uses
|
|
uses
|
|
Classes, SysUtils,bufdataset,sqldb,db,ctypes,
|
|
Classes, SysUtils,bufdataset,sqldb,db,ctypes,
|
|
- {$IFDEF mysql55}
|
|
|
|
|
|
+{$IFDEF mysql56}
|
|
|
|
+ mysql56dyn;
|
|
|
|
+{$ELSE}
|
|
|
|
+{$IFDEF mysql55}
|
|
mysql55dyn;
|
|
mysql55dyn;
|
|
- {$ELSE}
|
|
|
|
|
|
+{$ELSE}
|
|
{$IFDEF mysql51}
|
|
{$IFDEF mysql51}
|
|
mysql51dyn;
|
|
mysql51dyn;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
@@ -17,38 +29,37 @@ uses
|
|
{$IfDef mysql41}
|
|
{$IfDef mysql41}
|
|
mysql41dyn;
|
|
mysql41dyn;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- mysql40dyn;
|
|
|
|
- {$ELSE}
|
|
|
|
- mysql40dyn;
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ mysql40dyn;
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$ENDIF}
|
|
|
|
|
|
Const
|
|
Const
|
|
|
|
+ MySQLVersion =
|
|
|
|
+{$IFDEF mysql56}
|
|
|
|
+ '5.6';
|
|
|
|
+{$ELSE}
|
|
{$IFDEF mysql55}
|
|
{$IFDEF mysql55}
|
|
- MySQLVersion = '5.5';
|
|
|
|
-{$else}
|
|
|
|
|
|
+ '5.5';
|
|
|
|
+{$ELSE}
|
|
{$IFDEF mysql51}
|
|
{$IFDEF mysql51}
|
|
- MySQLVersion = '5.1';
|
|
|
|
|
|
+ '5.1';
|
|
{$else}
|
|
{$else}
|
|
{$IfDef mysql50}
|
|
{$IfDef mysql50}
|
|
- MySQLVersion = '5.0';
|
|
|
|
|
|
+ '5.0';
|
|
{$ELSE}
|
|
{$ELSE}
|
|
{$IfDef mysql41}
|
|
{$IfDef mysql41}
|
|
- MySQLVersion = '4.1';
|
|
|
|
|
|
+ '4.1';
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- MySQLVersion = '4.0';
|
|
|
|
- {$ELSE}
|
|
|
|
- MySQLVersion = '4.0';
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ '4.0';
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$ENDIF}
|
|
|
|
+
|
|
Type
|
|
Type
|
|
TTransactionName = Class(TSQLHandle)
|
|
TTransactionName = Class(TSQLHandle)
|
|
protected
|
|
protected
|
|
@@ -152,6 +163,12 @@ Type
|
|
|
|
|
|
|
|
|
|
EMySQLError = Class(Exception);
|
|
EMySQLError = Class(Exception);
|
|
|
|
+ {$IFDEF mysql56}
|
|
|
|
+ TMySQL56Connection = Class(TConnectionName);
|
|
|
|
+ TMySQL56ConnectionDef = Class(TMySQLConnectionDef);
|
|
|
|
+ TMySQL56Transaction = Class(TTransactionName);
|
|
|
|
+ TMySQL56Cursor = Class(TCursorName);
|
|
|
|
+ {$ELSE}
|
|
{$ifdef mysql55}
|
|
{$ifdef mysql55}
|
|
TMySQL55Connection = Class(TConnectionName);
|
|
TMySQL55Connection = Class(TConnectionName);
|
|
TMySQL55ConnectionDef = Class(TMySQLConnectionDef);
|
|
TMySQL55ConnectionDef = Class(TMySQLConnectionDef);
|
|
@@ -176,21 +193,15 @@ Type
|
|
TMySQL41Transaction = Class(TTransactionName);
|
|
TMySQL41Transaction = Class(TTransactionName);
|
|
TMySQL41Cursor = Class(TCursorName);
|
|
TMySQL41Cursor = Class(TCursorName);
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- TMySQLConnection = Class(TConnectionName);
|
|
|
|
- TMySQL40ConnectionDef = Class(TMySQLConnectionDef);
|
|
|
|
- TMySQLTransaction = Class(TTransactionName);
|
|
|
|
- TMySQLCursor = Class(TCursorName);
|
|
|
|
- {$ELSE}
|
|
|
|
- TMySQL40Connection = Class(TConnectionName);
|
|
|
|
- TMySQL40ConnectionDef = Class(TMySQLConnectionDef);
|
|
|
|
- TMySQL40Transaction = Class(TTransactionName);
|
|
|
|
- TMySQL40Cursor = Class(TCursorName);
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ TMySQL40Connection = Class(TConnectionName);
|
|
|
|
+ TMySQL40ConnectionDef = Class(TMySQLConnectionDef);
|
|
|
|
+ TMySQL40Transaction = Class(TTransactionName);
|
|
|
|
+ TMySQL40Cursor = Class(TCursorName);
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$endif}
|
|
{$endif}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
|
|
+ {$ENDIF}
|
|
|
|
|
|
implementation
|
|
implementation
|
|
|
|
|
|
@@ -214,9 +225,17 @@ const
|
|
{$IFDEF MYSQL50_UP}
|
|
{$IFDEF MYSQL50_UP}
|
|
,'MYSQL_REPORT_DATA_TRUNCATION', 'MYSQL_OPT_RECONNECT'
|
|
,'MYSQL_REPORT_DATA_TRUNCATION', 'MYSQL_OPT_RECONNECT'
|
|
{$IFDEF mysql51_UP}
|
|
{$IFDEF mysql51_UP}
|
|
- ,'MYSQL_OPT_SSL_VERIFY_SERVER_CERT'
|
|
|
|
-{$IFDEF mysql55}
|
|
|
|
- ,'MYSQL_PLUGIN_DIR', 'MYSQL_DEFAULT_AUTH'
|
|
|
|
|
|
+ ,'MYSQL_OPT_SSL_VERIFY_SERVER_CERT'
|
|
|
|
+{$IFDEF mysql55_UP}
|
|
|
|
+ ,'MYSQL_PLUGIN_DIR', 'MYSQL_DEFAULT_AUTH'
|
|
|
|
+{$IFDEF MYSQL56_UP}
|
|
|
|
+ ,'MYSQL_OPT_BIND'
|
|
|
|
+ ,'MYSQL_OPT_SSL_KEY', 'MYSQL_OPT_SSL_CERT', 'MYSQL_OPT_SSL_CA', 'MYSQL_OPT_SSL_CAPATH', 'MYSQL_OPT_SSL_CIPHER', 'MYSQL_OPT_SSL_CRL', 'MYSQL_OPT_SSL_CRLPATH'
|
|
|
|
+ ,'MYSQL_OPT_CONNECT_ATTR_RESET', 'MYSQL_OPT_CONNECT_ATTR_ADD', 'MYSQL_OPT_CONNECT_ATTR_DELETE'
|
|
|
|
+ ,'MYSQL_SERVER_PUBLIC_KEY'
|
|
|
|
+ ,'MYSQL_ENABLE_CLEARTEXT_PLUGIN'
|
|
|
|
+ ,'MYSQL_OPT_CAN_HANDLE_EXPIRED_PASSWORDS'
|
|
|
|
+{$ENDIF}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
@@ -469,6 +488,9 @@ end;
|
|
|
|
|
|
function TConnectionName.AllocateCursorHandle: TSQLCursor;
|
|
function TConnectionName.AllocateCursorHandle: TSQLCursor;
|
|
begin
|
|
begin
|
|
|
|
+ {$IFDEF mysql56}
|
|
|
|
+ Result:=TMySQL56Cursor.Create;
|
|
|
|
+ {$ELSE}
|
|
{$IfDef mysql55}
|
|
{$IfDef mysql55}
|
|
Result:=TMySQL55Cursor.Create;
|
|
Result:=TMySQL55Cursor.Create;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
@@ -481,15 +503,12 @@ begin
|
|
{$IfDef mysql41}
|
|
{$IfDef mysql41}
|
|
Result:=TMySQL41Cursor.Create;
|
|
Result:=TMySQL41Cursor.Create;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- Result:=TMySQLCursor.Create;
|
|
|
|
- {$ELSE}
|
|
|
|
- Result:=TMySQL40Cursor.Create;
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ Result:=TMySQL40Cursor.Create;
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
- {$endif}
|
|
|
|
|
|
+ {$EndIf}
|
|
|
|
+ {$ENDIF}
|
|
end;
|
|
end;
|
|
|
|
|
|
Procedure TConnectionName.DeAllocateCursorHandle(var cursor : TSQLCursor);
|
|
Procedure TConnectionName.DeAllocateCursorHandle(var cursor : TSQLCursor);
|
|
@@ -1216,6 +1235,9 @@ end;
|
|
|
|
|
|
class function TMySQLConnectionDef.ConnectionClass: TSQLConnectionClass;
|
|
class function TMySQLConnectionDef.ConnectionClass: TSQLConnectionClass;
|
|
begin
|
|
begin
|
|
|
|
+ {$IFDEF mysql56}
|
|
|
|
+ Result:=TMySQL56Connection;
|
|
|
|
+ {$ELSE}
|
|
{$IfDef mysql55}
|
|
{$IfDef mysql55}
|
|
Result:=TMySQL55Connection;
|
|
Result:=TMySQL55Connection;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
@@ -1228,15 +1250,12 @@ begin
|
|
{$IfDef mysql41}
|
|
{$IfDef mysql41}
|
|
Result:=TMySQL41Connection;
|
|
Result:=TMySQL41Connection;
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- Result:=TMySQLConnection;
|
|
|
|
- {$ELSE}
|
|
|
|
- Result:=TMySQL40Connection;
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ Result:=TMySQL40Connection;
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+ {$ENDIF}
|
|
end;
|
|
end;
|
|
|
|
|
|
class function TMySQLConnectionDef.Description: String;
|
|
class function TMySQLConnectionDef.Description: String;
|
|
@@ -1264,6 +1283,12 @@ begin
|
|
Result:=MysqlLoadedLibrary;
|
|
Result:=MysqlLoadedLibrary;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{$IFDEF mysql56}
|
|
|
|
+ initialization
|
|
|
|
+ RegisterConnection(TMySQL56ConnectionDef);
|
|
|
|
+ finalization
|
|
|
|
+ UnRegisterConnection(TMySQL56ConnectionDef);
|
|
|
|
+{$ELSE}
|
|
{$IfDef mysql55}
|
|
{$IfDef mysql55}
|
|
initialization
|
|
initialization
|
|
RegisterConnection(TMySQL55ConnectionDef);
|
|
RegisterConnection(TMySQL55ConnectionDef);
|
|
@@ -1288,20 +1313,14 @@ end;
|
|
finalization
|
|
finalization
|
|
UnRegisterConnection(TMySQL41ConnectionDef);
|
|
UnRegisterConnection(TMySQL41ConnectionDef);
|
|
{$ELSE}
|
|
{$ELSE}
|
|
- {$IFDEF mysql4} // temporary backwards compatibility for Lazarus
|
|
|
|
- initialization
|
|
|
|
- RegisterConnection(TMySQL40ConnectionDef);
|
|
|
|
- finalization
|
|
|
|
- UnRegisterConnection(TMySQL40ConnectionDef);
|
|
|
|
- {$ELSE}
|
|
|
|
- initialization
|
|
|
|
- RegisterConnection(TMySQL40ConnectionDef);
|
|
|
|
- finalization
|
|
|
|
- UnRegisterConnection(TMySQL40ConnectionDef);
|
|
|
|
- {$EndIf}
|
|
|
|
|
|
+ initialization
|
|
|
|
+ RegisterConnection(TMySQL40ConnectionDef);
|
|
|
|
+ finalization
|
|
|
|
+ UnRegisterConnection(TMySQL40ConnectionDef);
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$EndIf}
|
|
{$ENDIF}
|
|
{$ENDIF}
|
|
{$endif}
|
|
{$endif}
|
|
|
|
+{$ENDIF}
|
|
|
|
|
|
end.
|
|
end.
|