|
@@ -163,6 +163,8 @@ type
|
|
function GetPort: cardinal;
|
|
function GetPort: cardinal;
|
|
procedure SetOptions(AValue: TSQLConnectionOptions);
|
|
procedure SetOptions(AValue: TSQLConnectionOptions);
|
|
procedure SetPort(const AValue: cardinal);
|
|
procedure SetPort(const AValue: cardinal);
|
|
|
|
+ function AttemptCommit(trans : TSQLHandle) : boolean;
|
|
|
|
+ function AttemptRollBack(trans : TSQLHandle) : boolean;
|
|
protected
|
|
protected
|
|
FConnOptions : TConnOptions;
|
|
FConnOptions : TConnOptions;
|
|
FSQLFormatSettings : TFormatSettings;
|
|
FSQLFormatSettings : TFormatSettings;
|
|
@@ -1264,6 +1266,30 @@ begin
|
|
Delete(IndexOfName('Port'));
|
|
Delete(IndexOfName('Port'));
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+function TSQLConnection.AttemptCommit(trans: TSQLHandle): boolean;
|
|
|
|
+begin
|
|
|
|
+ try
|
|
|
|
+ Result:=Commit(trans);
|
|
|
|
+ except
|
|
|
|
+ if ForcedClose then
|
|
|
|
+ Result:=True
|
|
|
|
+ else
|
|
|
|
+ Raise;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
|
|
+function TSQLConnection.AttemptRollBack(trans: TSQLHandle): boolean;
|
|
|
|
+begin
|
|
|
|
+ try
|
|
|
|
+ Result:=Rollback(trans);
|
|
|
|
+ except
|
|
|
|
+ if ForcedClose then
|
|
|
|
+ Result:=True
|
|
|
|
+ else
|
|
|
|
+ Raise;
|
|
|
|
+ end;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TSQLConnection.GetDBInfo(const ASchemaType : TSchemaType; const ASchemaObjectName, AReturnField : string; AList: TStrings);
|
|
procedure TSQLConnection.GetDBInfo(const ASchemaType : TSchemaType; const ASchemaObjectName, AReturnField : string; AList: TStrings);
|
|
|
|
|
|
var qry : TCustomSQLQuery;
|
|
var qry : TCustomSQLQuery;
|
|
@@ -1624,7 +1650,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function TSQLConnection.ConstructInsertSQL(Query : TCustomSQLQuery; Var ReturningClause : Boolean) : string;
|
|
|
|
|
|
+function TSQLConnection.ConstructInsertSQL(Query: TCustomSQLQuery;
|
|
|
|
+ var ReturningClause: Boolean): string;
|
|
|
|
|
|
var x : integer;
|
|
var x : integer;
|
|
sql_fields : string;
|
|
sql_fields : string;
|
|
@@ -1665,7 +1692,8 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-function TSQLConnection.ConstructUpdateSQL(Query: TCustomSQLQuery; Var ReturningClause : Boolean): string;
|
|
|
|
|
|
+function TSQLConnection.ConstructUpdateSQL(Query: TCustomSQLQuery;
|
|
|
|
+ var ReturningClause: Boolean): string;
|
|
|
|
|
|
var x : integer;
|
|
var x : integer;
|
|
F : TField;
|
|
F : TField;
|
|
@@ -1983,7 +2011,7 @@ begin
|
|
CloseDataSets;
|
|
CloseDataSets;
|
|
If LogEvent(detCommit) then
|
|
If LogEvent(detCommit) then
|
|
Log(detCommit,SCommitting);
|
|
Log(detCommit,SCommitting);
|
|
- if (stoUseImplicit in Options) or SQLConnection.Commit(FTrans) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) or SQLConnection.AttemptCommit(FTrans) then
|
|
begin
|
|
begin
|
|
CloseTrans;
|
|
CloseTrans;
|
|
FreeAndNil(FTrans);
|
|
FreeAndNil(FTrans);
|
|
@@ -2010,7 +2038,7 @@ begin
|
|
CloseDataSets;
|
|
CloseDataSets;
|
|
If LogEvent(detRollback) then
|
|
If LogEvent(detRollback) then
|
|
Log(detRollback,SRollingBack);
|
|
Log(detRollback,SRollingBack);
|
|
- if SQLConnection.RollBack(FTrans) then
|
|
|
|
|
|
+ if SQLConnection.AttemptRollBack(FTrans) then
|
|
begin
|
|
begin
|
|
CloseTrans;
|
|
CloseTrans;
|
|
FreeAndNil(FTrans);
|
|
FreeAndNil(FTrans);
|