Ver código fonte

Hide previous tabs, change auto commit to commitRetaining
modified: querywindow.lfm
modified: querywindow.lrs
modified: querywindow.pas

motaz 11 anos atrás
pai
commit
0a0e6677a3
3 arquivos alterados com 20 adições e 9 exclusões
  1. 3 3
      querywindow.lfm
  2. 3 3
      querywindow.lrs
  3. 14 3
      querywindow.pas

+ 3 - 3
querywindow.lfm

@@ -17,7 +17,7 @@ object fmQueryWindow: TfmQueryWindow
   OnShow = FormShow
   OnShow = FormShow
   PopupMenu = pmTab
   PopupMenu = pmTab
   Position = poScreenCenter
   Position = poScreenCenter
-  LCLVersion = '1.2.2.0'
+  LCLVersion = '1.2.4.0'
   object Panel1: TPanel
   object Panel1: TPanel
     Left = 0
     Left = 0
     Height = 60
     Height = 60
@@ -192,9 +192,9 @@ object fmQueryWindow: TfmQueryWindow
       end
       end
       object cxAutoCommit: TCheckBox
       object cxAutoCommit: TCheckBox
         Left = 396
         Left = 396
-        Height = 17
+        Height = 24
         Top = 2
         Top = 2
-        Width = 81
+        Width = 116
         Caption = 'Auto Commit'
         Caption = 'Auto Commit'
         Checked = True
         Checked = True
         State = cbChecked
         State = cbChecked

+ 3 - 3
querywindow.lrs

