|
@@ -368,6 +368,7 @@ type
|
|
Private
|
|
Private
|
|
FCursor : TSQLCursor;
|
|
FCursor : TSQLCursor;
|
|
FDatabase: TSQLConnection;
|
|
FDatabase: TSQLConnection;
|
|
|
|
+ FOnSQLChanged: TNotifyEvent;
|
|
FParamCheck: Boolean;
|
|
FParamCheck: Boolean;
|
|
FParams: TParams;
|
|
FParams: TParams;
|
|
FMacroCheck: Boolean;
|
|
FMacroCheck: Boolean;
|
|
@@ -428,6 +429,7 @@ type
|
|
Property ParamCheck : Boolean Read FParamCheck Write FParamCheck default true;
|
|
Property ParamCheck : Boolean Read FParamCheck Write FParamCheck default true;
|
|
Property MacroCheck : Boolean Read FMacroCheck Write SetMacroCheck default false;
|
|
Property MacroCheck : Boolean Read FMacroCheck Write SetMacroCheck default false;
|
|
Property InfoQuery : Boolean Read FInfoQuery Write FInfoQuery;
|
|
Property InfoQuery : Boolean Read FInfoQuery Write FInfoQuery;
|
|
|
|
+ Property OnSQLChanged : TNotifyEvent Read FOnSQLChanged Write FOnSQLChanged;
|
|
Public
|
|
Public
|
|
constructor Create(AOwner : TComponent); override;
|
|
constructor Create(AOwner : TComponent); override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
@@ -479,7 +481,7 @@ type
|
|
|
|
|
|
{ TCustomSQLQuery }
|
|
{ TCustomSQLQuery }
|
|
|
|
|
|
- TSQLQueryOption = (sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit, sqoCancelUpdatesOnRefresh, sqoRefreshUsingSelect);
|
|
|
|
|
|
+ TSQLQueryOption = (sqoKeepOpenOnCommit, sqoAutoApplyUpdates, sqoAutoCommit, sqoCancelUpdatesOnRefresh, sqoRefreshUsingSelect, sqoNoCloseOnSQLChange);
|
|
TSQLQueryOptions = Set of TSQLQueryOption;
|
|
TSQLQueryOptions = Set of TSQLQueryOption;
|
|
|
|
|
|
TCustomSQLQuery = class (TCustomBufDataset)
|
|
TCustomSQLQuery = class (TCustomBufDataset)
|
|
@@ -529,6 +531,7 @@ type
|
|
function HasMacros: Boolean;
|
|
function HasMacros: Boolean;
|
|
Function HasParams : Boolean;
|
|
Function HasParams : Boolean;
|
|
Function NeedLastInsertID: TField;
|
|
Function NeedLastInsertID: TField;
|
|
|
|
+ procedure OnChangeSelectSQL(Sender: TObject);
|
|
procedure SetMacroChar(AValue: AnsiChar);
|
|
procedure SetMacroChar(AValue: AnsiChar);
|
|
procedure SetOptions(AValue: TSQLQueryOptions);
|
|
procedure SetOptions(AValue: TSQLQueryOptions);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
@@ -942,6 +945,8 @@ var
|
|
NewParams: TSQLDBParams;
|
|
NewParams: TSQLDBParams;
|
|
|
|
|
|
begin
|
|
begin
|
|
|
|
+ if Assigned(FOnSQLChanged) then
|
|
|
|
+ FOnSQLChanged(Self);
|
|
UnPrepare;
|
|
UnPrepare;
|
|
RecreateMacros;
|
|
RecreateMacros;
|
|
if not ParamCheck then
|
|
if not ParamCheck then
|
|
@@ -2724,6 +2729,7 @@ begin
|
|
If ParamCheck and Assigned(FDataLink) then
|
|
If ParamCheck and Assigned(FDataLink) then
|
|
(FDataLink as TMasterParamsDataLink).RefreshParamNames;
|
|
(FDataLink as TMasterParamsDataLink).RefreshParamNames;
|
|
FQuery.ServerIndexDefs.Updated:=false;
|
|
FQuery.ServerIndexDefs.Updated:=false;
|
|
|
|
+
|
|
end;
|
|
end;
|
|
|
|
|
|
{ TCustomSQLQuery }
|
|
{ TCustomSQLQuery }
|
|
@@ -2740,6 +2746,7 @@ constructor TCustomSQLQuery.Create(AOwner : TComponent);
|
|
begin
|
|
begin
|
|
inherited Create(AOwner);
|
|
inherited Create(AOwner);
|
|
FStatement:=CreateSQLStatement(Self);
|
|
FStatement:=CreateSQLStatement(Self);
|
|
|
|
+ FStatement.OnSQLChanged:=@OnChangeSelectSQL;
|
|
|
|
|
|
FInsertSQL := TStringList.Create;
|
|
FInsertSQL := TStringList.Create;
|
|
FInsertSQL.OnChange := @OnChangeModifySQL;
|
|
FInsertSQL.OnChange := @OnChangeModifySQL;
|
|
@@ -3352,6 +3359,13 @@ begin
|
|
end
|
|
end
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCustomSQLQuery.OnChangeSelectSQL(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if (sqoNoCloseOnSQLChange in Options) then
|
|
|
|
+ exit;
|
|
|
|
+ Close;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TCustomSQLQuery.SetMacroChar(AValue: AnsiChar);
|
|
procedure TCustomSQLQuery.SetMacroChar(AValue: AnsiChar);
|
|
begin
|
|
begin
|
|
FStatement.MacroChar:=AValue;
|
|
FStatement.MacroChar:=AValue;
|