mabudrais 12 anni fa
parent
commit
4354539646
2 ha cambiato i file con 273 aggiunte e 98 eliminazioni
  1. 132 1
      TurboBird.lpi
  2. 141 97
      querywindow.pas

+ 132 - 1
TurboBird.lpi

@@ -60,7 +60,10 @@
         <Filename Value="TurboBird.lpr"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="TurboBird"/>
+<<<<<<< HEAD
         <IsVisibleTab Value="True"/>
+=======
+>>>>>>> upstream/master
         <EditorIndex Value="1"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
@@ -118,6 +121,7 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="QueryWindow"/>
+<<<<<<< HEAD
         <EditorIndex Value="0"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1509"/>
@@ -126,6 +130,17 @@
         <Bookmarks Count="2">
           <Item0 X="3" Y="1007" ID="0"/>
           <Item1 X="3" Y="1829" ID="1"/>
+=======
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="0"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1896"/>
+        <CursorPos X="3" Y="920"/>
+        <UsageCount Value="200"/>
+        <Bookmarks Count="2">
+          <Item0 X="3" Y="1032" ID="0"/>
+          <Item1 X="3" Y="1857" ID="1"/>
+>>>>>>> upstream/master
         </Bookmarks>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
@@ -1106,10 +1121,11 @@
     <JumpHistory Count="30" HistoryIndex="29">
       <Position1>
         <Filename Value="querywindow.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Caret Line="1866" Column="10" TopLine="1861"/>
       </Position1>
       <Position2>
         <Filename Value="querywindow.pas"/>
+<<<<<<< HEAD
         <Caret Line="11" Column="25" TopLine="1"/>
       </Position2>
       <Position3>
@@ -1223,6 +1239,121 @@
       <Position30>
         <Filename Value="querywindow.pas"/>
         <Caret Line="191" Column="15" TopLine="160"/>
+=======
+        <Caret Line="1" Column="1" TopLine="1"/>
+      </Position2>
+      <Position3>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="89" Column="13" TopLine="58"/>
+      </Position3>
+      <Position4>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="91" Column="13" TopLine="60"/>
+      </Position4>
+      <Position5>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="132" Column="23" TopLine="101"/>
+      </Position5>
+      <Position6>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="133" Column="23" TopLine="102"/>
+      </Position6>
+      <Position7>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="168" Column="27" TopLine="137"/>
+      </Position7>
+      <Position8>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="175" Column="24" TopLine="145"/>
+      </Position8>
+      <Position9>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="188" Column="21" TopLine="158"/>
+      </Position9>
+      <Position10>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="190" Column="13" TopLine="159"/>
+      </Position10>
+      <Position11>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="221" Column="35" TopLine="204"/>
+      </Position11>
+      <Position12>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="223" Column="9" TopLine="204"/>
+      </Position12>
+      <Position13>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="225" Column="9" TopLine="204"/>
+      </Position13>
+      <Position14>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="226" Column="9" TopLine="204"/>
+      </Position14>
+      <Position15>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="227" Column="27" TopLine="204"/>
+      </Position15>
+      <Position16>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="228" Column="9" TopLine="204"/>
+      </Position16>
+      <Position17>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="229" Column="9" TopLine="204"/>
+      </Position17>
+      <Position18>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="230" Column="27" TopLine="204"/>
+      </Position18>
+      <Position19>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="231" Column="9" TopLine="204"/>
+      </Position19>
+      <Position20>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="232" Column="32" TopLine="204"/>
+      </Position20>
+      <Position21>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="443" Column="23" TopLine="412"/>
+      </Position21>
+      <Position22>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="483" Column="38" TopLine="451"/>
+      </Position22>
+      <Position23>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="489" Column="58" TopLine="457"/>
+      </Position23>
+      <Position24>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="529" Column="32" TopLine="497"/>
+      </Position24>
+      <Position25>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="531" Column="18" TopLine="499"/>
+      </Position25>
+      <Position26>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="585" Column="23" TopLine="553"/>
+      </Position26>
+      <Position27>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="586" Column="20" TopLine="554"/>
+      </Position27>
+      <Position28>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="588" Column="23" TopLine="556"/>
+      </Position28>
+      <Position29>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="589" Column="20" TopLine="557"/>
+      </Position29>
+      <Position30>
+        <Filename Value="querywindow.pas"/>
+        <Caret Line="655" Column="34" TopLine="623"/>
+>>>>>>> upstream/master
       </Position30>
     </JumpHistory>
   </ProjectOptions>

+ 141 - 97
querywindow.pas