@@ -7,7 +7,7 @@ LazarusResources.Add('TfmQueryWindow','FORMDATA',[
   +'clForm'#10'KeyPreview'#9#4'Menu'#7#9'MainMenu1'#7'OnClose'#7#9'FormClose'#8
   +'clForm'#10'KeyPreview'#9#4'Menu'#7#9'MainMenu1'#7'OnClose'#7#9'FormClose'#8
   +'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#9'OnKeyDown'#7#11
   +'OnCreate'#7#10'FormCreate'#9'OnDestroy'#7#11'FormDestroy'#9'OnKeyDown'#7#11
   +'FormKeyDown'#6'OnShow'#7#8'FormShow'#9'PopupMenu'#7#5'pmTab'#8'Position'#7
   +'FormKeyDown'#6'OnShow'#7#8'FormShow'#9'PopupMenu'#7#5'pmTab'#8'Position'#7
-  +#14'poScreenCenter'#10'LCLVersion'#6#7'1.2.2.0'#0#6'TPanel'#6'Panel1'#4'Left'
+  +#14'poScreenCenter'#10'LCLVersion'#6#7'1.2.4.0'#0#6'TPanel'#6'Panel1'#4'Left'
   +#2#0#6'Height'#2'<'#3'Top'#2#0#5'Width'#3#208#2#5'Align'#7#5'alTop'#12'Clien'
   +#2#0#6'Height'#2'<'#3'Top'#2#0#5'Width'#3#208#2#5'Align'#7#5'alTop'#12'Clien'
   +'tHeight'#2'<'#11'ClientWidth'#3#208#2#5'Color'#7#6'clForm'#11'ParentColor'#8
   +'tHeight'#2'<'#11'ClientWidth'#3#208#2#5'Color'#7#6'clForm'#11'ParentColor'#8
   +#8'TabOrder'#2#1#0#7'TBitBtn'#7'bbClose'#4'Left'#3#180#2#6'Height'#2#24#3'To'
   +#8'TabOrder'#2#1#0#7'TBitBtn'#7'bbClose'#4'Left'#3#180#2#6'Height'#2#24#3'To'
@@ -52,8 +52,8 @@ LazarusResources.Add('TfmQueryWindow','FORMDATA',[
   +'geIndex'#2#10#7'OnClick'#7#24'tbRollbackRetainingClick'#14'ParentShowHint'#8
   +'geIndex'#2#10#7'OnClick'#7#24'tbRollbackRetainingClick'#14'ParentShowHint'#8
   +#8'ShowHint'#9#0#0#11'TToolButton'#11'ToolButton1'#4'Left'#3#130#1#3'Top'#2#2
   +#8'ShowHint'#9#0#0#11'TToolButton'#11'ToolButton1'#4'Left'#3#130#1#3'Top'#2#2
   +#5'Width'#2#10#7'Caption'#6#11'ToolButton1'#5'Style'#7#12'tbsSeparator'#0#0#9
   +#5'Width'#2#10#7'Caption'#6#11'ToolButton1'#5'Style'#7#12'tbsSeparator'#0#0#9
-  +'TCheckBox'#12'cxAutoCommit'#4'Left'#3#140#1#6'Height'#2#17#3'Top'#2#2#5'Wid'
-  +'th'#2'Q'#7'Caption'#6#11'Auto Commit'#7'Checked'#9#5'State'#7#9'cbChecked'#8
+  +'TCheckBox'#12'cxAutoCommit'#4'Left'#3#140#1#6'Height'#2#24#3'Top'#2#2#5'Wid'
+  +'th'#2't'#7'Caption'#6#11'Auto Commit'#7'Checked'#9#5'State'#7#9'cbChecked'#8
   +'TabOrder'#2#0#0#0#0#0#9'TSplitter'#9'Splitter1'#6'Cursor'#7#8'crVSplit'#4'L'
   +'TabOrder'#2#0#0#0#0#0#9'TSplitter'#9'Splitter1'#6'Cursor'#7#8'crVSplit'#4'L'
   +'eft'#2#0#6'Height'#2#12#3'Top'#3'J'#1#5'Width'#3#208#2#5'Align'#7#5'alTop'
   +'eft'#2#0#6'Height'#2#12#3'Top'#3'J'#1#5'Width'#3#208#2#5'Align'#7#5'alTop'
   +#12'ResizeAnchor'#7#5'akTop'#0#0#6'TPanel'#14'pnlOutputPanel'#4'Left'#2#0#6
   +#12'ResizeAnchor'#7#5'akTop'#0#0#6'TPanel'#14'pnlOutputPanel'#4'Left'#2#0#6

+ 14 - 3
querywindow.pas

@@ -203,6 +203,7 @@ type
     procedure EnableApplyButton;
     procedure EnableApplyButton;
     function GetTableName(SQLText: string): string;
     function GetTableName(SQLText: string): string;
     procedure CommitResultClick(Sender: TObject);
     procedure CommitResultClick(Sender: TObject);
+    procedure HidePreviousResultTabs;
   protected
   protected
     // This procedure will receive the events that are logged by the connection:
     // This procedure will receive the events that are logged by the connection:
     procedure GetLogEvent(Sender: TSQLConnection; EventType: TDBEventType; Const Msg : String);
     procedure GetLogEvent(Sender: TSQLConnection; EventType: TDBEventType; Const Msg : String);
@@ -498,6 +499,15 @@ begin
   (Sender as TBitBtn).Visible:= False;
   (Sender as TBitBtn).Visible:= False;
 end;
 end;
 
 
+procedure TfmQueryWindow.HidePreviousResultTabs;
+var
+  i: Integer;
+begin
+  for i:= 0 to ComponentCount - 1 do
+    if (Components[i] is TTabSheet) and ((Components[i] as TControl).Parent = pgOutputPageCtl) then
+      (Components[i] as TTabSheet).TabVisible:= False;
+end;
+
 procedure TfmQueryWindow.GetLogEvent(Sender: TSQLConnection;
 procedure TfmQueryWindow.GetLogEvent(Sender: TSQLConnection;
   EventType: TDBEventType; const Msg: String);
   EventType: TDBEventType; const Msg: String);
 // Used to log everything sent through the connection
 // Used to log everything sent through the connection
@@ -1245,7 +1255,7 @@ begin
 
 
               // Auto commit
               // Auto commit
               if cxAutoCommit.Checked then
               if cxAutoCommit.Checked then
-                FSQLTrans.Commit;
+                FSQLTrans.CommitRetaining;
               FQT.Free;
               FQT.Free;
             end
             end
             else
             else
@@ -1276,7 +1286,7 @@ begin
 
 
                 // Auto commit
                 // Auto commit
                 if cxAutoCommit.Checked then
                 if cxAutoCommit.Checked then
-                  FSQLTrans.Commit;
+                  FSQLTrans.CommitRetaining;
               finally
               finally
                 FQT.Free;
                 FQT.Free;
               end;
               end;
@@ -1402,7 +1412,7 @@ begin
 
 
       // Auto commit
       // Auto commit
       if cxAutoCommit.Checked then
       if cxAutoCommit.Checked then
-        FSQLTrans.Commit;
+        FSQLTrans.CommitRetaining;
 
 
       Result:= True;
       Result:= True;
       meResult.Lines.Text:= FormatDateTime('hh:nn:ss.z', Now) + ' - Script Executed. It took (H:M:S.MS) ' +
       meResult.Lines.Text:= FormatDateTime('hh:nn:ss.z', Now) + ' - Script Executed. It took (H:M:S.MS) ' +
@@ -2039,6 +2049,7 @@ begin
     exit;
     exit;
   end;
   end;
   FStartLine:= 0;
   FStartLine:= 0;
+  HidePreviousResultTabs;
 
 
   // Disable buttons to prevent query interrupt
   // Disable buttons to prevent query interrupt
   tbRun.Enabled:= False;
   tbRun.Enabled:= False;