mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 03:39:33 +02:00
- Updated for changes in sqldb.pp
This commit is contained in:
parent
f15478c0ca
commit
6497e8a7ea
@ -19,7 +19,7 @@ Type
|
|||||||
protected
|
protected
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TMySQLCursor = Class(TSQLHandle)
|
TMySQLCursor = Class(TSQLCursor)
|
||||||
protected
|
protected
|
||||||
FQMySQL : PMySQL;
|
FQMySQL : PMySQL;
|
||||||
FRes: PMYSQL_RES; { Record pointer }
|
FRes: PMYSQL_RES; { Record pointer }
|
||||||
@ -50,16 +50,16 @@ Type
|
|||||||
procedure DoInternalDisconnect; override;
|
procedure DoInternalDisconnect; override;
|
||||||
function GetHandle : pointer; override;
|
function GetHandle : pointer; override;
|
||||||
|
|
||||||
Function AllocateCursorHandle : TSQLHandle; override;
|
Function AllocateCursorHandle : TSQLCursor; override;
|
||||||
Function AllocateTransactionHandle : TSQLHandle; override;
|
Function AllocateTransactionHandle : TSQLHandle; override;
|
||||||
|
|
||||||
procedure FreeStatement(cursor : TSQLHandle); override;
|
procedure CloseStatement(cursor : TSQLCursor); override;
|
||||||
procedure PrepareStatement(cursor: TSQLHandle;ATransaction : TSQLTransaction;buf : string); override;
|
procedure PrepareStatement(cursor: TSQLCursor;ATransaction : TSQLTransaction;buf : string; AParams : TParams); override;
|
||||||
procedure FreeFldBuffers(cursor : TSQLHandle); override;
|
procedure FreeFldBuffers(cursor : TSQLCursor); override;
|
||||||
procedure Execute(cursor: TSQLHandle;atransaction:tSQLtransaction); override;
|
procedure Execute(cursor: TSQLCursor;atransaction:tSQLtransaction;AParams : TParams); override;
|
||||||
procedure AddFieldDefs(cursor: TSQLHandle; FieldDefs : TfieldDefs); override;
|
procedure AddFieldDefs(cursor: TSQLCursor; FieldDefs : TfieldDefs); override;
|
||||||
function Fetch(cursor : TSQLHandle) : boolean; override;
|
function Fetch(cursor : TSQLCursor) : boolean; override;
|
||||||
function LoadField(cursor : TSQLHandle;FieldDef : TfieldDef;buffer : pointer) : boolean; override;
|
function LoadField(cursor : TSQLCursor;FieldDef : TfieldDef;buffer : pointer) : boolean; override;
|
||||||
function GetTransactionHandle(trans : TSQLHandle): pointer; override;
|
function GetTransactionHandle(trans : TSQLHandle): pointer; override;
|
||||||
function Commit(trans : TSQLHandle) : boolean; override;
|
function Commit(trans : TSQLHandle) : boolean; override;
|
||||||
function RollBack(trans : TSQLHandle) : boolean; override;
|
function RollBack(trans : TSQLHandle) : boolean; override;
|
||||||
@ -203,7 +203,7 @@ begin
|
|||||||
Result:=FMySQL;
|
Result:=FMySQL;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMySQLConnection.AllocateCursorHandle: TSQLHandle;
|
function TMySQLConnection.AllocateCursorHandle: TSQLCursor;
|
||||||
begin
|
begin
|
||||||
Result:=TMySQLCursor.Create;
|
Result:=TMySQLCursor.Create;
|
||||||
end;
|
end;
|
||||||
@ -213,14 +213,14 @@ begin
|
|||||||
Result:=TMySQLTransaction.Create;
|
Result:=TMySQLTransaction.Create;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMySQLConnection.FreeStatement(cursor: TSQLHandle);
|
procedure TMySQLConnection.CloseStatement(cursor: TSQLCursor);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
C : TMySQLCursor;
|
C : TMySQLCursor;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
C:=Cursor as TMysqlCursor;
|
C:=Cursor as TMysqlCursor;
|
||||||
if c.StatementType=stSelect then
|
if c.FStatementType=stSelect then
|
||||||
c.FNeedData:=False;
|
c.FNeedData:=False;
|
||||||
If (C.FRes<>Nil) then
|
If (C.FRes<>Nil) then
|
||||||
begin
|
begin
|
||||||
@ -233,13 +233,15 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMySQLConnection.PrepareStatement(cursor: TSQLHandle;
|
procedure TMySQLConnection.PrepareStatement(cursor: TSQLCursor;
|
||||||
ATransaction: TSQLTransaction; buf: string);
|
ATransaction: TSQLTransaction; buf: string;AParams : TParams);
|
||||||
begin
|
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 TMysqlCursor do
|
||||||
begin
|
begin
|
||||||
FStatement:=Buf;
|
FStatement:=Buf;
|
||||||
if StatementType=stSelect then
|
if FStatementType=stSelect then
|
||||||
FNeedData:=True;
|
FNeedData:=True;
|
||||||
ConnectMySQL(FQMySQL,FMySQL^.host,FMySQL^.user,FMySQL^.passwd);
|
ConnectMySQL(FQMySQL,FMySQL^.host,FMySQL^.user,FMySQL^.passwd);
|
||||||
if mysql_select_db(FQMySQL,pchar(DatabaseName))<>0 then
|
if mysql_select_db(FQMySQL,pchar(DatabaseName))<>0 then
|
||||||
@ -247,7 +249,7 @@ begin
|
|||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMySQLConnection.FreeFldBuffers(cursor: TSQLHandle);
|
procedure TMySQLConnection.FreeFldBuffers(cursor: TSQLCursor);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
C : TMySQLCursor;
|
C : TMySQLCursor;
|
||||||
@ -261,8 +263,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMySQLConnection.Execute(cursor: TSQLHandle;
|
procedure TMySQLConnection.Execute(cursor: TSQLCursor;
|
||||||
atransaction: tSQLtransaction);
|
atransaction: tSQLtransaction;AParams : TParams);
|
||||||
|
|
||||||
Var
|
Var
|
||||||
C : TMySQLCursor;
|
C : TMySQLCursor;
|
||||||
@ -324,7 +326,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMySQLConnection.AddFieldDefs(cursor: TSQLHandle;
|
procedure TMySQLConnection.AddFieldDefs(cursor: TSQLCursor;
|
||||||
FieldDefs: TfieldDefs);
|
FieldDefs: TfieldDefs);
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -355,7 +357,7 @@ begin
|
|||||||
// Writeln('MySQL: Finished adding fielddefs');
|
// Writeln('MySQL: Finished adding fielddefs');
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMySQLConnection.Fetch(cursor: TSQLHandle): boolean;
|
function TMySQLConnection.Fetch(cursor: TSQLCursor): boolean;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
C : TMySQLCursor;
|
C : TMySQLCursor;
|
||||||
@ -366,7 +368,7 @@ begin
|
|||||||
Result:=(C.Row<>Nil);
|
Result:=(C.Row<>Nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TMySQLConnection.LoadField(cursor : TSQLHandle;
|
function TMySQLConnection.LoadField(cursor : TSQLCursor;
|
||||||
FieldDef : TfieldDef;buffer : pointer) : boolean;
|
FieldDef : TfieldDef;buffer : pointer) : boolean;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
Loading…
Reference in New Issue
Block a user