@@ -663,31 +663,38 @@ begin
   RemoveControls;
   ATab:= CreateResultTab(2, SqlQuery, SqlScript, meResult);
   QT:= TQueryThread.Create('commit');
-  QT.Trans:= SqlTrans;
-  ATab.ImageIndex:= 6;
-  QT.Resume;
-  repeat
-    application.ProcessMessages;
-  until QT.fTerminated;
+  try
+    QT.Trans:= SqlTrans;
+    ATab.ImageIndex:= 6;
 
-  if QT.Error then
-  begin
-    ATab.ImageIndex:= 3;
-    meResult.Lines.Text:= QT.ErrorMsg;
-    meResult.Font.Color:= clRed;
-  end
-  else
-  begin
-    ATab.ImageIndex:= 4;
-    meResult.Lines.Add('Commited');
-    meResult.Font.Color:= clGreen;
+    // Run thread
+    QT.Resume;
+    repeat
+      application.ProcessMessages;
+    until QT.fTerminated;
 
-    // Call OnCommit procedure if assigned, it is used to refresh table management view
-    if OnCommit <> nil then
-      OnCommit(self);
-    OnCommit:= nil;
+    if QT.Error then
+    begin
+      ATab.ImageIndex:= 3;
+      meResult.Lines.Text:= QT.ErrorMsg;
+      meResult.Font.Color:= clRed;
+    end
+    else
+    begin
+      ATab.ImageIndex:= 4;
+      meResult.Lines.Add('Commited');
+      meResult.Font.Color:= clGreen;
+
+      // Call OnCommit procedure if assigned, it is used to refresh table management view
+      if OnCommit <> nil then
+        OnCommit(self);
+      OnCommit:= nil;
+    end;
+
+  finally
+    QT.Free;
   end;
-  QT.Free;
+
 end;
 
 procedure TfmQueryWindow.tbCommitRetainingClick(Sender: TObject);
@@ -695,23 +702,28 @@ var
   QT: TQueryThread;
 begin
   QT:= TQueryThread.Create('commitret');
-  QT.Trans:= SqlTrans;
-  QT.Resume;
-  repeat
-    application.ProcessMessages;
-  until QT.fTerminated;
+  try
+    QT.Trans:= SqlTrans;
 
-  if QT.Error then
-    ShowMessage(QT.ErrorMsg)
-  else
-  begin
-    // Call OnCommit procedure if assigned, it is used to refresh table management view
-    if OnCommit <> nil then
-      OnCommit(self);
-    OnCommit:= nil;
+    // Run thread
+    QT.Resume;
+    repeat
+      application.ProcessMessages;
+    until QT.fTerminated;
 
+    if QT.Error then
+      ShowMessage(QT.ErrorMsg)
+    else
+    begin
+      // Call OnCommit procedure if assigned, it is used to refresh table management view
+      if OnCommit <> nil then
+        OnCommit(self);
+      OnCommit:= nil;
+    end;
+
+  finally
+    QT.Free;
   end;
-  QT.Free;
 end;
 
 procedure TfmQueryWindow.tbHistoryClick(Sender: TObject);
@@ -758,30 +770,34 @@ begin
   RemoveControls;
   ATab:= CreateResultTab(2, SqlQuery, SqlScript, meResult);
   QT:= TQueryThread.Create('rollback');
-  QT.Trans:= SqlTrans;
-  ATab.ImageIndex:= 6;
-  QT.Resume;
-  repeat
-    application.ProcessMessages;
-  until QT.fTerminated;
+  try
+    QT.Trans:= SqlTrans;
+    ATab.ImageIndex:= 6;
+    QT.Resume;
+    repeat
+      application.ProcessMessages;
+    until QT.fTerminated;
+
+    if QT.Error then
+    begin
+      ATab.ImageIndex:= 3;
+      meResult.Lines.Text:= QT.ErrorMsg;
+      meResult.Font.Color:= clRed;
+    end
+    else
+    begin
+      ATab.ImageIndex:= 4;
+      meResult.Lines.Add('Rollback');
+      meResult.Font.Color:= clGreen;
+      if OnCommit <> nil then
+        OnCommit(self);
+      OnCommit:= nil;
+      meResult.Font.Color:= $AA6666;
+    end;
 
-  if QT.Error then
-  begin
-    ATab.ImageIndex:= 3;
-    meResult.Lines.Text:= QT.ErrorMsg;
-    meResult.Font.Color:= clRed;
-  end
-  else
-  begin
-    ATab.ImageIndex:= 4;
-    meResult.Lines.Add('Rollback');
-    meResult.Font.Color:= clGreen;
-    if OnCommit <> nil then
-      OnCommit(self);
-    OnCommit:= nil;
-    meResult.Font.Color:= $AA6666;
+  finally
+    QT.Free;
   end;
