|
@@ -56,6 +56,9 @@ const
|
|
|
|
|
|
{ TSQLConnection }
|
|
{ TSQLConnection }
|
|
type
|
|
type
|
|
|
|
+
|
|
|
|
+ { TSQLConnection }
|
|
|
|
+
|
|
TSQLConnection = class (TDatabase)
|
|
TSQLConnection = class (TDatabase)
|
|
private
|
|
private
|
|
FPassword : string;
|
|
FPassword : string;
|
|
@@ -101,6 +104,8 @@ type
|
|
property Handle: Pointer read GetHandle;
|
|
property Handle: Pointer read GetHandle;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
property ConnOptions: TConnOptions read FConnOptions;
|
|
property ConnOptions: TConnOptions read FConnOptions;
|
|
|
|
+ procedure ExecuteDirect(SQL : String); overload; virtual;
|
|
|
|
+ procedure ExecuteDirect(SQL : String; Transaction : TSQLTransaction); overload; virtual;
|
|
published
|
|
published
|
|
property Password : string read FPassword write FPassword;
|
|
property Password : string read FPassword write FPassword;
|
|
property Transaction : TSQLTransaction read FTransaction write SetTransaction;
|
|
property Transaction : TSQLTransaction read FTransaction write SetTransaction;
|
|
@@ -299,6 +304,41 @@ begin
|
|
inherited Destroy;
|
|
inherited Destroy;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+Procedure TSQLConnection.ExecuteDirect(SQL: String);
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ ExecuteDirect(SQL,FTransaction);
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+Procedure TSQLConnection.ExecuteDirect(SQL: String; Transaction : TSQLTransaction);
|
|
|
|
+
|
|
|
|
+var Cursor : TSQLCursor;
|
|
|
|
+
|
|
|
|
+begin
|
|
|
|
+ if not assigned(Transaction) then
|
|
|
|
+ DatabaseError(SErrTransactionnSet);
|
|
|
|
+
|
|
|
|
+ if not Connected then Open;
|
|
|
|
+ if not Transaction.Active then Transaction.StartTransaction;
|
|
|
|
+
|
|
|
|
+ try
|
|
|
|
+ Cursor := AllocateCursorHandle;
|
|
|
|
+
|
|
|
|
+ SQL := TrimRight(SQL);
|
|
|
|
+
|
|
|
|
+ if SQL = '' then
|
|
|
|
+ DatabaseError(SErrNoStatement);
|
|
|
|
+
|
|
|
|
+ Cursor.FStatementType := stNone;
|
|
|
|
+
|
|
|
|
+ PrepareStatement(cursor,Transaction,SQL,Nil);
|
|
|
|
+ execute(cursor,Transaction, Nil);
|
|
|
|
+ CloseStatement(Cursor);
|
|
|
|
+ finally;
|
|
|
|
+ DeAllocateCursorHandle(Cursor);
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
function TSQLConnection.GetAsSQLText(Field : TField) : string;
|
|
function TSQLConnection.GetAsSQLText(Field : TField) : string;
|
|
|
|
|
|
begin
|
|
begin
|