|
@@ -365,6 +365,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;
|
|
@@ -423,6 +424,8 @@ type
|
|
Property ParseSQL : Boolean Read FParseSQL Write FParseSQL;
|
|
Property ParseSQL : Boolean Read FParseSQL Write FParseSQL;
|
|
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 OnSQLChanged : TNotifyEvent Read FOnSQLChanged Write FOnSQLChanged;
|
|
Public
|
|
Public
|
|
constructor Create(AOwner : TComponent); override;
|
|
constructor Create(AOwner : TComponent); override;
|
|
destructor Destroy; override;
|
|
destructor Destroy; override;
|
|
@@ -474,7 +477,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)
|
|
@@ -524,6 +527,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: Char);
|
|
procedure SetMacroChar(AValue: Char);
|
|
procedure SetOptions(AValue: TSQLQueryOptions);
|
|
procedure SetOptions(AValue: TSQLQueryOptions);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
procedure SetParamCheck(AValue: Boolean);
|
|
@@ -933,6 +937,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
|
|
@@ -2785,6 +2791,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 }
|
|
@@ -2801,6 +2808,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;
|
|
@@ -3408,6 +3416,13 @@ begin
|
|
end
|
|
end
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
+procedure TCustomSQLQuery.OnChangeSelectSQL(Sender: TObject);
|
|
|
|
+begin
|
|
|
|
+ if (sqoNoCloseOnSQLChange in Options) then
|
|
|
|
+ exit;
|
|
|
|
+ Close;
|
|
|
|
+end;
|
|
|
|
+
|
|
procedure TCustomSQLQuery.SetMacroChar(AValue: Char);
|
|
procedure TCustomSQLQuery.SetMacroChar(AValue: Char);
|
|
begin
|
|
begin
|
|
FStatement.MacroChar:=AValue;
|
|
FStatement.MacroChar:=AValue;
|