-  QT.Free;
 end;
 
 procedure TfmQueryWindow.tbRollbackRetainingClick(Sender: TObject);
@@ -789,14 +805,19 @@ var
   QT: TQueryThread;
 begin
   QT:= TQueryThread.Create('rollbackret');
-  QT.Trans:= SqlTrans;
-  QT.Resume;
-  repeat
-    application.ProcessMessages;
-  until QT.fTerminated or (fCanceled);
-  if QT.Error then
-    ShowMessage(QT.ErrorMsg);
-  QT.Free;
+  try
+    QT.Trans:= SqlTrans;
+
+    QT.Resume;
+    repeat
+      application.ProcessMessages;
+    until QT.fTerminated or (fCanceled);
+    if QT.Error then
+      ShowMessage(QT.ErrorMsg);
+
+  finally
+    QT.Free;
+  end;
 
 end;
 
@@ -859,43 +880,47 @@ var
   StartPos, EndPos: Integer;
 begin
   List:= TStringList.Create;
-  List.Text:= AQuery;
+  try
+    List.Text:= AQuery;
 
-  Result:= 2; // Default Execute
+    Result:= 2; // Default Execute
 
-  for i:= 0 to List.Count - 1 do
-  begin
-    Line:= List[i];
-    // Remove comments
-    if Pos('--', Line) > 0 then
-      Line:= Copy(Line, 1, Pos('--', Line) - 1);
-    if (Pos('/*', Line) > 0) and (Pos('*/', Line) > 0) then
+    for i:= 0 to List.Count - 1 do
     begin
-      StartPos:= (Pos('/*', Line));
-      EndPos:= (Pos('*/', Line));
-      Delete(Line, StartPos, EndPos - StartPos + 1);
-    end;
+      Line:= List[i];
+      // Remove comments
+      if Pos('--', Line) > 0 then
+        Line:= Copy(Line, 1, Pos('--', Line) - 1);
+      if (Pos('/*', Line) > 0) and (Pos('*/', Line) > 0) then
+      begin
+        StartPos:= (Pos('/*', Line));
+        EndPos:= (Pos('*/', Line));
+        Delete(Line, StartPos, EndPos - StartPos + 1);
+      end;
 
-    if (Pos('select', LowerCase(Trim(Line))) = 1) then
-    begin
-      Result:= 1; // Selectable
-      Break;
-    end
-    else
-    if Pos('setterm', LowerCase(StringReplace(Line, ' ', '', [rfReplaceAll]))) = 1 then
-    begin
-      Result:= 3;
-      Break;
-    end;
+      if (Pos('select', LowerCase(Trim(Line))) = 1) then
+      begin
+        Result:= 1; // Selectable
+        Break;
+      end
+      else
+      if Pos('setterm', LowerCase(StringReplace(Line, ' ', '', [rfReplaceAll]))) = 1 then
+      begin
+        Result:= 3;
+        Break;
+      end;
+
+      if Trim(Line) <> '' then
+      begin
+        Result:= 2; // Executable
+        Break;
+      end;
 
-    if Trim(Line) <> '' then
-    begin
-      Result:= 2; // Executable
-      Break;
     end;
 
+  finally
+    List.Free;
   end;
-  List.Free;
 end;
 
 function TfmQueryWindow.GetQuery: string;
@@ -1517,9 +1542,10 @@ end;
 
 procedure TfmQueryWindow.FormCreate(Sender: TObject);
 var
-F:TextFile;
-str:string;
+  F:TextFile;
+  str:string;
 begin
+<<<<<<< HEAD
   if FileExists('querycomplition.txt') then
   begin
     AssignFile(F,'querycomplition.txt');
@@ -1533,6 +1559,24 @@ begin
   end
   else
     SynCompletion1.ItemList.CommaText:= 'create,table,Select,From,INTEGER,FLOAT';
+=======
+  if FileExists('querycompletion.txt') then
+  begin
+    AssignFile(F,'querycompletion.txt');
+    Reset(F);
+    while not EOF(F) do
+    begin
+      ReadLn(F,str);
+      SynCompletion1.ItemList.Add(str);
+    end;
+    CloseFile(F);
+  end
+  else
+  begin
+    SynCompletion1.ItemList.CommaText:= 'create,table,Select,From,INTEGER,FLOAT';
+    SynCompletion1.ItemList.SaveToFile('querycompletion.txt');
+  end;
+>>>>>>> upstream/master
 
 end;