|
@@ -31,6 +31,7 @@ type
|
|
stDDL, stGetSegment, stPutSegment, stExecProcedure,
|
|
stDDL, stGetSegment, stPutSegment, stExecProcedure,
|
|
stStartTrans, stCommit, stRollback, stSelectForUpd);
|
|
stStartTrans, stCommit, stRollback, stSelectForUpd);
|
|
|
|
|
|
|
|
+
|
|
TRowsCount = LargeInt;
|
|
TRowsCount = LargeInt;
|
|
|
|
|
|
TSQLStatementInfo = Record
|
|
TSQLStatementInfo = Record
|
|
@@ -80,6 +81,24 @@ type
|
|
Comp : TComponent; AErrorCode: integer; ASQLState: string); overload;
|
|
Comp : TComponent; AErrorCode: integer; ASQLState: string); overload;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+ { TSQLDBParam }
|
|
|
|
+
|
|
|
|
+ TSQLDBParam = Class(TParam)
|
|
|
|
+ private
|
|
|
|
+ FFieldDef: TFieldDef;
|
|
|
|
+ FData : Pointer;
|
|
|
|
+ Protected
|
|
|
|
+ Property FieldDef : TFieldDef Read FFieldDef Write FFieldDef;
|
|
|
|
+ Property Data : Pointer Read FData Write FData;
|
|
|
|
+ end;
|
|
|
|
+
|
|
|
|
+ { TSQLDBParams }
|
|
|
|
+
|
|
|
|
+ TSQLDBParams = Class(TParams)
|
|
|
|
+ Protected
|
|
|
|
+ Class Function ParamClass : TParamClass; override;
|
|
|
|
+ end;
|
|
|
|
+
|
|
TQuoteChars = array[0..1] of char;
|
|
TQuoteChars = array[0..1] of char;
|
|
|
|
|
|
const
|
|
const
|
|
@@ -218,10 +237,10 @@ type
|
|
public
|
|
public
|
|
constructor Create(AOwner : TComponent); override;
|
|
constructor Create(AOwner : TComponent); override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
- procedure Commit; virtual;
|
|
|
|
- procedure CommitRetaining; virtual;
|
|
|
|
- procedure Rollback; virtual;
|
|
|
|
- procedure RollbackRetaining; virtual;
|
|
|
|
|
|
+ procedure Commit; override;
|
|
|
|
+ procedure CommitRetaining; override;
|
|
|
|
+ procedure Rollback; override;
|
|
|
|
+ procedure RollbackRetaining; override;
|
|
procedure StartTransaction; override;
|
|
procedure StartTransaction; override;
|
|
procedure EndTransaction; override;
|
|
procedure EndTransaction; override;
|
|
property Handle: Pointer read GetHandle;
|
|
property Handle: Pointer read GetHandle;
|
|
@@ -267,7 +286,7 @@ type
|
|
Procedure DoExecute; virtual;
|
|
Procedure DoExecute; virtual;
|
|
procedure DoPrepare; virtual;
|
|
procedure DoPrepare; virtual;
|
|
procedure DoUnPrepare; virtual;
|
|
procedure DoUnPrepare; virtual;
|
|
- Function CreateParams : TParams; virtual;
|
|
|
|
|
|
+ Function CreateParams : TSQLDBParams; virtual;
|
|
Function LogEvent(EventType : TDBEventType) : Boolean;
|
|
Function LogEvent(EventType : TDBEventType) : Boolean;
|
|
Procedure Log(EventType : TDBEventType; Const Msg : String); virtual;
|
|
Procedure Log(EventType : TDBEventType; Const Msg : String); virtual;
|
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
|
@@ -650,6 +669,13 @@ begin
|
|
result := Format('%.2d:%.2d:%.2d.%.3d',[hour,minute,second,millisecond]);
|
|
result := Format('%.2d:%.2d:%.2d.%.3d',[hour,minute,second,millisecond]);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+{ TSQLDBParams }
|
|
|
|
+
|
|
|
|
+class function TSQLDBParams.ParamClass: TParamClass;
|
|
|
|
+begin
|
|
|
|
+ Result:=TSQLDBParam;
|
|
|
|
+end;
|
|
|
|
+
|
|
{ ESQLDatabaseError }
|
|
{ ESQLDatabaseError }
|
|
|
|
|
|
constructor ESQLDatabaseError.CreateFmt(const Fmt: string; const Args: array of const;
|
|
constructor ESQLDatabaseError.CreateFmt(const Fmt: string; const Args: array of const;
|
|
@@ -675,7 +701,7 @@ procedure TCustomSQLStatement.OnChangeSQL(Sender: TObject);
|
|
|
|
|
|
var
|
|
var
|
|
ConnOptions : TConnOptions;
|
|
ConnOptions : TConnOptions;
|
|
- NewParams: TParams;
|
|
|
|
|
|
+ NewParams: TSQLDBParams;
|
|
|
|
|
|
begin
|
|
begin
|
|
UnPrepare;
|
|
UnPrepare;
|
|
@@ -776,9 +802,9 @@ begin
|
|
Result:=TDataLink.Create;
|
|
Result:=TDataLink.Create;
|
|
end;
|
|
end;
|
|
|
|
|
|
-function TCustomSQLStatement.CreateParams: TParams;
|
|
|
|
|
|
+function TCustomSQLStatement.CreateParams: TSQLDBParams;
|
|
begin
|
|
begin
|
|
- Result:=TParams.Create(Nil);
|
|
|
|
|
|
+ Result:=TSQLDBParams.Create(Nil);
|
|
end;
|
|
end;
|
|
|
|
|
|
function TCustomSQLStatement.LogEvent(EventType: TDBEventType): Boolean;
|
|
function TCustomSQLStatement.LogEvent(EventType: TDBEventType): Boolean;
|
|
@@ -1438,32 +1464,6 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TCustomSQLQuery }
|
|
{ TCustomSQLQuery }
|
|
-(*
|
|
|
|
-procedure TCustomSQLQuery.OnChangeSQL(Sender : TObject);
|
|
|
|
-
|
|
|
|
-var ConnOptions : TConnOptions;
|
|
|
|
- NewParams: TParams;
|
|
|
|
-
|
|
|
|
-begin
|
|
|
|
- FSchemaType:=stNoSchema;
|
|
|
|
- if (FSQL <> nil) and ParamCheck then
|
|
|
|
- begin
|
|
|
|
- if assigned(DataBase) then
|
|
|
|
- ConnOptions := SQLConnection.ConnOptions
|
|
|
|
- else
|
|
|
|
- ConnOptions := [sqEscapeRepeat,sqEscapeSlash];
|
|
|
|
- //preserve existing param. values
|
|
|
|
- NewParams := TParams.Create(Self);
|
|
|
|
- try
|
|
|
|
- NewParams.ParseSQL(FSQL.Text, True, sqEscapeSlash in ConnOptions, sqEscapeRepeat in ConnOptions, psInterbase);
|
|
|
|
- NewParams.AssignValues(FParams);
|
|
|
|
- FParams.Assign(NewParams);
|
|
|
|
- finally
|
|
|
|
- NewParams.Free;
|
|
|
|
- end;
|
|
|
|
- end;
|
|
|
|
-end;
|
|
|
|
-*)
|
|
|
|
|
|
|
|
function TCustomSQLQuery.ParamByName(const AParamName: String): TParam;
|
|
function TCustomSQLQuery.ParamByName(const AParamName: String): TParam;
|
|
|
|
|
|
@@ -1502,13 +1502,8 @@ begin
|
|
If Assigned(FStatement) then
|
|
If Assigned(FStatement) then
|
|
FStatement.Database:=DB;
|
|
FStatement.Database:=DB;
|
|
inherited setdatabase(value);
|
|
inherited setdatabase(value);
|
|
-(*
|
|
|
|
- FStatement.Database:=Db,
|
|
|
|
- if assigned(FCursor) then SQLConnection.DeAllocateCursorHandle(FCursor);
|
|
|
|
-*)
|
|
|
|
if assigned(value) and (Transaction = nil) and (Assigned(db.Transaction)) then
|
|
if assigned(value) and (Transaction = nil) and (Assigned(db.Transaction)) then
|
|
transaction := Db.Transaction;
|
|
transaction := Db.Transaction;
|
|
-// FStatement.OnChangeSQL(Self);
|
|
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|