|
@@ -24,13 +24,7 @@ uses SysUtils, Classes, DB, bufdataset, sqlscript;
|
|
|
|
|
|
type
|
|
type
|
|
TSchemaType = (stNoSchema, stTables, stSysTables, stProcedures, stColumns, stProcedureParams, stIndexes, stPackages, stSchemata);
|
|
TSchemaType = (stNoSchema, stTables, stSysTables, stProcedures, stColumns, stProcedureParams, stIndexes, stPackages, stSchemata);
|
|
- TConnOption = (sqSupportParams, sqSupportEmptyDatabaseName, sqEscapeSlash, sqEscapeRepeat, sqImplicitTransaction);
|
|
|
|
- TConnOptions= set of TConnOption;
|
|
|
|
-
|
|
|
|
- TConnectionOption = (coExplicitConnect,coCheckRowsAffected);
|
|
|
|
- TConnectionOptions = Set of TConnectionOption;
|
|
|
|
|
|
|
|
- TConnInfoType=(citAll=-1, citServerType, citServerVersion, citServerVersionString, citClientName, citClientVersion);
|
|
|
|
TStatementType = (stUnknown, stSelect, stInsert, stUpdate, stDelete,
|
|
TStatementType = (stUnknown, stSelect, stInsert, stUpdate, stDelete,
|
|
stDDL, stGetSegment, stPutSegment, stExecProcedure,
|
|
stDDL, stGetSegment, stPutSegment, stExecProcedure,
|
|
stStartTrans, stCommit, stRollback, stSelectForUpd);
|
|
stStartTrans, stCommit, stRollback, stSelectForUpd);
|
|
@@ -47,7 +41,6 @@ type
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-type
|
|
|
|
TSQLConnection = class;
|
|
TSQLConnection = class;
|
|
TSQLTransaction = class;
|
|
TSQLTransaction = class;
|
|
TCustomSQLQuery = class;
|
|
TCustomSQLQuery = class;
|
|
@@ -60,9 +53,6 @@ type
|
|
TDBEventTypes = set of TDBEventType;
|
|
TDBEventTypes = set of TDBEventType;
|
|
TDBLogNotifyEvent = Procedure (Sender : TSQLConnection; EventType : TDBEventType; Const Msg : String) of object;
|
|
TDBLogNotifyEvent = Procedure (Sender : TSQLConnection; EventType : TDBEventType; Const Msg : String) of object;
|
|
|
|
|
|
- TSQLQueryOption = (sqoDisconnected, sqoAutoApplyUpdates, sqoAutoCommit);
|
|
|
|
- TSQLQueryOptions = Set of TSQLQueryOption;
|
|
|
|
-
|
|
|
|
TSQLHandle = Class(TObject)
|
|
TSQLHandle = Class(TObject)
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -150,10 +140,18 @@ type
|
|
|
|
|
|
{ TSQLConnection }
|
|
{ TSQLConnection }
|
|
|
|
|
|
|
|
+ TConnOption = (sqSupportParams, sqSupportEmptyDatabaseName, sqEscapeSlash, sqEscapeRepeat, sqImplicitTransaction);
|
|
|
|
+ TConnOptions= set of TConnOption;
|
|
|
|
+
|
|
|
|
+ TSQLConnectionOption = (scoExplicitConnect, scoApplyUpdatesChecksRowsAffected);
|
|
|
|
+ TSQLConnectionOptions = Set of TSQLConnectionOption;
|
|
|
|
+
|
|
|
|
+ TConnInfoType=(citAll=-1, citServerType, citServerVersion, citServerVersionString, citClientName, citClientVersion);
|
|
|
|
+
|
|
TSQLConnection = class (TDatabase)
|
|
TSQLConnection = class (TDatabase)
|
|
private
|
|
private
|
|
FFieldNameQuoteChars : TQuoteChars;
|
|
FFieldNameQuoteChars : TQuoteChars;
|
|
- FOptions: TConnectionOptions;
|
|
|
|
|
|
+ FOptions : TSQLConnectionOptions;
|
|
FPassword : string;
|
|
FPassword : string;
|
|
FTransaction : TSQLTransaction;
|
|
FTransaction : TSQLTransaction;
|
|
FUserName : string;
|
|
FUserName : string;
|
|
@@ -165,7 +163,7 @@ type
|
|
FOnLog: TDBLogNotifyEvent;
|
|
FOnLog: TDBLogNotifyEvent;
|
|
FInternalTransaction : TSQLTransaction;
|
|
FInternalTransaction : TSQLTransaction;
|
|
function GetPort: cardinal;
|
|
function GetPort: cardinal;
|
|
- procedure SetOptions(AValue: TConnectionOptions);
|
|
|
|
|
|
+ procedure SetOptions(AValue: TSQLConnectionOptions);
|
|
procedure SetPort(const AValue: cardinal);
|
|
procedure SetPort(const AValue: cardinal);
|
|
protected
|
|
protected
|
|
FConnOptions : TConnOptions;
|
|
FConnOptions : TConnOptions;
|
|
@@ -249,9 +247,9 @@ type
|
|
property HostName : string Read FHostName Write FHostName;
|
|
property HostName : string Read FHostName Write FHostName;
|
|
Property OnLog : TDBLogNotifyEvent Read FOnLog Write FOnLog;
|
|
Property OnLog : TDBLogNotifyEvent Read FOnLog Write FOnLog;
|
|
Property LogEvents : TDBEventTypes Read FLogEvents Write FLogEvents Default LogAllEvents;
|
|
Property LogEvents : TDBEventTypes Read FLogEvents Write FLogEvents Default LogAllEvents;
|
|
- Property Options : TConnectionOptions Read FOptions Write SetOptions;
|
|
|
|
- property Connected;
|
|
|
|
|
|
+ Property Options : TSQLConnectionOptions Read FOptions Write SetOptions;
|
|
Property Role : String read FRole write FRole;
|
|
Property Role : String read FRole write FRole;
|
|
|
|
+ property Connected;
|
|
property DatabaseName;
|
|
property DatabaseName;
|
|
property KeepConnection;
|
|
property KeepConnection;
|
|
property LoginPrompt;
|
|
property LoginPrompt;
|
|
@@ -263,17 +261,18 @@ type
|
|
|
|
|
|
TCommitRollbackAction = (caNone, caCommit, caCommitRetaining, caRollback,
|
|
TCommitRollbackAction = (caNone, caCommit, caCommitRetaining, caRollback,
|
|
caRollbackRetaining);
|
|
caRollbackRetaining);
|
|
- TTransactionOption = (toUseImplicit, toExplicitStart);
|
|
|
|
- TTransactionOptions = Set of TTransactionOption;
|
|
|
|
|
|
+
|
|
|
|
+ TSQLTransactionOption = (stoUseImplicit, stoExplicitStart);
|
|
|
|
+ TSQLTransactionOptions = Set of TSQLTransactionOption;
|
|
|
|
|
|
TSQLTransaction = class (TDBTransaction)
|
|
TSQLTransaction = class (TDBTransaction)
|
|
private
|
|
private
|
|
- FOptions: TTransactionOptions;
|
|
|
|
|
|
+ FOptions : TSQLTransactionOptions;
|
|
FTrans : TSQLHandle;
|
|
FTrans : TSQLHandle;
|
|
FAction : TCommitRollbackAction;
|
|
FAction : TCommitRollbackAction;
|
|
FParams : TStringList;
|
|
FParams : TStringList;
|
|
function GetSQLConnection: TSQLConnection;
|
|
function GetSQLConnection: TSQLConnection;
|
|
- procedure SetOptions(AValue: TTransactionOptions);
|
|
|
|
|
|
+ procedure SetOptions(AValue: TSQLTransactionOptions);
|
|
procedure SetParams(const AValue: TStringList);
|
|
procedure SetParams(const AValue: TStringList);
|
|
procedure SetSQLConnection(AValue: TSQLConnection);
|
|
procedure SetSQLConnection(AValue: TSQLConnection);
|
|
protected
|
|
protected
|
|
@@ -298,7 +297,7 @@ type
|
|
property Action : TCommitRollbackAction read FAction write FAction Default caRollBack;
|
|
property Action : TCommitRollbackAction read FAction write FAction Default caRollBack;
|
|
property Database;
|
|
property Database;
|
|
property Params : TStringList read FParams write SetParams;
|
|
property Params : TStringList read FParams write SetParams;
|
|
- Property Options : TTransactionOptions Read FOptions Write SetOptions;
|
|
|
|
|
|
+ Property Options : TSQLTransactionOptions Read FOptions Write SetOptions;
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -375,9 +374,12 @@ type
|
|
|
|
|
|
{ TCustomSQLQuery }
|
|
{ TCustomSQLQuery }
|
|
|
|
|
|
|
|
+ TSQLQueryOption = (sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit);
|
|
|
|
+ TSQLQueryOptions = Set of TSQLQueryOption;
|
|
|
|
+
|
|
TCustomSQLQuery = class (TCustomBufDataset)
|
|
TCustomSQLQuery = class (TCustomBufDataset)
|
|
private
|
|
private
|
|
- FQueryOptions: TSQLQueryOptions;
|
|
|
|
|
|
+ FOptions : TSQLQueryOptions;
|
|
FSchemaType : TSchemaType;
|
|
FSchemaType : TSchemaType;
|
|
FUpdateable : boolean;
|
|
FUpdateable : boolean;
|
|
FTableName : string;
|
|
FTableName : string;
|
|
@@ -412,8 +414,8 @@ type
|
|
function GetSQLConnection: TSQLConnection;
|
|
function GetSQLConnection: TSQLConnection;
|
|
function GetSQLTransaction: TSQLTransaction;
|
|
function GetSQLTransaction: TSQLTransaction;
|
|
function GetStatementType : TStatementType;
|
|
function GetStatementType : TStatementType;
|
|
|
|
+ procedure SetOptions(AValue: TSQLQueryOptions);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
- procedure SetQueryOptions(AValue: TSQLQueryOptions);
|
|
|
|
procedure SetSQLConnection(AValue: TSQLConnection);
|
|
procedure SetSQLConnection(AValue: TSQLConnection);
|
|
procedure SetSQLTransaction(AValue: TSQLTransaction);
|
|
procedure SetSQLTransaction(AValue: TSQLTransaction);
|
|
procedure SetUpdateSQL(const AValue: TStringlist);
|
|
procedure SetUpdateSQL(const AValue: TStringlist);
|
|
@@ -504,15 +506,15 @@ type
|
|
property OnNewRecord;
|
|
property OnNewRecord;
|
|
property OnPostError;
|
|
property OnPostError;
|
|
property AutoCalcFields;
|
|
property AutoCalcFields;
|
|
|
|
+ // protected
|
|
property Database;
|
|
property Database;
|
|
- // protected
|
|
|
|
- Property QueryOptions : TSQLQueryOptions Read FQueryOptions Write SetQueryOptions;
|
|
|
|
- property SchemaType : TSchemaType read FSchemaType default stNoSchema;
|
|
|
|
property Transaction;
|
|
property Transaction;
|
|
|
|
+ property SchemaType : TSchemaType read FSchemaType default stNoSchema;
|
|
property SQL : TStringlist read GetSQL write SetSQL;
|
|
property SQL : TStringlist read GetSQL write SetSQL;
|
|
property UpdateSQL : TStringlist read FUpdateSQL write SetUpdateSQL;
|
|
property UpdateSQL : TStringlist read FUpdateSQL write SetUpdateSQL;
|
|
property InsertSQL : TStringlist read FInsertSQL write SetInsertSQL;
|
|
property InsertSQL : TStringlist read FInsertSQL write SetInsertSQL;
|
|
property DeleteSQL : TStringlist read FDeleteSQL write SetDeleteSQL;
|
|
property DeleteSQL : TStringlist read FDeleteSQL write SetDeleteSQL;
|
|
|
|
+ Property Options : TSQLQueryOptions Read FOptions Write SetOptions;
|
|
property Params : TParams read GetParams Write SetParams;
|
|
property Params : TParams read GetParams Write SetParams;
|
|
Property ParamCheck : Boolean Read GetParamCheck Write SetParamCheck default true;
|
|
Property ParamCheck : Boolean Read GetParamCheck Write SetParamCheck default true;
|
|
property ParseSQL : Boolean read GetParseSQL write SetParseSQL default true;
|
|
property ParseSQL : Boolean read GetParseSQL write SetParseSQL default true;
|
|
@@ -562,7 +564,6 @@ type
|
|
Property OnPostError;
|
|
Property OnPostError;
|
|
|
|
|
|
// property SchemaInfo default stNoSchema;
|
|
// property SchemaInfo default stNoSchema;
|
|
- Property QueryOptions;
|
|
|
|
property Database;
|
|
property Database;
|
|
property Transaction;
|
|
property Transaction;
|
|
property ReadOnly;
|
|
property ReadOnly;
|
|
@@ -571,6 +572,7 @@ type
|
|
property InsertSQL;
|
|
property InsertSQL;
|
|
property DeleteSQL;
|
|
property DeleteSQL;
|
|
property IndexDefs;
|
|
property IndexDefs;
|
|
|
|
+ Property Options;
|
|
property Params;
|
|
property Params;
|
|
Property ParamCheck;
|
|
Property ParamCheck;
|
|
property ParseSQL;
|
|
property ParseSQL;
|
|
@@ -1182,7 +1184,7 @@ begin
|
|
DatabaseError(SErrTransactionnSet);
|
|
DatabaseError(SErrTransactionnSet);
|
|
|
|
|
|
if not Connected then Open;
|
|
if not Connected then Open;
|
|
- if not (ATransaction.Active or (toUseImplicit in ATransaction.Options)) then
|
|
|
|
|
|
+ if not (ATransaction.Active or (stoUseImplicit in ATransaction.Options)) then
|
|
ATransaction.MaybeStartTransaction;
|
|
ATransaction.MaybeStartTransaction;
|
|
|
|
|
|
try
|
|
try
|
|
@@ -1209,7 +1211,7 @@ begin
|
|
result := StrToIntDef(Params.Values['Port'],0);
|
|
result := StrToIntDef(Params.Values['Port'],0);
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TSQLConnection.SetOptions(AValue: TConnectionOptions);
|
|
|
|
|
|
+procedure TSQLConnection.SetOptions(AValue: TSQLConnectionOptions);
|
|
begin
|
|
begin
|
|
if FOptions=AValue then Exit;
|
|
if FOptions=AValue then Exit;
|
|
FOptions:=AValue;
|
|
FOptions:=AValue;
|
|
@@ -1687,15 +1689,15 @@ begin
|
|
begin
|
|
begin
|
|
P:=Qry.Params[x];
|
|
P:=Qry.Params[x];
|
|
S:=p.name;
|
|
S:=p.name;
|
|
- B:=Sametext(leftstr(S,4),'OLD_');
|
|
|
|
|
|
+ B:=SameText(leftstr(S,4),'OLD_');
|
|
if B then
|
|
if B then
|
|
Delete(S,1,4);
|
|
Delete(S,1,4);
|
|
Fld:=Query.FieldByName(S);
|
|
Fld:=Query.FieldByName(S);
|
|
ApplyFieldUpdate(Query.Cursor,P as TSQLDBParam,Fld,B);
|
|
ApplyFieldUpdate(Query.Cursor,P as TSQLDBParam,Fld,B);
|
|
end;
|
|
end;
|
|
- Qry.execute;
|
|
|
|
- if (coCheckRowsAffected in Options) and (Qry.RowsAffected<>1) then
|
|
|
|
- DatabaseErrorFmt(SErrFailedToUpdateRecord,[Qry.RowsAffected],Query);
|
|
|
|
|
|
+ Qry.Execute;
|
|
|
|
+ if (scoApplyUpdatesChecksRowsAffected in Options) and (Qry.RowsAffected<>1) then
|
|
|
|
+ DatabaseErrorFmt(SErrFailedToUpdateRecord, [Qry.RowsAffected], Query);
|
|
end;
|
|
end;
|
|
|
|
|
|
procedure TSQLConnection.FreeFldBuffers(cursor: TSQLCursor);
|
|
procedure TSQLConnection.FreeFldBuffers(cursor: TSQLCursor);
|
|
@@ -1723,7 +1725,7 @@ Procedure TSQLConnection.MaybeConnect;
|
|
begin
|
|
begin
|
|
If Not Connected then
|
|
If Not Connected then
|
|
begin
|
|
begin
|
|
- If (coExplicitConnect in Options) then
|
|
|
|
|
|
+ If (scoExplicitConnect in Options) then
|
|
DatabaseErrorFmt(SErrImplicitConnect,[Name]);
|
|
DatabaseErrorFmt(SErrImplicitConnect,[Name]);
|
|
Connected:=True;
|
|
Connected:=True;
|
|
end;
|
|
end;
|
|
@@ -1751,7 +1753,7 @@ begin
|
|
Commit;
|
|
Commit;
|
|
caNone,
|
|
caNone,
|
|
caRollback, caRollbackRetaining :
|
|
caRollback, caRollbackRetaining :
|
|
- if not (toUseImplicit in Options) then
|
|
|
|
|
|
+ if not (stoUseImplicit in Options) then
|
|
RollBack
|
|
RollBack
|
|
else
|
|
else
|
|
CloseTrans;
|
|
CloseTrans;
|
|
@@ -1768,11 +1770,11 @@ begin
|
|
Result:=Database as TSQLConnection;
|
|
Result:=Database as TSQLConnection;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TSQLTransaction.SetOptions(AValue: TTransactionOptions);
|
|
|
|
|
|
+procedure TSQLTransaction.SetOptions(AValue: TSQLTransactionOptions);
|
|
begin
|
|
begin
|
|
if FOptions=AValue then Exit;
|
|
if FOptions=AValue then Exit;
|
|
- if (toUseImplicit in Avalue) and Assigned(SQLConnection) And Not (sqImplicitTransaction in SQLConnection.ConnOptions) then
|
|
|
|
- DatabaseErrorFmt(SErrNoImplicitTransaction,[SQLConnection.ClassName]);
|
|
|
|
|
|
+ if (stoUseImplicit in Avalue) and Assigned(SQLConnection) And Not (sqImplicitTransaction in SQLConnection.ConnOptions) then
|
|
|
|
+ DatabaseErrorFmt(SErrNoImplicitTransaction, [SQLConnection.ClassName]);
|
|
FOptions:=AValue;
|
|
FOptions:=AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -1785,8 +1787,8 @@ Procedure TSQLTransaction.MaybeStartTransaction;
|
|
begin
|
|
begin
|
|
if not Active then
|
|
if not Active then
|
|
begin
|
|
begin
|
|
- if (toExplicitStart in Options) then
|
|
|
|
- DatabaseErrorFmt(SErrImplictTransactionStart,[Database.Name,Name]);
|
|
|
|
|
|
+ if (stoExplicitStart in Options) then
|
|
|
|
+ DatabaseErrorFmt(SErrImplictTransactionStart, [Database.Name,Name]);
|
|
StartTransaction;
|
|
StartTransaction;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
@@ -1799,7 +1801,7 @@ end;
|
|
Function TSQLTransaction.AllowClose(DS: TDBDataset): Boolean;
|
|
Function TSQLTransaction.AllowClose(DS: TDBDataset): Boolean;
|
|
begin
|
|
begin
|
|
if (DS is TSQLQuery) then
|
|
if (DS is TSQLQuery) then
|
|
- Result:=not (sqoDisconnected in TSQLQuery(DS).QueryOptions)
|
|
|
|
|
|
+ Result:=not (sqoKeepOpenOnCommit in TSQLQuery(DS).Options)
|
|
else
|
|
else
|
|
Result:=Inherited AllowClose(DS);
|
|
Result:=Inherited AllowClose(DS);
|
|
end;
|
|
end;
|
|
@@ -1811,7 +1813,7 @@ begin
|
|
CloseDataSets;
|
|
CloseDataSets;
|
|
If LogEvent(detCommit) then
|
|
If LogEvent(detCommit) then
|
|
Log(detCommit,SCommitting);
|
|
Log(detCommit,SCommitting);
|
|
- if (toUseImplicit in Options) or SQLConnection.Commit(FTrans) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) or SQLConnection.Commit(FTrans) then
|
|
begin
|
|
begin
|
|
CloseTrans;
|
|
CloseTrans;
|
|
FreeAndNil(FTrans);
|
|
FreeAndNil(FTrans);
|
|
@@ -1833,7 +1835,7 @@ procedure TSQLTransaction.Rollback;
|
|
begin
|
|
begin
|
|
if Active then
|
|
if Active then
|
|
begin
|
|
begin
|
|
- if (toUseImplicit in Options) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) then
|
|
DatabaseError(SErrImplicitNoRollBack);
|
|
DatabaseError(SErrImplicitNoRollBack);
|
|
CloseDataSets;
|
|
CloseDataSets;
|
|
If LogEvent(detRollback) then
|
|
If LogEvent(detRollback) then
|
|
@@ -1850,7 +1852,7 @@ procedure TSQLTransaction.RollbackRetaining;
|
|
begin
|
|
begin
|
|
if Active then
|
|
if Active then
|
|
begin
|
|
begin
|
|
- if (toUseImplicit in Options) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) then
|
|
DatabaseError(SErrImplicitNoRollBack);
|
|
DatabaseError(SErrImplicitNoRollBack);
|
|
If LogEvent(detRollback) then
|
|
If LogEvent(detRollback) then
|
|
Log(detRollback,SRollBackRetaining);
|
|
Log(detRollback,SRollBackRetaining);
|
|
@@ -1875,7 +1877,7 @@ begin
|
|
|
|
|
|
if not assigned(FTrans) then FTrans := Db.AllocateTransactionHandle;
|
|
if not assigned(FTrans) then FTrans := Db.AllocateTransactionHandle;
|
|
|
|
|
|
- if (toUseImplicit in Options) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) then
|
|
begin
|
|
begin
|
|
if Db.StartImplicitTransaction(FTrans,FParams.CommaText) then
|
|
if Db.StartImplicitTransaction(FTrans,FParams.CommaText) then
|
|
OpenTrans
|
|
OpenTrans
|
|
@@ -1910,7 +1912,7 @@ begin
|
|
if Assigned(Value) and not (Value is TSQLConnection) then
|
|
if Assigned(Value) and not (Value is TSQLConnection) then
|
|
DatabaseErrorFmt(SErrNotASQLConnection,[value.Name],self);
|
|
DatabaseErrorFmt(SErrNotASQLConnection,[value.Name],self);
|
|
CheckInactive;
|
|
CheckInactive;
|
|
- if (toUseImplicit in Options) and Assigned(Value) and Not (sqImplicitTransaction in TSQLConnection(Value).ConnOptions) then
|
|
|
|
|
|
+ if (stoUseImplicit in Options) and Assigned(Value) and Not (sqImplicitTransaction in TSQLConnection(Value).ConnOptions) then
|
|
DatabaseErrorFmt(SErrNoImplicitTransaction,[Value.ClassName]);
|
|
DatabaseErrorFmt(SErrNoImplicitTransaction,[Value.ClassName]);
|
|
If Assigned(Database) then
|
|
If Assigned(Database) then
|
|
begin
|
|
begin
|
|
@@ -2075,7 +2077,7 @@ end;
|
|
Procedure TCustomSQLQuery.ApplyUpdates(MaxErrors: Integer);
|
|
Procedure TCustomSQLQuery.ApplyUpdates(MaxErrors: Integer);
|
|
begin
|
|
begin
|
|
inherited ApplyUpdates(MaxErrors);
|
|
inherited ApplyUpdates(MaxErrors);
|
|
- If sqoAutoCommit in QueryOptions then
|
|
|
|
|
|
+ If sqoAutoCommit in Options then
|
|
begin
|
|
begin
|
|
// Retrieve rows affected for last update.
|
|
// Retrieve rows affected for last update.
|
|
FStatement.RowsAffected;
|
|
FStatement.RowsAffected;
|
|
@@ -2258,7 +2260,7 @@ end;
|
|
procedure TCustomSQLQuery.SetPacketRecords(aValue: integer);
|
|
procedure TCustomSQLQuery.SetPacketRecords(aValue: integer);
|
|
begin
|
|
begin
|
|
if (AValue=PacketRecords) then exit;
|
|
if (AValue=PacketRecords) then exit;
|
|
- if (AValue<>-1) and (sqoDisconnected in QueryOptions) then
|
|
|
|
|
|
+ if (AValue<>-1) and (sqoKeepOpenOnCommit in Options) then
|
|
DatabaseError(SErrDisconnectedPacketRecords);
|
|
DatabaseError(SErrDisconnectedPacketRecords);
|
|
Inherited SetPacketRecords(aValue);
|
|
Inherited SetPacketRecords(aValue);
|
|
end;
|
|
end;
|
|
@@ -2417,7 +2419,7 @@ begin
|
|
try
|
|
try
|
|
Prepare;
|
|
Prepare;
|
|
Execute;
|
|
Execute;
|
|
- If sqoAutoCommit in QueryOptions then
|
|
|
|
|
|
+ If sqoAutoCommit in Options then
|
|
begin
|
|
begin
|
|
// Retrieve rows affected
|
|
// Retrieve rows affected
|
|
FStatement.RowsAffected;
|
|
FStatement.RowsAffected;
|
|
@@ -2434,14 +2436,14 @@ end;
|
|
Procedure TCustomSQLQuery.Post;
|
|
Procedure TCustomSQLQuery.Post;
|
|
begin
|
|
begin
|
|
inherited Post;
|
|
inherited Post;
|
|
- If (sqoAutoApplyUpdates in QueryOptions) then
|
|
|
|
|
|
+ If (sqoAutoApplyUpdates in Options) then
|
|
ApplyUpdates;
|
|
ApplyUpdates;
|
|
end;
|
|
end;
|
|
|
|
|
|
Procedure TCustomSQLQuery.Delete;
|
|
Procedure TCustomSQLQuery.Delete;
|
|
begin
|
|
begin
|
|
inherited Delete;
|
|
inherited Delete;
|
|
- If (sqoAutoApplyUpdates in QueryOptions) then
|
|
|
|
|
|
+ If (sqoAutoApplyUpdates in Options) then
|
|
ApplyUpdates;
|
|
ApplyUpdates;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -2572,12 +2574,12 @@ begin
|
|
FStatement.ParamCheck:=AValue;
|
|
FStatement.ParamCheck:=AValue;
|
|
end;
|
|
end;
|
|
|
|
|
|
-procedure TCustomSQLQuery.SetQueryOptions(AValue: TSQLQueryOptions);
|
|
|
|
|
|
+procedure TCustomSQLQuery.SetOptions(AValue: TSQLQueryOptions);
|
|
begin
|
|
begin
|
|
- if FQueryOptions=AValue then Exit;
|
|
|
|
|
|
+ if FOptions=AValue then Exit;
|
|
CheckInactive;
|
|
CheckInactive;
|
|
- FQueryOptions:=AValue;
|
|
|
|
- if sqoDisconnected in FQueryOptions then
|
|
|
|
|
|
+ FOptions:=AValue;
|
|
|
|
+ if sqoKeepOpenOnCommit in FOptions then
|
|
PacketRecords:=-1;
|
|
PacketRecords:=-1;
|
|
end;
|
|
end;
|
|
|
|
|