|
@@ -180,6 +180,7 @@ type
|
|
fmeResult: TMemo;
|
|
fmeResult: TMemo;
|
|
fSqlQuery: TSQLQuery;
|
|
fSqlQuery: TSQLQuery;
|
|
fSqlScript: TSQLScript;
|
|
fSqlScript: TSQLScript;
|
|
|
|
+ // Text for caption
|
|
faText: string;
|
|
faText: string;
|
|
fModifyCount: Integer;
|
|
fModifyCount: Integer;
|
|
fCnt: Integer;
|
|
fCnt: Integer;
|
|
@@ -208,6 +209,7 @@ type
|
|
OnCommit: TNotifyEvent;
|
|
OnCommit: TNotifyEvent;
|
|
procedure Init(dbIndex: Integer);
|
|
procedure Init(dbIndex: Integer);
|
|
function GetQueryType(AQuery: string): TQueryTypes;
|
|
function GetQueryType(AQuery: string): TQueryTypes;
|
|
|
|
+ // Get query text from GUI/memo
|
|
function GetQuery: string;
|
|
function GetQuery: string;
|
|
function CreateResultTab(QueryType: TQueryTypes; var aSqlQuery: TSQLQuery; var aSQLScript: TSqlScript;
|
|
function CreateResultTab(QueryType: TQueryTypes; var aSqlQuery: TSQLQuery; var aSQLScript: TSqlScript;
|
|
var meResult: TMemo; AdditionalTitle: string = ''): TTabSheet;
|
|
var meResult: TMemo; AdditionalTitle: string = ''): TTabSheet;
|
|
@@ -310,15 +312,17 @@ var
|
|
i: Integer;
|
|
i: Integer;
|
|
begin
|
|
begin
|
|
for i:= QueryList.Count - 1 downto 0 do
|
|
for i:= QueryList.Count - 1 downto 0 do
|
|
- if Pos('--', QueryList[i]) > 0 then
|
|
|
|
begin
|
|
begin
|
|
- if Pos('--', Trim(QueryList[i])) = 1 then
|
|
|
|
- QueryList.Delete(i);
|
|
|
|
- {
|
|
|
|
- else
|
|
|
|
- //todo: this will also pick up -- within string literals which is wrong
|
|
|
|
- QueryList[i]:= Copy(QueryList[i], 1, Pos('--', QueryList[i]) - 1);
|
|
|
|
- }
|
|
|
|
|
|
+ if Pos('--', QueryList[i]) > 0 then
|
|
|
|
+ begin
|
|
|
|
+ if Pos('--', Trim(QueryList[i])) = 1 then
|
|
|
|
+ QueryList.Delete(i);
|
|
|
|
+ {
|
|
|
|
+ else
|
|
|
|
+ //todo: this will also pick up -- within string literals which is wrong
|
|
|
|
+ QueryList[i]:= Copy(QueryList[i], 1, Pos('--', QueryList[i]) - 1);
|
|
|
|
+ }
|
|
|
|
+ end;
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
|
|
|
|
@@ -919,7 +923,7 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-{ Run current SQL, 0 for auto-detect type }
|
|
|
|
|
|
+{ Run current SQL, auto-detect type }
|
|
procedure TfmQueryWindow.tbRunClick(Sender: TObject);
|
|
procedure TfmQueryWindow.tbRunClick(Sender: TObject);
|
|
begin
|
|
begin
|
|
CallExecuteQuery(qtUnknown);
|
|
CallExecuteQuery(qtUnknown);
|
|
@@ -1035,9 +1039,9 @@ end;
|
|
|
|
|
|
function TfmQueryWindow.GetQuery: string;
|
|
function TfmQueryWindow.GetQuery: string;
|
|
begin
|
|
begin
|
|
- Result:= meQuery.SelText;
|
|
|
|
|
|
+ Result:= trim(meQuery.SelText);
|
|
if Result = '' then
|
|
if Result = '' then
|
|
- Result:= meQuery.Lines.Text;
|
|
|
|
|
|
+ Result:= trim(meQuery.Lines.Text);
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
@@ -1325,7 +1329,6 @@ begin
|
|
fmeResult.Lines.Add(FormatDateTime('hh:nn:ss.z', Now) + ' - DML Executed. Takes (H:M:S.MS) ' +
|
|
fmeResult.Lines.Add(FormatDateTime('hh:nn:ss.z', Now) + ' - DML Executed. Takes (H:M:S.MS) ' +
|
|
FormatDateTime('HH:nn:ss.z', Now - StartTime));
|
|
FormatDateTime('HH:nn:ss.z', Now - StartTime));
|
|
fmeResult.Lines.Add('Rows affected: ' + Format('%3.0n', [Affected / 1]));
|
|
fmeResult.Lines.Add('Rows affected: ' + Format('%3.0n', [Affected / 1]));
|
|
-
|
|
|
|
end;
|
|
end;
|
|
fmeResult.Lines.Add('----');
|
|
fmeResult.Lines.Add('----');
|
|
fmeResult.Lines.Add(fQueryPart);
|
|
fmeResult.Lines.Add(fQueryPart);
|
|
@@ -1684,7 +1687,7 @@ procedure TfmQueryWindow.FormClose(Sender: TObject;
|
|
begin
|
|
begin
|
|
RemoveControls;
|
|
RemoveControls;
|
|
|
|
|
|
- // Check if the transaction is active commit it
|
|
|
|
|
|
+ // Check if the transaction is active; then commit it
|
|
if fSqlTrans.Active then
|
|
if fSqlTrans.Active then
|
|
begin
|
|
begin
|
|
fSqlTrans.CommitRetaining;
|
|
fSqlTrans.CommitRetaining;
|
|
@@ -2085,12 +2088,12 @@ begin
|
|
end;
|
|
end;
|
|
|
|
|
|
|
|
|
|
-{ Execute query according to passed query ype }
|
|
|
|
|
|
+{ Execute query according to passed query type }
|
|
|
|
|
|
procedure TfmQueryWindow.CallExecuteQuery(aQueryType: TQueryTypes);
|
|
procedure TfmQueryWindow.CallExecuteQuery(aQueryType: TQueryTypes);
|
|
begin
|
|
begin
|
|
// Get query text from memo
|
|
// Get query text from memo
|
|
- fQuery:= Trim(GetQuery);
|
|
|
|
|
|
+ fQuery:= GetQuery;
|
|
fList.Text:= fQuery;
|
|
fList.Text:= fQuery;
|
|
fStartLine:= 0;
|
|
fStartLine:= 0;
|
|
|
|
|