mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-15 12:29:32 +02:00
+ added SQLDB support for MySQL v4.0 and v4.1
git-svn-id: trunk@1781 -
This commit is contained in:
parent
b805e52e7e
commit
9b5cf2eeab
2
.gitattributes
vendored
2
.gitattributes
vendored
@ -716,7 +716,7 @@ fcl/db/sqldb/mysql/Makefile svneol=native#text/plain
|
||||
fcl/db/sqldb/mysql/Makefile.fpc svneol=native#text/plain
|
||||
fcl/db/sqldb/mysql/fpmake.inc svneol=native#text/plain
|
||||
fcl/db/sqldb/mysql/fpmake.pp svneol=native#text/plain
|
||||
fcl/db/sqldb/mysql/mysql4conn.pas svneol=native#text/plain
|
||||
fcl/db/sqldb/mysql/mysqlconn.inc svneol=native#text/plain
|
||||
fcl/db/sqldb/odbc/Makefile svneol=native#text/plain
|
||||
fcl/db/sqldb/odbc/Makefile.fpc svneol=native#text/plain
|
||||
fcl/db/sqldb/odbc/odbcconn.pas svneol=native#text/plain
|
||||
|
@ -15,7 +15,7 @@ program aListTables;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection, ODBCConn,
|
||||
sqldb, pqconnection, mysql40conn, mysql41conn, IBConnection, ODBCConn,
|
||||
SqldbExampleUnit;
|
||||
|
||||
var Tables : TStringList;
|
||||
@ -25,7 +25,8 @@ begin
|
||||
ReadIniFile;
|
||||
|
||||
// create FConnection
|
||||
if dbtype = 'mysql' then Fconnection := tMySQLConnection.Create(nil);
|
||||
if dbtype = 'mysql40' then Fconnection := tMySQL40Connection.Create(nil);
|
||||
if dbtype = 'mysql41' then Fconnection := tMySQL41Connection.Create(nil);
|
||||
if dbtype = 'postgresql' then Fconnection := tpqConnection.Create(nil);
|
||||
if dbtype = 'interbase' then Fconnection := tIBConnection.Create(nil);
|
||||
if dbtype = 'odbc' then Fconnection := tODBCConnection.Create(nil);
|
||||
|
@ -15,7 +15,7 @@ program bCreateTable;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
sqldb,
|
||||
SqldbExampleUnit;
|
||||
|
||||
begin
|
||||
|
@ -15,7 +15,7 @@ program CFillTable;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
sqldb,
|
||||
SqldbExampleUnit;
|
||||
|
||||
begin
|
||||
|
@ -3,7 +3,9 @@
|
||||
# type
|
||||
# gives the type of the database-engine. Valid values are:
|
||||
# * interbase
|
||||
# * mysql
|
||||
# * mysql40
|
||||
# * mysql41
|
||||
# * odbc
|
||||
# * postgresql
|
||||
|
||||
type=interbase
|
||||
|
@ -15,8 +15,7 @@ program dShowTable;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
SqldbExampleUnit;
|
||||
sqldb, SqldbExampleUnit;
|
||||
|
||||
begin
|
||||
ReadIniFile;
|
||||
@ -31,7 +30,7 @@ begin
|
||||
ReadOnly := True;
|
||||
|
||||
SQL.Clear;
|
||||
SQL.Add('select * from fpdev');
|
||||
SQL.Add('select * from FPDEV');
|
||||
|
||||
Writeln('Id;Name;Email;birthdate');
|
||||
|
||||
|
@ -15,7 +15,7 @@ program eFillTableParams;
|
||||
|
||||
uses
|
||||
Classes, sysutils,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
sqldb,
|
||||
SqldbExampleUnit;
|
||||
|
||||
var i : integer;
|
||||
|
@ -15,7 +15,7 @@ program fEditTable;
|
||||
|
||||
uses
|
||||
Classes, sysutils,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
sqldb,
|
||||
SqldbExampleUnit;
|
||||
|
||||
|
||||
|
@ -15,7 +15,7 @@ program gFilterTable;
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection,
|
||||
sqldb,
|
||||
SqldbExampleUnit;
|
||||
|
||||
begin
|
||||
|
@ -16,7 +16,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes,
|
||||
sqldb, pqconnection, mysql4conn, IBConnection, ODBCConn;
|
||||
sqldb, pqconnection, IBConnection, ODBCConn,
|
||||
mysql40conn, mysql41conn;
|
||||
|
||||
var dbtype,
|
||||
dbname,
|
||||
@ -79,7 +80,8 @@ end;
|
||||
procedure CreateFConnection;
|
||||
|
||||
begin
|
||||
if dbtype = 'mysql' then Fconnection := tMySQLConnection.Create(nil);
|
||||
if dbtype = 'mysql40' then Fconnection := tMySQL40Connection.Create(nil);
|
||||
if dbtype = 'mysql41' then Fconnection := tMySQL41Connection.Create(nil);
|
||||
if dbtype = 'postgresql' then Fconnection := tpqConnection.Create(nil);
|
||||
if dbtype = 'interbase' then Fconnection := tIBConnection.Create(nil);
|
||||
if dbtype = 'odbc' then Fconnection := tODBCConnection.Create(nil);
|
||||
|
@ -1,5 +1,5 @@
|
||||
#
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/10/20]
|
||||
# Don't edit, this file is generated by FPCMake Version 2.0.0 [2005/11/12]
|
||||
#
|
||||
default: all
|
||||
MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-emx i386-watcom i386-netwlibc i386-wince m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos powerpc-linux powerpc-netbsd powerpc-macos powerpc-darwin powerpc-morphos sparc-linux sparc-netbsd sparc-solaris x86_64-linux x86_64-freebsd x86_64-win64 arm-linux arm-wince powerpc64-linux
|
||||
@ -233,115 +233,115 @@ PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages/base $(FPCDIR)/packages/ext
|
||||
override PACKAGE_NAME=fcl
|
||||
PACKAGEDIR_MAIN:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl/Makefile.fpc,$(PACKAGESDIR))))))
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-go32v2)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-win32)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-os2)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-freebsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-beos)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-netbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-solaris)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-qnx)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-netware)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-openbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-wdosx)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-emx)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-watcom)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-netwlibc)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),i386-wince)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-freebsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-netbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-amiga)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-atari)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-openbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),m68k-palmos)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-netbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-macos)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-darwin)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc-morphos)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-netbsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),sparc-solaris)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-freebsd)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),x86_64-win64)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),arm-wince)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
ifeq ($(FULL_TARGET),powerpc64-linux)
|
||||
override TARGET_UNITS+=mysql4conn
|
||||
override TARGET_UNITS+=mysql40conn mysql41conn
|
||||
endif
|
||||
override INSTALL_FPCPACKAGE=y
|
||||
ifeq ($(FULL_TARGET),i386-linux)
|
||||
|
@ -6,7 +6,7 @@
|
||||
main=fcl
|
||||
|
||||
[target]
|
||||
units=mysql4conn
|
||||
units=mysql40conn mysql41conn
|
||||
|
||||
[require]
|
||||
packages=mysql
|
||||
|
@ -1,36 +1,40 @@
|
||||
unit mysql4conn;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
{$Define LinkDynamically}
|
||||
{$MACRO on}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils,sqldb,db,
|
||||
{$IfDef LinkDynamically}
|
||||
mysql4dyn,mysql4_comdyn;
|
||||
{$IfNDef mysql41}
|
||||
mysql40dyn;
|
||||
{$DEFINE TConnectionName:=TMySQL40Connection}
|
||||
{$DEFINE TTransactionName:=TMySQL40Transaction}
|
||||
{$DEFINE TCursorName:=TMySQL40Cursor}
|
||||
{$Else}
|
||||
mysql4,mysql4_com;
|
||||
mysql41dyn;
|
||||
{$DEFINE TConnectionName:=TMySQL41Connection}
|
||||
{$DEFINE TTransactionName:=TMySQL41Transaction}
|
||||
{$DEFINE TCursorName:=TMySQL41Cursor}
|
||||
{$EndIf}
|
||||
|
||||
Type
|
||||
TMySQLTransaction = Class(TSQLHandle)
|
||||
TTransactionName = Class(TSQLHandle)
|
||||
protected
|
||||
end;
|
||||
|
||||
TMySQLCursor = Class(TSQLCursor)
|
||||
TCursorName = Class(TSQLCursor)
|
||||
protected
|
||||
FQMySQL : PMySQL;
|
||||
FRes: PMYSQL_RES; { Record pointer }
|
||||
FNeedData : Boolean;
|
||||
FStatement : String;
|
||||
Row : TMYSQL_ROW;
|
||||
Row : MYSQL_ROW;
|
||||
RowsAffected : QWord;
|
||||
LastInsertID : QWord;
|
||||
end;
|
||||
|
||||
TMySQLConnection = class (TSQLConnection)
|
||||
TConnectionName = class (TSQLConnection)
|
||||
private
|
||||
FDialect: integer;
|
||||
FHostInfo: String;
|
||||
@ -90,7 +94,7 @@ implementation
|
||||
|
||||
uses dbconst;
|
||||
|
||||
{ TMySQLConnection }
|
||||
{ TConnectionName }
|
||||
|
||||
Resourcestring
|
||||
SErrServerConnectFailed = 'Server connect failed.';
|
||||
@ -102,6 +106,8 @@ Resourcestring
|
||||
SErrFetchingdata = 'Error fetching row data: %s';
|
||||
SErrGettingResult = 'Error getting result set: %s';
|
||||
SErrNoQueryResult = 'No result from query.';
|
||||
SErrNotversion41 = 'TMySQL41Connection can not work with the installed MySQL client version (%s).';
|
||||
SErrNotversion40 = 'TMySQL40Connection can not work with the installed MySQL client version (%s).';
|
||||
|
||||
Procedure MySQlError(R : PMySQL;Msg: String;Comp : TComponent);
|
||||
|
||||
@ -118,7 +124,7 @@ begin
|
||||
DatabaseError(Msg,Comp);
|
||||
end;
|
||||
|
||||
function TMySQLConnection.StrToStatementType(s : string) : TStatementType;
|
||||
function TConnectionName.StrToStatementType(s : string) : TStatementType;
|
||||
|
||||
begin
|
||||
S:=Lowercase(s);
|
||||
@ -127,27 +133,22 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TMySQLConnection.GetClientInfo: string;
|
||||
function TConnectionName.GetClientInfo: string;
|
||||
|
||||
begin
|
||||
{$IfDef LinkDynamically}
|
||||
// To make it possible to call this if there's no connection yet
|
||||
InitialiseMysql4;
|
||||
{$EndIf}
|
||||
Result:=strpas(mysql_get_client_info());
|
||||
{$IfDef LinkDynamically}
|
||||
ReleaseMysql4;
|
||||
{$EndIf}
|
||||
|
||||
end;
|
||||
|
||||
function TMySQLConnection.GetServerStatus: String;
|
||||
function TConnectionName.GetServerStatus: String;
|
||||
begin
|
||||
CheckConnected;
|
||||
Result := mysql_stat(FMYSQL);
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
|
||||
procedure TConnectionName.ConnectMySQL(var HMySQL : PMySQL;H,U,P : pchar);
|
||||
|
||||
begin
|
||||
HMySQL := mysql_init(HMySQL);
|
||||
@ -156,7 +157,7 @@ begin
|
||||
MySQlError(Nil,SErrServerConnectFailed,Self);
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.ConnectToServer;
|
||||
procedure TConnectionName.ConnectToServer;
|
||||
|
||||
Var
|
||||
H,U,P : String;
|
||||
@ -170,61 +171,63 @@ begin
|
||||
FHostInfo := strpas(mysql_get_host_info(FMYSQL));
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.SelectDatabase;
|
||||
procedure TConnectionName.SelectDatabase;
|
||||
begin
|
||||
if mysql_select_db(FMySQL,pchar(DatabaseName))<>0 then
|
||||
MySQLError(FMySQL,SErrDatabaseSelectFailed,Self);
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.DoInternalConnect;
|
||||
procedure TConnectionName.DoInternalConnect;
|
||||
begin
|
||||
{$IfDef LinkDynamically}
|
||||
InitialiseMysql4;
|
||||
{$EndIf}
|
||||
{$IFDEF mysql41}
|
||||
if copy(strpas(mysql_get_client_info()),1,3)<>'4.1' then
|
||||
Raise EInOutError.CreateFmt(SErrNotversion41,[strpas(mysql_get_client_info())]);
|
||||
{$ELSE}
|
||||
if copy(strpas(mysql_get_client_info()),1,3)<>'4.0' then
|
||||
Raise EInOutError.CreateFmt(SErrNotversion40,[strpas(mysql_get_client_info())]);
|
||||
{$ENDIF}
|
||||
inherited DoInternalConnect;
|
||||
ConnectToServer;
|
||||
SelectDatabase;
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.DoInternalDisconnect;
|
||||
procedure TConnectionName.DoInternalDisconnect;
|
||||
begin
|
||||
inherited DoInternalDisconnect;
|
||||
mysql_close(FMySQL);
|
||||
FMySQL:=Nil;
|
||||
{$IfDef LinkDynamically}
|
||||
ReleaseMysql4;
|
||||
{$EndIf}
|
||||
|
||||
end;
|
||||
|
||||
function TMySQLConnection.GetHandle: pointer;
|
||||
function TConnectionName.GetHandle: pointer;
|
||||
begin
|
||||
Result:=FMySQL;
|
||||
end;
|
||||
|
||||
function TMySQLConnection.AllocateCursorHandle: TSQLCursor;
|
||||
function TConnectionName.AllocateCursorHandle: TSQLCursor;
|
||||
begin
|
||||
Result:=TMySQLCursor.Create;
|
||||
Result:=TCursorName.Create;
|
||||
end;
|
||||
|
||||
Procedure TMySQLConnection.DeAllocateCursorHandle(var cursor : TSQLCursor);
|
||||
Procedure TConnectionName.DeAllocateCursorHandle(var cursor : TSQLCursor);
|
||||
|
||||
begin
|
||||
FreeAndNil(cursor);
|
||||
end;
|
||||
|
||||
function TMySQLConnection.AllocateTransactionHandle: TSQLHandle;
|
||||
function TConnectionName.AllocateTransactionHandle: TSQLHandle;
|
||||
begin
|
||||
// Result:=TMySQLTransaction.Create;
|
||||
// Result:=TTransactionName.Create;
|
||||
Result := nil;
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.PrepareStatement(cursor: TSQLCursor;
|
||||
procedure TConnectionName.PrepareStatement(cursor: TSQLCursor;
|
||||
ATransaction: TSQLTransaction; buf: string;AParams : TParams);
|
||||
begin
|
||||
if assigned(AParams) and (AParams.count > 0) then
|
||||
DatabaseError('Parameters (not) yet supported for the MySQL SqlDB connection.',self);
|
||||
With Cursor as TMysqlCursor do
|
||||
With Cursor as TCursorName do
|
||||
begin
|
||||
FStatement:=Buf;
|
||||
if FStatementType=stSelect then
|
||||
@ -235,18 +238,18 @@ begin
|
||||
end
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.UnPrepareStatement(cursor: TSQLCursor);
|
||||
procedure TConnectionName.UnPrepareStatement(cursor: TSQLCursor);
|
||||
begin
|
||||
// not necessary
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.FreeFldBuffers(cursor: TSQLCursor);
|
||||
procedure TConnectionName.FreeFldBuffers(cursor: TSQLCursor);
|
||||
|
||||
Var
|
||||
C : TMySQLCursor;
|
||||
C : TCursorName;
|
||||
|
||||
begin
|
||||
C:=Cursor as TMysqlCursor;
|
||||
C:=Cursor as TCursorName;
|
||||
if c.FStatementType=stSelect then
|
||||
c.FNeedData:=False;
|
||||
If (C.FRes<>Nil) then
|
||||
@ -265,14 +268,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.Execute(cursor: TSQLCursor;
|
||||
procedure TConnectionName.Execute(cursor: TSQLCursor;
|
||||
atransaction: tSQLtransaction;AParams : TParams);
|
||||
|
||||
Var
|
||||
C : TMySQLCursor;
|
||||
C : TCursorName;
|
||||
|
||||
begin
|
||||
C:=Cursor as TMysqlCursor;
|
||||
C:=Cursor as TCursorName;
|
||||
If (C.FRes=Nil) then
|
||||
begin
|
||||
if mysql_query(c.FQMySQL,Pchar(C.FStatement))<>0 then
|
||||
@ -287,7 +290,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMySQLConnection.MySQLDataType(AType: enum_field_types; ASize: Integer;
|
||||
function TConnectionName.MySQLDataType(AType: enum_field_types; ASize: Integer;
|
||||
var NewType: TFieldType; var NewSize: Integer): Boolean;
|
||||
begin
|
||||
Result := True;
|
||||
@ -328,11 +331,11 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.AddFieldDefs(cursor: TSQLCursor;
|
||||
procedure TConnectionName.AddFieldDefs(cursor: TSQLCursor;
|
||||
FieldDefs: TfieldDefs);
|
||||
|
||||
var
|
||||
C : TMySQLCursor;
|
||||
C : TCursorName;
|
||||
I, FC: Integer;
|
||||
field: PMYSQL_FIELD;
|
||||
DFT: TFieldType;
|
||||
@ -340,7 +343,7 @@ var
|
||||
|
||||
begin
|
||||
// Writeln('MySQL: Adding fielddefs');
|
||||
C:=(Cursor as TMySQLCursor);
|
||||
C:=(Cursor as TCursorName);
|
||||
If (C.FRes=Nil) then
|
||||
begin
|
||||
// Writeln('res is nil');
|
||||
@ -359,29 +362,29 @@ begin
|
||||
// Writeln('MySQL: Finished adding fielddefs');
|
||||
end;
|
||||
|
||||
function TMySQLConnection.Fetch(cursor: TSQLCursor): boolean;
|
||||
function TConnectionName.Fetch(cursor: TSQLCursor): boolean;
|
||||
|
||||
Var
|
||||
C : TMySQLCursor;
|
||||
C : TCursorName;
|
||||
|
||||
begin
|
||||
C:=Cursor as TMySQLCursor;
|
||||
C:=Cursor as TCursorName;
|
||||
C.Row:=MySQL_Fetch_row(C.FRes);
|
||||
Result:=(C.Row<>Nil);
|
||||
end;
|
||||
|
||||
function TMySQLConnection.LoadField(cursor : TSQLCursor;
|
||||
function TConnectionName.LoadField(cursor : TSQLCursor;
|
||||
FieldDef : TfieldDef;buffer : pointer) : boolean;
|
||||
|
||||
var
|
||||
I, FC, CT: Integer;
|
||||
field: PMYSQL_FIELD;
|
||||
row : TMYSQL_ROW;
|
||||
C : TMySQLCursor;
|
||||
row : MYSQL_ROW;
|
||||
C : TCursorName;
|
||||
|
||||
begin
|
||||
// Writeln('LoadFieldsFromBuffer');
|
||||
C:=Cursor as TMySQLCursor;
|
||||
C:=Cursor as TCursorName;
|
||||
if C.Row=nil then
|
||||
begin
|
||||
// Writeln('LoadFieldsFromBuffer: row=nil');
|
||||
@ -486,7 +489,7 @@ begin
|
||||
Result := Result + EncodeTime(EH, EN, ES, 0);;
|
||||
end;
|
||||
|
||||
function TMySQLConnection.MySQLWriteData(AType: enum_field_types;ASize: Integer; Source, Dest: PChar): Integer;
|
||||
function TConnectionName.MySQLWriteData(AType: enum_field_types;ASize: Integer; Source, Dest: PChar): Integer;
|
||||
|
||||
var
|
||||
VI: Integer;
|
||||
@ -576,7 +579,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.UpdateIndexDefs(var IndexDefs : TIndexDefs;TableName : string);
|
||||
procedure TConnectionName.UpdateIndexDefs(var IndexDefs : TIndexDefs;TableName : string);
|
||||
|
||||
var qry : TSQLQuery;
|
||||
|
||||
@ -613,32 +616,32 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
function TMySQLConnection.GetTransactionHandle(trans: TSQLHandle): pointer;
|
||||
function TConnectionName.GetTransactionHandle(trans: TSQLHandle): pointer;
|
||||
begin
|
||||
Result:=Nil;
|
||||
end;
|
||||
|
||||
function TMySQLConnection.Commit(trans: TSQLHandle): boolean;
|
||||
function TConnectionName.Commit(trans: TSQLHandle): boolean;
|
||||
begin
|
||||
// Do nothing.
|
||||
end;
|
||||
|
||||
function TMySQLConnection.RollBack(trans: TSQLHandle): boolean;
|
||||
function TConnectionName.RollBack(trans: TSQLHandle): boolean;
|
||||
begin
|
||||
// Do nothing
|
||||
end;
|
||||
|
||||
function TMySQLConnection.StartdbTransaction(trans: TSQLHandle; AParams : string): boolean;
|
||||
function TConnectionName.StartdbTransaction(trans: TSQLHandle; AParams : string): boolean;
|
||||
begin
|
||||
// Do nothing
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.CommitRetaining(trans: TSQLHandle);
|
||||
procedure TConnectionName.CommitRetaining(trans: TSQLHandle);
|
||||
begin
|
||||
// Do nothing
|
||||
end;
|
||||
|
||||
procedure TMySQLConnection.RollBackRetaining(trans: TSQLHandle);
|
||||
procedure TConnectionName.RollBackRetaining(trans: TSQLHandle);
|
||||
begin
|
||||
// Do nothing
|
||||
end;
|
Loading…
Reference in New Issue
Block a user