Explorar o código

Change create new table, generator method
modified: TurboBird.lpi
modified: TurboBird.lpr
modified: main.lfm
modified: main.lrs
modified: main.pas
modified: newgen.lfm
modified: newgen.lrs
modified: newgen.pas
modified: newtable.lfm
modified: newtable.lrs
modified: newtable.pas

Motaz Abdel Azeem %!s(int64=13) %!d(string=hai) anos
pai
achega
4de592b4c5
Modificáronse 11 ficheiros con 1858 adicións e 2828 borrados
  1. 93 89
      TurboBird.lpi
  2. 1 1
      TurboBird.lpr
  3. 13 1
      main.lfm
  4. 1564 1562
      main.lrs
  5. 5 7
      main.pas
  6. 22 59
      newgen.lfm
  7. 27 36
      newgen.lrs
  8. 40 53
      newgen.pas
  9. 29 800
      newtable.lfm
  10. 30 190
      newtable.lrs
  11. 34 30
      newtable.pas

+ 93 - 89
TurboBird.lpi

@@ -60,7 +60,8 @@
         <Filename Value="TurboBird.lpr"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="TurboBird"/>
-        <EditorIndex Value="9"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="11"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="25" Y="5"/>
@@ -75,8 +76,8 @@
         <UnitName Value="main"/>
         <EditorIndex Value="1"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="341"/>
-        <CursorPos X="3" Y="348"/>
+        <TopLine Value="1179"/>
+        <CursorPos X="1" Y="1194"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
@@ -98,7 +99,7 @@
         <ComponentName Value="fmReg"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="Reg"/>
-        <EditorIndex Value="11"/>
+        <EditorIndex Value="13"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="22" Y="269"/>
@@ -119,10 +120,10 @@
         <ComponentName Value="fmQueryWindow"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="QueryWindow"/>
-        <EditorIndex Value="7"/>
+        <EditorIndex Value="9"/>
         <WindowIndex Value="0"/>
         <TopLine Value="155"/>
-        <CursorPos X="3" Y="162"/>
+        <CursorPos X="32" Y="161"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
@@ -167,7 +168,7 @@
         <ComponentName Value="fmViewTrigger"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="ViewTrigger"/>
-        <EditorIndex Value="6"/>
+        <EditorIndex Value="8"/>
         <WindowIndex Value="0"/>
         <TopLine Value="19"/>
         <CursorPos X="72" Y="27"/>
@@ -203,10 +204,13 @@
         <ComponentName Value="fmNewTable"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="NewTable"/>
+        <EditorIndex Value="3"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="163"/>
-        <CursorPos X="58" Y="171"/>
+        <TopLine Value="214"/>
+        <CursorPos X="33" Y="228"/>
         <UsageCount Value="200"/>
+        <Loaded Value="True"/>
+        <LoadedDesigner Value="True"/>
       </Unit13>
       <Unit14>
         <Filename Value="newgen.pas"/>
@@ -214,9 +218,10 @@
         <ComponentName Value="fmNewGen"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="NewGen"/>
+        <EditorIndex Value="2"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="90"/>
-        <CursorPos X="20" Y="90"/>
+        <TopLine Value="54"/>
+        <CursorPos X="56" Y="57"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
@@ -418,7 +423,7 @@
         <ComponentName Value="fmUDFInfo"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="UDFInfo"/>
-        <EditorIndex Value="3"/>
+        <EditorIndex Value="5"/>
         <WindowIndex Value="0"/>
         <TopLine Value="12"/>
         <CursorPos X="29" Y="29"/>
@@ -432,7 +437,7 @@
         <ComponentName Value="fmViewDomain"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="ViewDomain"/>
-        <EditorIndex Value="5"/>
+        <EditorIndex Value="7"/>
         <WindowIndex Value="0"/>
         <TopLine Value="12"/>
         <CursorPos X="24" Y="17"/>
@@ -543,12 +548,11 @@
         <Filename Value="scriptdb.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Scriptdb"/>
-        <IsVisibleTab Value="True"/>
-        <EditorIndex Value="2"/>
+        <EditorIndex Value="4"/>
         <WindowIndex Value="0"/>
         <TopLine Value="433"/>
         <CursorPos X="49" Y="453"/>
-        <UsageCount Value="194"/>
+        <UsageCount Value="196"/>
         <Loaded Value="True"/>
       </Unit51>
       <Unit52>
@@ -566,11 +570,11 @@
         <ComponentName Value="fmUserPermissions"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="UserPermissions"/>
-        <EditorIndex Value="8"/>
+        <EditorIndex Value="10"/>
         <WindowIndex Value="0"/>
         <TopLine Value="6"/>
         <CursorPos X="8" Y="34"/>
-        <UsageCount Value="170"/>
+        <UsageCount Value="172"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
       </Unit53>
@@ -591,7 +595,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="303"/>
         <CursorPos X="53" Y="310"/>
-        <UsageCount Value="153"/>
+        <UsageCount Value="155"/>
       </Unit55>
       <Unit56>
         <Filename Value="/usr/lib/lazarus/0.9.29/lcl/grids.pas"/>
@@ -634,16 +638,16 @@
         <WindowIndex Value="0"/>
         <TopLine Value="13"/>
         <CursorPos X="22" Y="54"/>
-        <UsageCount Value="139"/>
+        <UsageCount Value="141"/>
       </Unit60>
       <Unit61>
         <Filename Value="unitfirebirdservices.pas"/>
         <UnitName Value="UnitFirebirdServices"/>
-        <EditorIndex Value="12"/>
+        <EditorIndex Value="14"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="1" Y="1"/>
-        <UsageCount Value="21"/>
+        <UsageCount Value="22"/>
         <Loaded Value="True"/>
       </Unit61>
       <Unit62>
@@ -702,7 +706,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="3"/>
         <CursorPos X="71" Y="7"/>
-        <UsageCount Value="109"/>
+        <UsageCount Value="111"/>
       </Unit68>
       <Unit69>
         <Filename Value="changepass.pas"/>
@@ -713,7 +717,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="3"/>
         <CursorPos X="88" Y="14"/>
-        <UsageCount Value="108"/>
+        <UsageCount Value="110"/>
       </Unit69>
       <Unit70>
         <Filename Value="permissionmanage.pas"/>
@@ -724,7 +728,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="61"/>
         <CursorPos X="44" Y="83"/>
-        <UsageCount Value="106"/>
+        <UsageCount Value="108"/>
       </Unit70>
       <Unit71>
         <Filename Value="sqlhistory.pas"/>
@@ -735,7 +739,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="18" Y="39"/>
-        <UsageCount Value="91"/>
+        <UsageCount Value="93"/>
       </Unit71>
       <Unit72>
         <Filename Value="../../lazarus/lazarus/lcl/include/menuitem.inc"/>
@@ -760,7 +764,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="30"/>
         <CursorPos X="1" Y="151"/>
-        <UsageCount Value="62"/>
+        <UsageCount Value="64"/>
       </Unit74>
       <Unit75>
         <Filename Value="/usr/lib/lazarus/0.9.30/lcl/comctrls.pp"/>
@@ -949,11 +953,11 @@
         <ComponentName Value="fmDBInfo"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="dbInfo"/>
-        <EditorIndex Value="4"/>
+        <EditorIndex Value="6"/>
         <WindowIndex Value="0"/>
         <TopLine Value="20"/>
         <CursorPos X="22" Y="41"/>
-        <UsageCount Value="30"/>
+        <UsageCount Value="32"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
       </Unit98>
@@ -975,134 +979,134 @@
       <Unit101>
         <Filename Value="../FreeSpider/spiderutils.pas"/>
         <UnitName Value="SpiderUtils"/>
-        <EditorIndex Value="10"/>
+        <EditorIndex Value="12"/>
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="1" Y="1"/>
-        <UsageCount Value="10"/>
+        <UsageCount Value="11"/>
         <Loaded Value="True"/>
       </Unit101>
     </Units>
     <JumpHistory Count="30" HistoryIndex="29">
       <Position1>
-        <Filename Value="main.pas"/>
-        <Caret Line="2613" Column="36" TopLine="2606"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="228" Column="3" TopLine="225"/>
       </Position1>
       <Position2>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="227" Column="3" TopLine="224"/>
       </Position2>
       <Position3>
-        <Filename Value="main.pas"/>
-        <Caret Line="2615" Column="36" TopLine="2608"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="226" Column="3" TopLine="223"/>
       </Position3>
       <Position4>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="225" Column="3" TopLine="222"/>
       </Position4>
       <Position5>
-        <Filename Value="main.pas"/>
-        <Caret Line="2615" Column="36" TopLine="2608"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="224" Column="3" TopLine="221"/>
       </Position5>
       <Position6>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="223" Column="3" TopLine="220"/>
       </Position6>
       <Position7>
-        <Filename Value="main.pas"/>
-        <Caret Line="2615" Column="36" TopLine="2608"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="201" Column="1" TopLine="176"/>
       </Position7>
       <Position8>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="114" Column="1" TopLine="99"/>
       </Position8>
       <Position9>
-        <Filename Value="main.pas"/>
-        <Caret Line="2613" Column="36" TopLine="2606"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="116" Column="1" TopLine="101"/>
       </Position9>
       <Position10>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="156" Column="1" TopLine="146"/>
       </Position10>
       <Position11>
-        <Filename Value="main.pas"/>
-        <Caret Line="2613" Column="36" TopLine="2606"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="186" Column="56" TopLine="171"/>
       </Position11>
       <Position12>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="23" Column="1" TopLine="8"/>
       </Position12>
       <Position13>
-        <Filename Value="main.pas"/>
-        <Caret Line="2613" Column="36" TopLine="2606"/>
+        <Filename Value="newtable.pas"/>
+        <Caret Line="147" Column="1" TopLine="143"/>
       </Position13>
       <Position14>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="79" Column="32" TopLine="70"/>
       </Position14>
       <Position15>
-        <Filename Value="main.pas"/>
-        <Caret Line="2615" Column="36" TopLine="2608"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="56" Column="3" TopLine="54"/>
       </Position15>
       <Position16>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="55" Column="3" TopLine="53"/>
       </Position16>
       <Position17>
-        <Filename Value="main.pas"/>
-        <Caret Line="2615" Column="36" TopLine="2608"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="54" Column="3" TopLine="52"/>
       </Position17>
       <Position18>
-        <Filename Value="main.pas"/>
-        <Caret Line="2614" Column="36" TopLine="2607"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="53" Column="3" TopLine="51"/>
       </Position18>
       <Position19>
-        <Filename Value="main.pas"/>
-        <Caret Line="2613" Column="36" TopLine="2606"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="89" Column="3" TopLine="87"/>
       </Position19>
       <Position20>
-        <Filename Value="about.pas"/>
-        <Caret Line="19" Column="37" TopLine="9"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="149" Column="1" TopLine="109"/>
       </Position20>
       <Position21>
-        <Filename Value="main.pas"/>
-        <Caret Line="2609" Column="19" TopLine="2606"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="81" Column="1" TopLine="58"/>
       </Position21>
       <Position22>
-        <Filename Value="main.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="88" Column="1" TopLine="75"/>
       </Position22>
       <Position23>
-        <Filename Value="main.pas"/>
-        <Caret Line="2184" Column="1" TopLine="2179"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="94" Column="30" TopLine="79"/>
       </Position23>
       <Position24>
-        <Filename Value="main.pas"/>
-        <Caret Line="346" Column="39" TopLine="334"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="28" Column="1" TopLine="13"/>
       </Position24>
       <Position25>
         <Filename Value="main.pas"/>
-        <Caret Line="351" Column="1" TopLine="334"/>
+        <Caret Line="1450" Column="1" TopLine="1454"/>
       </Position25>
       <Position26>
         <Filename Value="main.pas"/>
-        <Caret Line="358" Column="1" TopLine="341"/>
+        <Caret Line="1196" Column="1" TopLine="1179"/>
       </Position26>
       <Position27>
-        <Filename Value="main.pas"/>
-        <Caret Line="356" Column="1" TopLine="336"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="118" Column="1" TopLine="95"/>
       </Position27>
       <Position28>
-        <Filename Value="main.pas"/>
-        <Caret Line="338" Column="3" TopLine="336"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="117" Column="27" TopLine="98"/>
       </Position28>
       <Position29>
-        <Filename Value="main.pas"/>
-        <Caret Line="348" Column="3" TopLine="341"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="47" Column="21" TopLine="31"/>
       </Position29>
       <Position30>
-        <Filename Value="scriptdb.pas"/>
-        <Caret Line="535" Column="3" TopLine="527"/>
+        <Filename Value="newgen.pas"/>
+        <Caret Line="46" Column="21" TopLine="30"/>
       </Position30>
     </JumpHistory>
   </ProjectOptions>

+ 1 - 1
TurboBird.lpr

@@ -2,7 +2,7 @@
 {  TurboBird: FireBird database administration and management tool          }
 {  Developed by: Motaz Abdel Azeem http://code.sd/                          }
 {  Start development:  5.Dec.2009                                           }
-{  Last updated     : 19.Apr.2012                                           }
+{  Last updated     : 21.Apr.2012                                           }
 {  License          : GPL for GUI, LGPL for Units                           }
 {***************************************************************************}
 

+ 13 - 1
main.lfm

@@ -8,6 +8,7 @@ object fmMain: TfmMain
   ClientHeight = 615
   ClientWidth = 1024
   Color = clWhite
+  Font.Name = 'Sans'
   Menu = MainMenu1
   OnActivate = FormActivate
   OnClose = FormClose
@@ -54,6 +55,8 @@ object fmMain: TfmMain
     BorderSpacing.Bottom = 2
     BorderSpacing.Around = 2
     BorderSpacing.InnerBorder = 1
+    Font.Name = 'Sans'
+    ParentFont = False
     TabIndex = 0
     TabOrder = 2
     OnCloseTabClicked = PageControl1CloseTabClicked
@@ -61,8 +64,11 @@ object fmMain: TfmMain
     object TabSheet1: TTabSheet
       BorderWidth = 1
       Caption = 'Main'
-      ClientHeight = 577
+      ClientHeight = 578
       ClientWidth = 640
+      Font.Color = clNavy
+      Font.Name = 'Arial'
+      ParentFont = False
       object bbRestoreDB: TBitBtn
         Left = 3
         Height = 93
@@ -70,6 +76,7 @@ object fmMain: TfmMain
         Width = 208
         Caption = 'Restore Database'
         Color = clCream
+        Font.Name = 'Sans'
         Glyph.Data = {
           36100000424D3610000000000000360000002800000020000000200000000100
           2000000000000010000064000000640000000000000000000000FFFFFF00FFFF
@@ -203,6 +210,7 @@ object fmMain: TfmMain
           FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
         }
         OnClick = mnRestoreClick
+        ParentFont = False
         TabOrder = 0
       end
       object bbRegisterDB: TBitBtn
@@ -212,6 +220,7 @@ object fmMain: TfmMain
         Width = 208
         Caption = 'Register Database'
         Color = clCream
+        Font.Name = 'Sans'
         Glyph.Data = {
           36100000424D3610000000000000360000002800000020000000200000000100
           2000000000000010000064000000640000000000000000000000FFFFFF00FFFF
@@ -345,6 +354,7 @@ object fmMain: TfmMain
           FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
         }
         OnClick = mnRegDBClick
+        ParentFont = False
         TabOrder = 1
       end
       object bbCreateNewDB: TBitBtn
@@ -354,6 +364,7 @@ object fmMain: TfmMain
         Width = 208
         Caption = 'Create new Database'
         Color = clCream
+        Font.Name = 'Asans'
         Glyph.Data = {
           36100000424D3610000000000000360000002800000020000000200000000100
           2000000000000010000064000000640000000000000000000000FFFFFF00FFFF
@@ -487,6 +498,7 @@ object fmMain: TfmMain
           FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00
         }
         OnClick = mnCreateDBClick
+        ParentFont = False
         TabOrder = 2
       end
     end

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1564 - 1562
main.lrs


+ 5 - 7
main.pas

@@ -1190,10 +1190,6 @@ var
 begin
   Rec:= RegisteredDatabases[DatabaseIndex];
 
-  TableNames:= dmSysTables.GetDBObjectNames(DatabaseIndex, 1, Count);
-  fmNewGen.DatabaseIndex:= DatabaseIndex;
-
-  fmNewGen.cbTables.Items.CommaText:= TableNames;
   fmNewGen.Init(DatabaseIndex);
 end;
 
@@ -1451,11 +1447,12 @@ begin
   Rec:= RegisteredDatabases[dbIndex];
 
   fmNewTable.Init(dbIndex);
-  if fmNewTable.ShowModal = mrOK then
+  fmNewTable.ShowModal;
+  {= mrOK then
     if fmNewTable.cxCreateGen.Checked then // Create Auto Inc generator
     begin
       InitNewGen(dbIndex);
-      fmNewGen.edGenName.Text:= fmNewTable.GeneratorName;
+      fmNewGen.edGenName.Text:= GeneratorName;
       fmNewGen.edGenName.Enabled:= True;
       fmNewGen.cxTrigger.Checked:= True;
 
@@ -1465,7 +1462,7 @@ begin
       fmNewGen.gbTrigger.Enabled:= False;
       fmNewGen.cxTrigger.Enabled:= False;
       fmNewGen.Show;
-    end;
+    end;}
 end;
 
 (*************  Create new function  ******************)
@@ -2628,6 +2625,7 @@ begin
     Result.Left:= 0;
     Result.Top:= 0;
     Result.Align:= alClient;
+    Result.Font.Name:= 'Arial';
   end
   else
     ATab:= Result.Parent as TTabSheet;

+ 22 - 59
newgen.lfm

@@ -1,19 +1,19 @@
 object fmNewGen: TfmNewGen
   Left = 362
-  Height = 495
+  Height = 250
   Top = 201
-  Width = 542
+  Width = 518
   ActiveControl = edGenName
   Caption = 'Create New Generator'
-  ClientHeight = 495
-  ClientWidth = 542
+  ClientHeight = 250
+  ClientWidth = 518
   Position = poScreenCenter
   LCLVersion = '0.9.31'
   object Label1: TLabel
     Left = 5
     Height = 18
     Top = 23
-    Width = 109
+    Width = 113
     Caption = 'Generator Name'
     ParentColor = False
   end
@@ -27,19 +27,19 @@ object fmNewGen: TfmNewGen
   object bbCreateGen: TBitBtn
     Left = 8
     Height = 30
-    Top = 82
-    Width = 160
+    Top = 217
+    Width = 120
     Anchors = [akLeft, akBottom]
-    Caption = 'Create Generator'
+    Caption = 'Script'
     Color = 16249563
     Kind = bkAll
     OnClick = bbCreateGenClick
     TabOrder = 1
   end
   object BitBtn1: TBitBtn
-    Left = 416
+    Left = 408
     Height = 30
-    Top = 464
+    Top = 217
     Width = 99
     Anchors = [akLeft, akBottom]
     Caption = '&Close'
@@ -48,30 +48,30 @@ object fmNewGen: TfmNewGen
     TabOrder = 2
   end
   object cxTrigger: TCheckBox
-    Left = 14
+    Left = 8
     Height = 22
-    Top = 112
-    Width = 115
-    Caption = 'Create Trigger'
+    Top = 64
+    Width = 320
+    Caption = 'Create Auto increment Trigger for generator'
     OnChange = cxTriggerChange
     TabOrder = 3
   end
   object gbTrigger: TGroupBox
-    Left = 16
-    Height = 319
-    Top = 135
-    Width = 502
+    Left = 10
+    Height = 116
+    Top = 93
+    Width = 494
     Anchors = [akTop, akLeft, akRight, akBottom]
     Caption = 'Trigger for generator'
-    ClientHeight = 300
-    ClientWidth = 498
+    ClientHeight = 97
+    ClientWidth = 490
     Enabled = False
     TabOrder = 4
     object Label2: TLabel
       Left = 6
       Height = 18
       Top = 10
-      Width = 56
+      Width = 58
       Caption = 'On table'
       ParentColor = False
     end
@@ -79,7 +79,7 @@ object fmNewGen: TfmNewGen
       Left = 9
       Height = 18
       Top = 53
-      Width = 32
+      Width = 34
       Caption = 'Field'
       ParentColor = False
     end
@@ -102,42 +102,5 @@ object fmNewGen: TfmNewGen
       Style = csDropDownList
       TabOrder = 1
     end
-    object BitBtn2: TBitBtn
-      Left = 6
-      Height = 30
-      Top = 94
-      Width = 75
-      Caption = 'Script'
-      Color = 16249563
-      OnClick = BitBtn2Click
-      TabOrder = 2
-    end
-    object bbCreateTrigger: TBitBtn
-      Left = 5
-      Height = 30
-      Top = 267
-      Width = 131
-      Caption = 'Create Trigger'
-      Color = 16249563
-      OnClick = bbCreateTriggerClick
-      TabOrder = 3
-    end
-    object meSQL: TMemo
-      Left = 6
-      Height = 139
-      Top = 126
-      Width = 477
-      Anchors = [akTop, akLeft, akRight, akBottom]
-      ScrollBars = ssBoth
-      TabOrder = 4
-    end
-  end
-  object SQLQuery1: TSQLQuery
-    IndexName = 'DEFAULT_ORDER'
-    AutoCalcFields = False
-    ReadOnly = False
-    Params = <>
-    left = 316
-    top = 176
   end
 end

+ 27 - 36
newgen.lrs

@@ -1,40 +1,31 @@
 { This is an automatically generated lazarus resource file }
 
 LazarusResources.Add('TfmNewGen','FORMDATA',[
-  'TPF0'#9'TfmNewGen'#8'fmNewGen'#4'Left'#3'j'#1#6'Height'#3#239#1#3'Top'#3#201
-  +#0#5'Width'#3#30#2#13'ActiveControl'#7#9'edGenName'#7'Caption'#6#20'Create N'
-  +'ew Generator'#12'ClientHeight'#3#239#1#11'ClientWidth'#3#30#2#8'Position'#7
-  +#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TLabel'#6'Label1'#4'Left'
-  +#2#5#6'Height'#2#18#3'Top'#2#23#5'Width'#2'm'#7'Caption'#6#14'Generator Name'
-  +#11'ParentColor'#8#0#0#5'TEdit'#9'edGenName'#4'Left'#3#128#0#6'Height'#2#27#3
-  +'Top'#2#16#5'Width'#3#168#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#11'bbCreateGen'#4
-  +'Left'#2#8#6'Height'#2#30#3'Top'#2'R'#5'Width'#3#160#0#7'Anchors'#11#6'akLef'
-  +'t'#8'akBottom'#0#7'Caption'#6#16'Create Generator'#5'Color'#4#219#242#247#0
-  +#4'Kind'#7#5'bkAll'#7'OnClick'#7#16'bbCreateGenClick'#8'TabOrder'#2#1#0#0#7
-  +'TBitBtn'#7'BitBtn1'#4'Left'#3#160#1#6'Height'#2#30#3'Top'#3#208#1#5'Width'#2
-  +'c'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'&Close'#5'Color'#4
-  +#219#242#247#0#4'Kind'#7#7'bkClose'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9'cxTri'
-  +'gger'#4'Left'#2#14#6'Height'#2#22#3'Top'#2'p'#5'Width'#2's'#7'Caption'#6#14
-  +'Create Trigger'#8'OnChange'#7#15'cxTriggerChange'#8'TabOrder'#2#3#0#0#9'TGr'
-  +'oupBox'#9'gbTrigger'#4'Left'#2#16#6'Height'#3'?'#1#3'Top'#3#135#0#5'Width'#3
-  +#246#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Caption'#6
-  +#21'Trigger for generator'#12'ClientHeight'#3','#1#11'ClientWidth'#3#242#1#7
-  +'Enabled'#8#8'TabOrder'#2#4#0#6'TLabel'#6'Label2'#4'Left'#2#6#6'Height'#2#18
-  +#3'Top'#2#10#5'Width'#2'8'#7'Caption'#6#8'On table'#11'ParentColor'#8#0#0#6
-  +'TLabel'#6'Label3'#4'Left'#2#9#6'Height'#2#18#3'Top'#2'5'#5'Width'#2' '#7'Ca'
-  +'ption'#6#5'Field'#11'ParentColor'#8#0#0#9'TComboBox'#8'cbTables'#4'Left'#2
-  +'V'#6'Height'#2#31#3'Top'#2#7#5'Width'#3#152#0#10'ItemHeight'#2#0#8'OnChange'
-  +#7#14'cbTablesChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0#0#0#9'TC'
-  +'omboBox'#8'cbFields'#4'Left'#2'W'#6'Height'#2#31#3'Top'#2'0'#5'Width'#3#151
-  +#0#10'ItemHeight'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1#0#0#7'TB'
-  +'itBtn'#7'BitBtn2'#4'Left'#2#6#6'Height'#2#30#3'Top'#2'^'#5'Width'#2'K'#7'Ca'
-  +'ption'#6#6'Script'#5'Color'#4#219#242#247#0#7'OnClick'#7#12'BitBtn2Click'#8
-  +'TabOrder'#2#2#0#0#7'TBitBtn'#15'bbCreateTrigger'#4'Left'#2#5#6'Height'#2#30
-  +#3'Top'#3#11#1#5'Width'#3#131#0#7'Caption'#6#14'Create Trigger'#5'Color'#4
-  +#219#242#247#0#7'OnClick'#7#20'bbCreateTriggerClick'#8'TabOrder'#2#3#0#0#5'T'
-  +'Memo'#5'meSQL'#4'Left'#2#6#6'Height'#3#139#0#3'Top'#2'~'#5'Width'#3#221#1#7
-  +'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#10'ScrollBars'#7#6
-  +'ssBoth'#8'TabOrder'#2#4#0#0#0#9'TSQLQuery'#9'SQLQuery1'#9'IndexName'#6#13'D'
-  +'EFAULT_ORDER'#14'AutoCalcFields'#8#8'ReadOnly'#8#6'Params'#14#0#4'left'#3'<'
-  +#1#3'top'#3#176#0#0#0#0
+  'TPF0'#9'TfmNewGen'#8'fmNewGen'#4'Left'#3'j'#1#6'Height'#3#250#0#3'Top'#3#201
+  +#0#5'Width'#3#6#2#13'ActiveControl'#7#9'edGenName'#7'Caption'#6#20'Create Ne'
+  +'w Generator'#12'ClientHeight'#3#250#0#11'ClientWidth'#3#6#2#8'Position'#7#14
+  +'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TLabel'#6'Label1'#4'Left'#2#5
+  +#6'Height'#2#18#3'Top'#2#23#5'Width'#2'q'#7'Caption'#6#14'Generator Name'#11
+  +'ParentColor'#8#0#0#5'TEdit'#9'edGenName'#4'Left'#3#128#0#6'Height'#2#27#3'T'
+  +'op'#2#16#5'Width'#3#168#0#8'TabOrder'#2#0#0#0#7'TBitBtn'#11'bbCreateGen'#4
+  +'Left'#2#8#6'Height'#2#30#3'Top'#3#217#0#5'Width'#2'x'#7'Anchors'#11#6'akLef'
+  +'t'#8'akBottom'#0#7'Caption'#6#6'Script'#5'Color'#4#219#242#247#0#4'Kind'#7#5
+  +'bkAll'#7'OnClick'#7#16'bbCreateGenClick'#8'TabOrder'#2#1#0#0#7'TBitBtn'#7'B'
+  +'itBtn1'#4'Left'#3#152#1#6'Height'#2#30#3'Top'#3#217#0#5'Width'#2'c'#7'Ancho'
+  +'rs'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'&Close'#5'Color'#4#219#242#247
+  +#0#4'Kind'#7#7'bkClose'#8'TabOrder'#2#2#0#0#9'TCheckBox'#9'cxTrigger'#4'Left'
+  +#2#8#6'Height'#2#22#3'Top'#2'@'#5'Width'#3'@'#1#7'Caption'#6'+Create Auto in'
+  +'crement Trigger for generator'#8'OnChange'#7#15'cxTriggerChange'#8'TabOrder'
+  +#2#3#0#0#9'TGroupBox'#9'gbTrigger'#4'Left'#2#10#6'Height'#2't'#3'Top'#2']'#5
+  +'Width'#3#238#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7
+  +'Caption'#6#21'Trigger for generator'#12'ClientHeight'#2'a'#11'ClientWidth'#3
+  +#234#1#7'Enabled'#8#8'TabOrder'#2#4#0#6'TLabel'#6'Label2'#4'Left'#2#6#6'Heig'
+  +'ht'#2#18#3'Top'#2#10#5'Width'#2':'#7'Caption'#6#8'On table'#11'ParentColor'
+  +#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#9#6'Height'#2#18#3'Top'#2'5'#5'Width'#2
+  +'"'#7'Caption'#6#5'Field'#11'ParentColor'#8#0#0#9'TComboBox'#8'cbTables'#4'L'
+  +'eft'#2'V'#6'Height'#2#31#3'Top'#2#7#5'Width'#3#152#0#10'ItemHeight'#2#0#8'O'
+  +'nChange'#7#14'cbTablesChange'#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#0
+  +#0#0#9'TComboBox'#8'cbFields'#4'Left'#2'W'#6'Height'#2#31#3'Top'#2'0'#5'Widt'
+  +'h'#3#151#0#10'ItemHeight'#2#0#5'Style'#7#14'csDropDownList'#8'TabOrder'#2#1
+  +#0#0#0#0
 ]);

+ 40 - 53
newgen.pas

@@ -15,8 +15,6 @@ type
   TfmNewGen = class(TForm)
     bbCreateGen: TBitBtn;
     BitBtn1: TBitBtn;
-    BitBtn2: TBitBtn;
-    bbCreateTrigger: TBitBtn;
     cbTables: TComboBox;
     cbFields: TComboBox;
     cxTrigger: TCheckBox;
@@ -25,19 +23,15 @@ type
     Label1: TLabel;
     Label2: TLabel;
     Label3: TLabel;
-    meSQL: TMemo;
-    SQLQuery1: TSQLQuery;
     procedure bbCreateGenClick(Sender: TObject);
-    procedure BitBtn2Click(Sender: TObject);
-    procedure bbCreateTriggerClick(Sender: TObject);
     procedure cbTablesChange(Sender: TObject);
     procedure cxTriggerChange(Sender: TObject);
   private
     { private declarations }
+    fdbIndex: Integer;
     ibConnection: TIBConnection;
     SQLTrans: TSQLTransaction;
   public
-    DatabaseIndex: Integer;
     procedure Init(dbIndex: Integer);
     { public declarations }
   end; 
@@ -49,62 +43,53 @@ implementation
 
 { TfmNewGen }
 
-uses main;
+uses main, SysTables;
 
 procedure TfmNewGen.bbCreateGenClick(Sender: TObject);
+var
+  List: TStringList;
+  Valid: Boolean;
 begin
   if Trim(edGenName.Text) <> '' then
   begin
-    SQLQuery1.SQL.Text:= 'create generator ' + edGenName.Text;
-    SQLQuery1.ExecSQL;
-    SQLTrans.Commit;
-    fmMain.AddToSQLHistory(fmMain.RegisteredDatabases[DatabaseIndex].RegRec.Title, 'DDL', SQLQuery1.SQL.Text);
-    MessageDlg('Generator ' + edGenName.Text + ' has been created successfully', mtInformation, [mbOK], 0);
-    gbTrigger.Enabled:= True;
-    cxTrigger.Enabled:= True;
+    Valid:= True;
+    List:= TStringList.Create;
+    List.Add('create generator ' + edGenName.Text + ';');
+    if cxTrigger.Checked then
+    begin
+      Valid:= False;
+      if (cbTables.ItemIndex = -1) or (cbFields.ItemIndex = -1) then
+        MessageDlg('You should select a table and a field', mtError, [mbOk], 0)
+      else
+      if Trim(edGenName.Text) = '' then
+        MessageDlg('You should enter generator name', mtError, [mbOK], 0)
+      else
+      begin
+        List.Add('CREATE TRIGGER ' + Trim(edGenName.Text) + ' FOR ' + cbTables.Text);
+        List.Add('ACTIVE BEFORE INSERT POSITION 0 ');
+        List.Add('AS BEGIN ');
+        List.Add('IF (NEW.' + cbFields.Text + ' IS NULL OR NEW.' + cbFields.Text + ' = 0) THEN ');
+        List.Add('  NEW.' + cbFields.Text + ' = GEN_ID(' + edGenName.Text + ', 1);');
+        List.Add('END;');
+        Valid:= True;
+      end;
+
+    end;
+    fmMain.ShowCompleteQueryWindow(fdbIndex, 'Create Generator: ' + edGenName.Text, List.Text);
+    Close;
+    List.Free;
   end
   else
     MessageDlg('You should write Generator name', mtError, [mbOK], 0);
 end;
 
-procedure TfmNewGen.BitBtn2Click(Sender: TObject);
-begin
-  if (cbTables.ItemIndex = -1) or (cbFields.ItemIndex = -1) then
-    MessageDlg('You should select a table and a field', mtError, [mbOk], 0)
-  else
-  if Trim(edGenName.Text) = '' then
-    MessageDlg('You should enter generator name', mtError, [mbOK], 0)
-  else
-  begin
-    meSQL.Clear;
-    meSQL.Lines.Add('CREATE TRIGGER ' + Trim(edGenName.Text) + ' FOR ' + cbTables.Text);
-    meSQL.Lines.Add('ACTIVE BEFORE INSERT POSITION 0 ');
-    meSQL.Lines.Add('AS BEGIN ');
-    meSQL.Lines.Add('IF (NEW.' + cbFields.Text + ' IS NULL OR NEW.' + cbFields.Text + ' = 0) THEN ');
-    meSQL.Lines.Add('  NEW.' + cbFields.Text + ' = GEN_ID(' + edGenName.Text + ', 1);');
-    meSQL.Lines.Add('END');
-    bbCreateTrigger.Enabled:= True;
-  end;
-end;
-
-procedure TfmNewGen.bbCreateTriggerClick(Sender: TObject);
-begin
-  SQLQuery1.SQL.Text:= meSQL.Lines.Text;
-  SQLQuery1.ExecSQL;
-  SQLTrans.Commit;
-  fmMain.AddToSQLHistory(fmMain.RegisteredDatabases[DatabaseIndex].RegRec.Title, 'DDL', SQLQuery1.SQL.Text);
-  MessageDlg('Auto Increment Trigger has been created successfully for the table ' + cbTables.Text,
-    mtInformation, [mbOK], 0);
-  ModalResult:= mrOK;
-end;
-
 procedure TfmNewGen.cbTablesChange(Sender: TObject);
 var
   FType: string;
 begin
   if cbTables.ItemIndex <> -1 then
   begin
-    fmMain.GetFields(DatabaseIndex, cbTables.Text, nil);
+    fmMain.GetFields(fdbIndex, cbTables.Text, nil);
     cbFields.Clear;
     while not fmMain.SQLQuery1.EOF do
     begin
@@ -124,14 +109,16 @@ begin
 end;
 
 procedure TfmNewGen.Init(dbIndex: Integer);
+var
+  TableNames: string;
+  Count: Integer;
 begin
-  DatabaseIndex:= dbIndex;
-  ibConnection:= fmMain.RegisteredDatabases[dbIndex].IBConnection;
-  SQLTrans:= fmMain.RegisteredDatabases[dbIndex].SQLTrans;;
-  SQLQuery1.DataBase:= ibConnection;
+  fdbIndex:= dbIndex;
+  TableNames:= dmSysTables.GetDBObjectNames(dbIndex, 1, Count);
+
+  fmNewGen.cbTables.Items.CommaText:= TableNames;
+
   cxTrigger.Checked:= False;
-  bbCreateTrigger.Enabled:= False;
-  meSQL.Clear;
 end;
 
 initialization

+ 29 - 800
newtable.lfm

@@ -1,35 +1,37 @@
 object fmNewTable: TfmNewTable
   Left = 532
-  Height = 550
+  Height = 535
   Top = 302
-  Width = 573
+  Width = 594
   ActiveControl = edNewTable
   Caption = 'New Table'
-  ClientHeight = 550
-  ClientWidth = 573
+  ClientHeight = 535
+  ClientWidth = 594
   OnClose = FormClose
   Position = poScreenCenter
   LCLVersion = '0.9.31'
   object Label1: TLabel
-    Left = 5
-    Height = 18
-    Top = 14
-    Width = 109
+    Left = 8
+    Height = 15
+    Top = 9
+    Width = 84
     Caption = 'New Table name'
+    Font.Height = -11
     ParentColor = False
+    ParentFont = False
   end
   object edNewTable: TEdit
-    Left = 127
+    Left = 8
     Height = 27
-    Top = 8
+    Top = 28
     Width = 153
     TabOrder = 0
   end
   object StringGrid1: TStringGrid
     Left = 8
-    Height = 224
+    Height = 374
     Top = 59
-    Width = 554
+    Width = 575
     Anchors = [akTop, akLeft, akRight, akBottom]
     ColCount = 6
     Columns = <    
@@ -64,28 +66,15 @@ object fmNewTable: TfmNewTable
     Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goSmoothScroll]
     RowCount = 3
     TabOrder = 1
-    OnEditingDone = StringGrid1EditingDone
+    OnEditingDone = StringGrid1PickListSelect
     OnKeyUp = StringGrid1KeyUp
     OnMouseUp = StringGrid1MouseUp
     OnPickListSelect = StringGrid1PickListSelect
   end
-  object bbCreate: TBitBtn
-    Left = 9
-    Height = 30
-    Top = 504
-    Width = 118
-    Anchors = [akLeft, akBottom]
-    Caption = 'Create'
-    Color = 16249563
-    Enabled = False
-    Kind = bkYes
-    OnClick = bbCreateClick
-    TabOrder = 2
-  end
   object BitBtn2: TBitBtn
-    Left = 150
-    Height = 30
-    Top = 504
+    Left = 472
+    Height = 32
+    Top = 488
     Width = 96
     Anchors = [akLeft, akBottom]
     Cancel = True
@@ -93,12 +82,12 @@ object fmNewTable: TfmNewTable
     Color = 16249563
     Kind = bkCancel
     ModalResult = 2
-    TabOrder = 3
+    TabOrder = 2
   end
   object bbScript: TBitBtn
-    Left = 9
-    Height = 30
-    Top = 296
+    Left = 5
+    Height = 32
+    Top = 488
     Width = 118
     Anchors = [akLeft, akBottom]
     Caption = 'Script'
@@ -106,776 +95,16 @@ object fmNewTable: TfmNewTable
     Default = True
     Kind = bkYes
     OnClick = bbScriptClick
-    TabOrder = 4
+    TabOrder = 3
   end
   object cxCreateGen: TCheckBox
-    Left = 156
+    Left = 8
     Height = 22
-    Top = 301
-    Width = 193
+    Top = 449
+    Width = 326
     Anchors = [akLeft, akBottom]
-    Caption = 'Create Auto Inc Generator'
-    TabOrder = 5
-  end
-  inline syScript: TSynEdit
-    Left = 10
-    Height = 168
-    Top = 335
-    Width = 554
-    Anchors = [akLeft, akRight, akBottom]
-    Font.Height = -13
-    Font.Name = 'Courier New'
-    Font.Pitch = fpFixed
-    Font.Quality = fqNonAntialiased
-    ParentColor = False
-    ParentFont = False
-    TabOrder = 6
-    Gutter.Width = 57
-    Gutter.MouseActions = <    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccAny
-        ClickDir = cdDown
-        Command = 13
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbRight
-        ClickCount = ccSingle
-        ClickDir = cdUp
-        Command = 12
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end>
-    RightGutter.Width = 0
-    RightGutter.MouseActions = <    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccAny
-        ClickDir = cdDown
-        Command = 13
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbRight
-        ClickCount = ccSingle
-        ClickDir = cdUp
-        Command = 12
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end>
-    Highlighter = SynSQLSyn1
-    Keystrokes = <    
-      item
-        Command = ecUp
-        ShortCut = 38
-      end    
-      item
-        Command = ecSelUp
-        ShortCut = 8230
-      end    
-      item
-        Command = ecScrollUp
-        ShortCut = 16422
-      end    
-      item
-        Command = ecDown
-        ShortCut = 40
-      end    
-      item
-        Command = ecSelDown
-        ShortCut = 8232
-      end    
-      item
-        Command = ecScrollDown
-        ShortCut = 16424
-      end    
-      item
-        Command = ecLeft
-        ShortCut = 37
-      end    
-      item
-        Command = ecSelLeft
-        ShortCut = 8229
-      end    
-      item
-        Command = ecWordLeft
-        ShortCut = 16421
-      end    
-      item
-        Command = ecSelWordLeft
-        ShortCut = 24613
-      end    
-      item
-        Command = ecRight
-        ShortCut = 39
-      end    
-      item
-        Command = ecSelRight
-        ShortCut = 8231
-      end    
-      item
-        Command = ecWordRight
-        ShortCut = 16423
-      end    
-      item
-        Command = ecSelWordRight
-        ShortCut = 24615
-      end    
-      item
-        Command = ecPageDown
-        ShortCut = 34
-      end    
-      item
-        Command = ecSelPageDown
-        ShortCut = 8226
-      end    
-      item
-        Command = ecPageBottom
-        ShortCut = 16418
-      end    
-      item
-        Command = ecSelPageBottom
-        ShortCut = 24610
-      end    
-      item
-        Command = ecPageUp
-        ShortCut = 33
-      end    
-      item
-        Command = ecSelPageUp
-        ShortCut = 8225
-      end    
-      item
-        Command = ecPageTop
-        ShortCut = 16417
-      end    
-      item
-        Command = ecSelPageTop
-        ShortCut = 24609
-      end    
-      item
-        Command = ecLineStart
-        ShortCut = 36
-      end    
-      item
-        Command = ecSelLineStart
-        ShortCut = 8228
-      end    
-      item
-        Command = ecEditorTop
-        ShortCut = 16420
-      end    
-      item
-        Command = ecSelEditorTop
-        ShortCut = 24612
-      end    
-      item
-        Command = ecLineEnd
-        ShortCut = 35
-      end    
-      item
-        Command = ecSelLineEnd
-        ShortCut = 8227
-      end    
-      item
-        Command = ecEditorBottom
-        ShortCut = 16419
-      end    
-      item
-        Command = ecSelEditorBottom
-        ShortCut = 24611
-      end    
-      item
-        Command = ecToggleMode
-        ShortCut = 45
-      end    
-      item
-        Command = ecCopy
-        ShortCut = 16429
-      end    
-      item
-        Command = ecPaste
-        ShortCut = 8237
-      end    
-      item
-        Command = ecDeleteChar
-        ShortCut = 46
-      end    
-      item
-        Command = ecCut
-        ShortCut = 8238
-      end    
-      item
-        Command = ecDeleteLastChar
-        ShortCut = 8
-      end    
-      item
-        Command = ecDeleteLastChar
-        ShortCut = 8200
-      end    
-      item
-        Command = ecDeleteLastWord
-        ShortCut = 16392
-      end    
-      item
-        Command = ecUndo
-        ShortCut = 32776
-      end    
-      item
-        Command = ecRedo
-        ShortCut = 40968
-      end    
-      item
-        Command = ecLineBreak
-        ShortCut = 13
-      end    
-      item
-        Command = ecSelectAll
-        ShortCut = 16449
-      end    
-      item
-        Command = ecCopy
-        ShortCut = 16451
-      end    
-      item
-        Command = ecBlockIndent
-        ShortCut = 24649
-      end    
-      item
-        Command = ecLineBreak
-        ShortCut = 16461
-      end    
-      item
-        Command = ecInsertLine
-        ShortCut = 16462
-      end    
-      item
-        Command = ecDeleteWord
-        ShortCut = 16468
-      end    
-      item
-        Command = ecBlockUnindent
-        ShortCut = 24661
-      end    
-      item
-        Command = ecPaste
-        ShortCut = 16470
-      end    
-      item
-        Command = ecCut
-        ShortCut = 16472
-      end    
-      item
-        Command = ecDeleteLine
-        ShortCut = 16473
-      end    
-      item
-        Command = ecDeleteEOL
-        ShortCut = 24665
-      end    
-      item
-        Command = ecUndo
-        ShortCut = 16474
-      end    
-      item
-        Command = ecRedo
-        ShortCut = 24666
-      end    
-      item
-        Command = ecGotoMarker0
-        ShortCut = 16432
-      end    
-      item
-        Command = ecGotoMarker1
-        ShortCut = 16433
-      end    
-      item
-        Command = ecGotoMarker2
-        ShortCut = 16434
-      end    
-      item
-        Command = ecGotoMarker3
-        ShortCut = 16435
-      end    
-      item
-        Command = ecGotoMarker4
-        ShortCut = 16436
-      end    
-      item
-        Command = ecGotoMarker5
-        ShortCut = 16437
-      end    
-      item
-        Command = ecGotoMarker6
-        ShortCut = 16438
-      end    
-      item
-        Command = ecGotoMarker7
-        ShortCut = 16439
-      end    
-      item
-        Command = ecGotoMarker8
-        ShortCut = 16440
-      end    
-      item
-        Command = ecGotoMarker9
-        ShortCut = 16441
-      end    
-      item
-        Command = ecSetMarker0
-        ShortCut = 24624
-      end    
-      item
-        Command = ecSetMarker1
-        ShortCut = 24625
-      end    
-      item
-        Command = ecSetMarker2
-        ShortCut = 24626
-      end    
-      item
-        Command = ecSetMarker3
-        ShortCut = 24627
-      end    
-      item
-        Command = ecSetMarker4
-        ShortCut = 24628
-      end    
-      item
-        Command = ecSetMarker5
-        ShortCut = 24629
-      end    
-      item
-        Command = ecSetMarker6
-        ShortCut = 24630
-      end    
-      item
-        Command = ecSetMarker7
-        ShortCut = 24631
-      end    
-      item
-        Command = ecSetMarker8
-        ShortCut = 24632
-      end    
-      item
-        Command = ecSetMarker9
-        ShortCut = 24633
-      end    
-      item
-        Command = EcFoldLevel1
-        ShortCut = 41009
-      end    
-      item
-        Command = EcFoldLevel2
-        ShortCut = 41010
-      end    
-      item
-        Command = EcFoldLevel1
-        ShortCut = 41011
-      end    
-      item
-        Command = EcFoldLevel1
-        ShortCut = 41012
-      end    
-      item
-        Command = EcFoldLevel1
-        ShortCut = 41013
-      end    
-      item
-        Command = EcFoldLevel6
-        ShortCut = 41014
-      end    
-      item
-        Command = EcFoldLevel7
-        ShortCut = 41015
-      end    
-      item
-        Command = EcFoldLevel8
-        ShortCut = 41016
-      end    
-      item
-        Command = EcFoldLevel9
-        ShortCut = 41017
-      end    
-      item
-        Command = EcFoldLevel0
-        ShortCut = 41008
-      end    
-      item
-        Command = EcFoldCurrent
-        ShortCut = 41005
-      end    
-      item
-        Command = EcUnFoldCurrent
-        ShortCut = 41003
-      end    
-      item
-        Command = EcToggleMarkupWord
-        ShortCut = 32845
-      end    
-      item
-        Command = ecNormalSelect
-        ShortCut = 24654
-      end    
-      item
-        Command = ecColumnSelect
-        ShortCut = 24643
-      end    
-      item
-        Command = ecLineSelect
-        ShortCut = 24652
-      end    
-      item
-        Command = ecTab
-        ShortCut = 9
-      end    
-      item
-        Command = ecShiftTab
-        ShortCut = 8201
-      end    
-      item
-        Command = ecMatchBracket
-        ShortCut = 24642
-      end    
-      item
-        Command = ecColSelUp
-        ShortCut = 40998
-      end    
-      item
-        Command = ecColSelDown
-        ShortCut = 41000
-      end    
-      item
-        Command = ecColSelLeft
-        ShortCut = 40997
-      end    
-      item
-        Command = ecColSelRight
-        ShortCut = 40999
-      end    
-      item
-        Command = ecColSelPageDown
-        ShortCut = 40994
-      end    
-      item
-        Command = ecColSelPageBottom
-        ShortCut = 57378
-      end    
-      item
-        Command = ecColSelPageUp
-        ShortCut = 40993
-      end    
-      item
-        Command = ecColSelPageTop
-        ShortCut = 57377
-      end    
-      item
-        Command = ecColSelLineStart
-        ShortCut = 40996
-      end    
-      item
-        Command = ecColSelLineEnd
-        ShortCut = 40995
-      end    
-      item
-        Command = ecColSelEditorTop
-        ShortCut = 57380
-      end    
-      item
-        Command = ecColSelEditorBottom
-        ShortCut = 57379
-      end>
-    MouseActions = <    
-      item
-        Shift = []
-        ShiftMask = [ssShift, ssAlt]
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 1
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = [ssShift]
-        ShiftMask = [ssShift, ssAlt]
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 1
-        MoveCaret = True
-        Option = 1
-        Priority = 0
-      end    
-      item
-        Shift = [ssAlt]
-        ShiftMask = [ssShift, ssAlt]
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 3
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = [ssShift, ssAlt]
-        ShiftMask = [ssShift, ssAlt]
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 3
-        MoveCaret = True
-        Option = 1
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbRight
-        ClickCount = ccSingle
-        ClickDir = cdUp
-        Command = 12
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccDouble
-        ClickDir = cdDown
-        Command = 6
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccTriple
-        ClickDir = cdDown
-        Command = 7
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccQuad
-        ClickDir = cdDown
-        Command = 8
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbMiddle
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 10
-        MoveCaret = True
-        Option = 0
-        Priority = 0
-      end    
-      item
-        Shift = [ssCtrl]
-        ShiftMask = [ssShift, ssAlt, ssCtrl]
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdUp
-        Command = 11
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end>
-    MouseSelActions = <    
-      item
-        Shift = []
-        ShiftMask = []
-        Button = mbLeft
-        ClickCount = ccSingle
-        ClickDir = cdDown
-        Command = 9
-        MoveCaret = False
-        Option = 0
-        Priority = 0
-      end>
-    BracketHighlightStyle = sbhsBoth
-    inline TSynGutterPartList
-      object TSynGutterMarks
-        Width = 24
-      end
-      object TSynGutterLineNumber
-        Width = 17
-        MouseActions = <>
-        MarkupInfo.Background = clBtnFace
-        MarkupInfo.Foreground = clNone
-        DigitCount = 2
-        ShowOnlyLineNumbersMultiplesOf = 1
-        ZeroStart = False
-        LeadingZeros = False
-      end
-      object TSynGutterChanges
-        Width = 4
-        ModifiedColor = 59900
-        SavedColor = clGreen
-      end
-      object TSynGutterSeparator
-        Width = 2
-      end
-      object TSynGutterCodeFolding
-        MouseActions = <        
-          item
-            Shift = []
-            ShiftMask = []
-            Button = mbRight
-            ClickCount = ccSingle
-            ClickDir = cdUp
-            Command = 16
-            MoveCaret = False
-            Option = 0
-            Priority = 0
-          end        
-          item
-            Shift = []
-            ShiftMask = [ssShift]
-            Button = mbMiddle
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 14
-            MoveCaret = False
-            Option = 0
-            Priority = 0
-          end        
-          item
-            Shift = [ssShift]
-            ShiftMask = [ssShift]
-            Button = mbMiddle
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 14
-            MoveCaret = False
-            Option = 1
-            Priority = 0
-          end        
-          item
-            Shift = []
-            ShiftMask = []
-            Button = mbLeft
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 0
-            MoveCaret = False
-            Option = 0
-            Priority = 0
-          end>
-        MarkupInfo.Background = clNone
-        MarkupInfo.Foreground = clGray
-        MouseActionsExpanded = <        
-          item
-            Shift = []
-            ShiftMask = []
-            Button = mbLeft
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 14
-            MoveCaret = False
-            Option = 0
-            Priority = 0
-          end>
-        MouseActionsCollapsed = <        
-          item
-            Shift = [ssCtrl]
-            ShiftMask = [ssCtrl]
-            Button = mbLeft
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 15
-            MoveCaret = False
-            Option = 0
-            Priority = 0
-          end        
-          item
-            Shift = []
-            ShiftMask = [ssCtrl]
-            Button = mbLeft
-            ClickCount = ccAny
-            ClickDir = cdDown
-            Command = 15
-            MoveCaret = False
-            Option = 1
-            Priority = 0
-          end>
-      end
-    end
-  end
-  object SQLQuery1: TSQLQuery
-    IndexName = 'DEFAULT_ORDER'
-    AutoCalcFields = False
-    ReadOnly = False
-    Params = <>
-    left = 344
-    top = 256
-  end
-  object SynAutoComplete1: TSynAutoComplete
-    AutoCompleteList.Strings = (
-      'select'
-      'table'
-      'order'
-      'update'
-      'set'
-      'create'
-      'delete'
-    )
-    EndOfTokenChr = '()[].'
-    Editor = syScript
-    ShortCut = 8224
-    left = 286
-    top = 504
-  end
-  object SynSQLSyn1: TSynSQLSyn
-    DefaultFilter = 'SQL Files (*.sql)|*.sql'
-    Enabled = False
-    CommentAttri.FrameEdges = sfeAround
-    DataTypeAttri.FrameEdges = sfeAround
-    DefaultPackageAttri.FrameEdges = sfeAround
-    ExceptionAttri.FrameEdges = sfeAround
-    FunctionAttri.FrameEdges = sfeAround
-    IdentifierAttri.FrameEdges = sfeAround
-    KeyAttri.FrameEdges = sfeAround
-    NumberAttri.FrameEdges = sfeAround
-    PLSQLAttri.FrameEdges = sfeAround
-    SpaceAttri.FrameEdges = sfeAround
-    SQLPlusAttri.FrameEdges = sfeAround
-    StringAttri.FrameEdges = sfeAround
-    SymbolAttri.FrameEdges = sfeAround
-    TableNameAttri.FrameEdges = sfeAround
-    VariableAttri.FrameEdges = sfeAround
-    SQLDialect = sqlSybase
-    left = 362
-    top = 504
+    Caption = 'Create Auto increment Generator and Trigger'
+    OnClick = cxCreateGenClick
+    TabOrder = 4
   end
 end

+ 30 - 190
newtable.lrs

@@ -1,195 +1,35 @@
 { This is an automatically generated lazarus resource file }
 
 LazarusResources.Add('TfmNewTable','FORMDATA',[
-  'TPF0'#11'TfmNewTable'#10'fmNewTable'#4'Left'#3#20#2#6'Height'#3'&'#2#3'Top'#3
-  +'.'#1#5'Width'#3'='#2#13'ActiveControl'#7#10'edNewTable'#7'Caption'#6#9'New '
-  +'Table'#12'ClientHeight'#3'&'#2#11'ClientWidth'#3'='#2#7'OnClose'#7#9'FormCl'
+  'TPF0'#11'TfmNewTable'#10'fmNewTable'#4'Left'#3#20#2#6'Height'#3#23#2#3'Top'#3
+  +'.'#1#5'Width'#3'R'#2#13'ActiveControl'#7#10'edNewTable'#7'Caption'#6#9'New '
+  +'Table'#12'ClientHeight'#3#23#2#11'ClientWidth'#3'R'#2#7'OnClose'#7#9'FormCl'
   +'ose'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#6'0.9.31'#0#6'TLabel'
-  +#6'Label1'#4'Left'#2#5#6'Height'#2#18#3'Top'#2#14#5'Width'#2'm'#7'Caption'#6
-  +#14'New Table name'#11'ParentColor'#8#0#0#5'TEdit'#10'edNewTable'#4'Left'#2
-  +#127#6'Height'#2#27#3'Top'#2#8#5'Width'#3#153#0#8'TabOrder'#2#0#0#0#11'TStri'
-  +'ngGrid'#11'StringGrid1'#4'Left'#2#8#6'Height'#3#224#0#3'Top'#2';'#5'Width'#3
-  +'*'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#8'ColCount'#2
-  +#6#7'Columns'#14#1#13'Title.Caption'#6#10'Field Name'#5'Width'#2'd'#0#1#13'T'
-  +'itle.Caption'#6#9'Data Type'#5'Width'#2'x'#0#1#13'Title.Caption'#6#4'Size'#0
-  +#1#11'ButtonStyle'#7#17'cbsCheckboxColumn'#13'Title.Caption'#6#10'Allow Null'
-  +#5'Width'#2'Z'#0#1#11'ButtonStyle'#7#17'cbsCheckboxColumn'#13'Title.Caption'
-  +#6#5'P-Key'#11'Title.Color'#4#219#216#174#0#16'Title.Font.Color'#4#12#8#253#0
-  +#0#1#13'Title.Caption'#6#13'Default Value'#5'Width'#2'x'#0#0#10'FixedColor'#4
-  +#207#218#221#0#9'FixedCols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixed'
-  +'HorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#9'goEditing'#14'g'
-  +'oSmoothScroll'#0#8'RowCount'#2#3#8'TabOrder'#2#1#13'OnEditingDone'#7#22'Str'
-  +'ingGrid1EditingDone'#7'OnKeyUp'#7#16'StringGrid1KeyUp'#9'OnMouseUp'#7#18'St'
-  +'ringGrid1MouseUp'#16'OnPickListSelect'#7#25'StringGrid1PickListSelect'#0#0#7
-  +'TBitBtn'#8'bbCreate'#4'Left'#2#9#6'Height'#2#30#3'Top'#3#248#1#5'Width'#2'v'
-  +#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Create'#5'Color'#4#219
-  +#242#247#0#7'Enabled'#8#4'Kind'#7#5'bkYes'#7'OnClick'#7#13'bbCreateClick'#8
-  +'TabOrder'#2#2#0#0#7'TBitBtn'#7'BitBtn2'#4'Left'#3#150#0#6'Height'#2#30#3'To'
-  +'p'#3#248#1#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#6'Cancel'#9#7
-  +'Caption'#6#6'Cancel'#5'Color'#4#219#242#247#0#4'Kind'#7#8'bkCancel'#11'Moda'
-  +'lResult'#2#2#8'TabOrder'#2#3#0#0#7'TBitBtn'#8'bbScript'#4'Left'#2#9#6'Heigh'
-  +'t'#2#30#3'Top'#3'('#1#5'Width'#2'v'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7
-  +'Caption'#6#6'Script'#5'Color'#4#219#242#247#0#7'Default'#9#4'Kind'#7#5'bkYe'
-  +'s'#7'OnClick'#7#13'bbScriptClick'#8'TabOrder'#2#4#0#0#9'TCheckBox'#11'cxCre'
-  +'ateGen'#4'Left'#3#156#0#6'Height'#2#22#3'Top'#3'-'#1#5'Width'#3#193#0#7'Anc'
-  +'hors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#25'Create Auto Inc Generator'
-  +#8'TabOrder'#2#5#0#0#244#8'TSynEdit'#8'syScript'#4'Left'#2#10#6'Height'#3#168
-  +#0#3'Top'#3'O'#1#5'Width'#3'*'#2#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBott'
-  +'om'#0#11'Font.Height'#2#243#9'Font.Name'#6#11'Courier New'#10'Font.Pitch'#7
-  +#7'fpFixed'#12'Font.Quality'#7#16'fqNonAntialiased'#11'ParentColor'#8#10'Par'
-  +'entFont'#8#8'TabOrder'#2#6#12'Gutter.Width'#2'9'#19'Gutter.MouseActions'#14
-  +#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5
-  +'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#13#9'MoveCaret'#8#6'Option'#2#0
-  +#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRight'
-  +#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#12#9'MoveCa'
-  +'ret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#17'RightGutter.Width'#2#0#24'Right'
-  +'Gutter.MouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbL'
-  +'eft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#13#9'Mo'
-  +'veCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0
-  +#6'Button'#7#7'mbRight'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7
-  +'Command'#2#12#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#11'Highlight'
-  +'er'#7#10'SynSQLSyn1'#10'Keystrokes'#14#1#7'Command'#7#4'ecUp'#8'ShortCut'#2
-  +'&'#0#1#7'Command'#7#7'ecSelUp'#8'ShortCut'#3'& '#0#1#7'Command'#7#10'ecScro'
-  +'llUp'#8'ShortCut'#3'&@'#0#1#7'Command'#7#6'ecDown'#8'ShortCut'#2'('#0#1#7'C'
-  +'ommand'#7#9'ecSelDown'#8'ShortCut'#3'( '#0#1#7'Command'#7#12'ecScrollDown'#8
-  +'ShortCut'#3'(@'#0#1#7'Command'#7#6'ecLeft'#8'ShortCut'#2'%'#0#1#7'Command'#7
-  +#9'ecSelLeft'#8'ShortCut'#3'% '#0#1#7'Command'#7#10'ecWordLeft'#8'ShortCut'#3
-  +'%@'#0#1#7'Command'#7#13'ecSelWordLeft'#8'ShortCut'#3'%`'#0#1#7'Command'#7#7
-  +'ecRight'#8'ShortCut'#2''''#0#1#7'Command'#7#10'ecSelRight'#8'ShortCut'#3''''
-  +' '#0#1#7'Command'#7#11'ecWordRight'#8'ShortCut'#3'''@'#0#1#7'Command'#7#14
-  +'ecSelWordRight'#8'ShortCut'#3'''`'#0#1#7'Command'#7#10'ecPageDown'#8'ShortC'
-  +'ut'#2'"'#0#1#7'Command'#7#13'ecSelPageDown'#8'ShortCut'#3'" '#0#1#7'Command'
-  +#7#12'ecPageBottom'#8'ShortCut'#3'"@'#0#1#7'Command'#7#15'ecSelPageBottom'#8
-  +'ShortCut'#3'"`'#0#1#7'Command'#7#8'ecPageUp'#8'ShortCut'#2'!'#0#1#7'Command'
-  +#7#11'ecSelPageUp'#8'ShortCut'#3'! '#0#1#7'Command'#7#9'ecPageTop'#8'ShortCu'
-  +'t'#3'!@'#0#1#7'Command'#7#12'ecSelPageTop'#8'ShortCut'#3'!`'#0#1#7'Command'
-  +#7#11'ecLineStart'#8'ShortCut'#2'$'#0#1#7'Command'#7#14'ecSelLineStart'#8'Sh'
-  +'ortCut'#3'$ '#0#1#7'Command'#7#11'ecEditorTop'#8'ShortCut'#3'$@'#0#1#7'Comm'
-  ,'and'#7#14'ecSelEditorTop'#8'ShortCut'#3'$`'#0#1#7'Command'#7#9'ecLineEnd'#8
-  +'ShortCut'#2'#'#0#1#7'Command'#7#12'ecSelLineEnd'#8'ShortCut'#3'# '#0#1#7'Co'
-  +'mmand'#7#14'ecEditorBottom'#8'ShortCut'#3'#@'#0#1#7'Command'#7#17'ecSelEdit'
-  +'orBottom'#8'ShortCut'#3'#`'#0#1#7'Command'#7#12'ecToggleMode'#8'ShortCut'#2
-  +'-'#0#1#7'Command'#7#6'ecCopy'#8'ShortCut'#3'-@'#0#1#7'Command'#7#7'ecPaste'
-  +#8'ShortCut'#3'- '#0#1#7'Command'#7#12'ecDeleteChar'#8'ShortCut'#2'.'#0#1#7
-  +'Command'#7#5'ecCut'#8'ShortCut'#3'. '#0#1#7'Command'#7#16'ecDeleteLastChar'
-  +#8'ShortCut'#2#8#0#1#7'Command'#7#16'ecDeleteLastChar'#8'ShortCut'#3#8' '#0#1
-  +#7'Command'#7#16'ecDeleteLastWord'#8'ShortCut'#3#8'@'#0#1#7'Command'#7#6'ecU'
-  +'ndo'#8'ShortCut'#4#8#128#0#0#0#1#7'Command'#7#6'ecRedo'#8'ShortCut'#4#8#160
-  +#0#0#0#1#7'Command'#7#11'ecLineBreak'#8'ShortCut'#2#13#0#1#7'Command'#7#11'e'
-  +'cSelectAll'#8'ShortCut'#3'A@'#0#1#7'Command'#7#6'ecCopy'#8'ShortCut'#3'C@'#0
-  +#1#7'Command'#7#13'ecBlockIndent'#8'ShortCut'#3'I`'#0#1#7'Command'#7#11'ecLi'
-  +'neBreak'#8'ShortCut'#3'M@'#0#1#7'Command'#7#12'ecInsertLine'#8'ShortCut'#3
-  +'N@'#0#1#7'Command'#7#12'ecDeleteWord'#8'ShortCut'#3'T@'#0#1#7'Command'#7#15
-  +'ecBlockUnindent'#8'ShortCut'#3'U`'#0#1#7'Command'#7#7'ecPaste'#8'ShortCut'#3
-  +'V@'#0#1#7'Command'#7#5'ecCut'#8'ShortCut'#3'X@'#0#1#7'Command'#7#12'ecDelet'
-  +'eLine'#8'ShortCut'#3'Y@'#0#1#7'Command'#7#11'ecDeleteEOL'#8'ShortCut'#3'Y`'
-  +#0#1#7'Command'#7#6'ecUndo'#8'ShortCut'#3'Z@'#0#1#7'Command'#7#6'ecRedo'#8'S'
-  +'hortCut'#3'Z`'#0#1#7'Command'#7#13'ecGotoMarker0'#8'ShortCut'#3'0@'#0#1#7'C'
-  +'ommand'#7#13'ecGotoMarker1'#8'ShortCut'#3'1@'#0#1#7'Command'#7#13'ecGotoMar'
-  +'ker2'#8'ShortCut'#3'2@'#0#1#7'Command'#7#13'ecGotoMarker3'#8'ShortCut'#3'3@'
-  +#0#1#7'Command'#7#13'ecGotoMarker4'#8'ShortCut'#3'4@'#0#1#7'Command'#7#13'ec'
-  +'GotoMarker5'#8'ShortCut'#3'5@'#0#1#7'Command'#7#13'ecGotoMarker6'#8'ShortCu'
-  +'t'#3'6@'#0#1#7'Command'#7#13'ecGotoMarker7'#8'ShortCut'#3'7@'#0#1#7'Command'
-  +#7#13'ecGotoMarker8'#8'ShortCut'#3'8@'#0#1#7'Command'#7#13'ecGotoMarker9'#8
-  +'ShortCut'#3'9@'#0#1#7'Command'#7#12'ecSetMarker0'#8'ShortCut'#3'0`'#0#1#7'C'
-  +'ommand'#7#12'ecSetMarker1'#8'ShortCut'#3'1`'#0#1#7'Command'#7#12'ecSetMarke'
-  +'r2'#8'ShortCut'#3'2`'#0#1#7'Command'#7#12'ecSetMarker3'#8'ShortCut'#3'3`'#0
-  +#1#7'Command'#7#12'ecSetMarker4'#8'ShortCut'#3'4`'#0#1#7'Command'#7#12'ecSet'
-  +'Marker5'#8'ShortCut'#3'5`'#0#1#7'Command'#7#12'ecSetMarker6'#8'ShortCut'#3
-  +'6`'#0#1#7'Command'#7#12'ecSetMarker7'#8'ShortCut'#3'7`'#0#1#7'Command'#7#12
-  +'ecSetMarker8'#8'ShortCut'#3'8`'#0#1#7'Command'#7#12'ecSetMarker9'#8'ShortCu'
-  +'t'#3'9`'#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#4'1'#160#0#0#0#1#7'C'
-  +'ommand'#7#12'EcFoldLevel2'#8'ShortCut'#4'2'#160#0#0#0#1#7'Command'#7#12'EcF'
-  +'oldLevel1'#8'ShortCut'#4'3'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel1'#8'Sho'
-  +'rtCut'#4'4'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel1'#8'ShortCut'#4'5'#160#0
-  +#0#0#1#7'Command'#7#12'EcFoldLevel6'#8'ShortCut'#4'6'#160#0#0#0#1#7'Command'
-  +#7#12'EcFoldLevel7'#8'ShortCut'#4'7'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel'
-  +'8'#8'ShortCut'#4'8'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel9'#8'ShortCut'#4
-  +'9'#160#0#0#0#1#7'Command'#7#12'EcFoldLevel0'#8'ShortCut'#4'0'#160#0#0#0#1#7
-  +'Command'#7#13'EcFoldCurrent'#8'ShortCut'#4'-'#160#0#0#0#1#7'Command'#7#15'E'
-  +'cUnFoldCurrent'#8'ShortCut'#4'+'#160#0#0#0#1#7'Command'#7#18'EcToggleMarkup'
-  +'Word'#8'ShortCut'#4'M'#128#0#0#0#1#7'Command'#7#14'ecNormalSelect'#8'ShortC'
-  +'ut'#3'N`'#0#1#7'Command'#7#14'ecColumnSelect'#8'ShortCut'#3'C`'#0#1#7'Comma'
-  +'nd'#7#12'ecLineSelect'#8'ShortCut'#3'L`'#0#1#7'Command'#7#5'ecTab'#8'ShortC'
-  +'ut'#2#9#0#1#7'Command'#7#10'ecShiftTab'#8'ShortCut'#3#9' '#0#1#7'Command'#7
-  +#14'ecMatchBracket'#8'ShortCut'#3'B`'#0#1#7'Command'#7#10'ecColSelUp'#8'Shor'
-  +'tCut'#4'&'#160#0#0#0#1#7'Command'#7#12'ecColSelDown'#8'ShortCut'#4'('#160#0
-  +#0#0#1#7'Command'#7#12'ecColSelLeft'#8'ShortCut'#4'%'#160#0#0#0#1#7'Command'
-  +#7#13'ecColSelRight'#8'ShortCut'#4''''#160#0#0#0#1#7'Command'#7#16'ecColSelP'
-  +'ageDown'#8'ShortCut'#4'"'#160#0#0#0#1#7'Command'#7#18'ecColSelPageBottom'#8
-  +'ShortCut'#4'"'#224#0#0#0#1#7'Command'#7#14'ecColSelPageUp'#8'ShortCut'#4'!'
-  +#160#0#0#0#1#7'Command'#7#15'ecColSelPageTop'#8'ShortCut'#4'!'#224#0#0#0#1#7
-  +'Command'#7#17'ecColSelLineStart'#8'ShortCut'#4'$'#160#0#0#0#1#7'Command'#7
-  +#15'ecColSelLineEnd'#8'ShortCut'#4'#'#160#0#0#0#1#7'Command'#7#17'ecColSelEd'
-  +'itorTop'#8'ShortCut'#4'$'#224#0#0#0#1#7'Command'#7#20'ecColSelEditorBottom'
-  +#8'ShortCut'#4'#'#224#0#0#0#0#12'MouseActions'#14#1#5'Shift'#11#0#9'ShiftMas'
-  +'k'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSing'
-  +'le'#8'ClickDir'#7#6'cdDown'#7'Command'#2#1#9'MoveCaret'#9#6'Option'#2#0#8'P'
-  +'riority'#2#0#0#1#5'Shift'#11#7'ssShift'#0#9'ShiftMask'#11#7'ssShift'#5'ssAl'
-  +'t'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdD'
-  +'own'#7'Command'#2#1#9'MoveCaret'#9#6'Option'#2#1#8'Priority'#2#0#0#1#5'Shif'
-  +'t'#11#5'ssAlt'#0#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'
-  ,#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#3#9'MoveC'
-  +'aret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#5'ssAlt'#0
-  +#9'ShiftMask'#11#7'ssShift'#5'ssAlt'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7
-  +#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#3#9'MoveCaret'#9#6'Option'
-  +#2#1#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRig'
-  +'ht'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#12#9'Mo'
-  +'veCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0
-  +#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccDouble'#8'ClickDir'#7#6'cdDown'#7
-  +'Command'#2#6#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0
-  +#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccTriple'#8'Clic'
-  +'kDir'#7#6'cdDown'#7'Command'#2#7#9'MoveCaret'#9#6'Option'#2#0#8'Priority'#2
-  +#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7
-  +#6'ccQuad'#8'ClickDir'#7#6'cdDown'#7'Command'#2#8#9'MoveCaret'#9#6'Option'#2
-  +#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#8'mbMiddl'
-  +'e'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#6'cdDown'#7'Command'#2#10#9'M'
-  +'oveCaret'#9#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#6'ssCtrl'#0#9'Shi'
-  +'ftMask'#11#7'ssShift'#5'ssAlt'#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCo'
-  +'unt'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#11#9'MoveCaret'#8#6'O'
-  +'ption'#2#0#8'Priority'#2#0#0#0#15'MouseSelActions'#14#1#5'Shift'#11#0#9'Shi'
-  +'ftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'
-  +#7#6'cdDown'#7'Command'#2#9#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0
-  +#21'BracketHighlightStyle'#7#8'sbhsBoth'#0#244#18'TSynGutterPartList'#0#0#15
-  +'TSynGutterMarks'#0#5'Width'#2#24#0#0#20'TSynGutterLineNumber'#0#5'Width'#2
-  +#17#12'MouseActions'#14#0#21'MarkupInfo.Background'#7#9'clBtnFace'#21'Markup'
-  +'Info.Foreground'#7#6'clNone'#10'DigitCount'#2#2#30'ShowOnlyLineNumbersMulti'
-  +'plesOf'#2#1#9'ZeroStart'#8#12'LeadingZeros'#8#0#0#17'TSynGutterChanges'#0#5
-  +'Width'#2#4#13'ModifiedColor'#4#252#233#0#0#10'SavedColor'#7#7'clGreen'#0#0
-  +#19'TSynGutterSeparator'#0#5'Width'#2#2#0#0#21'TSynGutterCodeFolding'#0#12'M'
-  +'ouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRight'#10
-  +'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Command'#2#16#9'MoveCaret'
-  +#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#7'ssShift'
-  +#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'
-  +#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11
-  +#7'ssShift'#0#9'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle'#10'ClickC'
-  +'ount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'O'
-  +'ption'#2#1#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6
-  +'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#0#9
-  +'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#21'MarkupInfo.Background'#7#6
-  +'clNone'#21'MarkupInfo.Foreground'#7#6'clGray'#20'MouseActionsExpanded'#14#1
-  +#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'cc'
-  +'Any'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8
-  +'Priority'#2#0#0#0#21'MouseActionsCollapsed'#14#1#5'Shift'#11#6'ssCtrl'#0#9
-  +'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8
-  +'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCaret'#8#6'Option'#2#0#8'Priori'
-  +'ty'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'
-  +#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCar'
-  +'et'#8#6'Option'#2#1#8'Priority'#2#0#0#0#0#0#0#0#9'TSQLQuery'#9'SQLQuery1'#9
-  +'IndexName'#6#13'DEFAULT_ORDER'#14'AutoCalcFields'#8#8'ReadOnly'#8#6'Params'
-  +#14#0#4'left'#3'X'#1#3'top'#3#0#1#0#0#16'TSynAutoComplete'#16'SynAutoComplet'
-  +'e1'#24'AutoCompleteList.Strings'#1#6#6'select'#6#5'table'#6#5'order'#6#6'up'
-  +'date'#6#3'set'#6#6'create'#6#6'delete'#0#13'EndOfTokenChr'#6#5'()[].'#6'Edi'
-  +'tor'#7#8'syScript'#8'ShortCut'#3'  '#4'left'#3#30#1#3'top'#3#248#1#0#0#10'T'
-  +'SynSQLSyn'#10'SynSQLSyn1'#13'DefaultFilter'#6#23'SQL Files (*.sql)|*.sql'#7
-  +'Enabled'#8#23'CommentAttri.FrameEdges'#7#9'sfeAround'#24'DataTypeAttri.Fram'
-  +'eEdges'#7#9'sfeAround'#30'DefaultPackageAttri.FrameEdges'#7#9'sfeAround'#25
-  +'ExceptionAttri.FrameEdges'#7#9'sfeAround'#24'FunctionAttri.FrameEdges'#7#9
-  +'sfeAround'#26'IdentifierAttri.FrameEdges'#7#9'sfeAround'#19'KeyAttri.FrameE'
-  +'dges'#7#9'sfeAround'#22'NumberAttri.FrameEdges'#7#9'sfeAround'#21'PLSQLAttr'
-  +'i.FrameEdges'#7#9'sfeAround'#21'SpaceAttri.FrameEdges'#7#9'sfeAround'#23'SQ'
-  +'LPlusAttri.FrameEdges'#7#9'sfeAround'#22'StringAttri.FrameEdges'#7#9'sfeAro'
-  +'und'#22'SymbolAttri.FrameEdges'#7#9'sfeAround'#25'TableNameAttri.FrameEdges'
-  +#7#9'sfeAround'#24'VariableAttri.FrameEdges'#7#9'sfeAround'#10'SQLDialect'#7
-  +#9'sqlSybase'#4'left'#3'j'#1#3'top'#3#248#1#0#0#0
+  +#6'Label1'#4'Left'#2#8#6'Height'#2#15#3'Top'#2#9#5'Width'#2'T'#7'Caption'#6
+  +#14'New Table name'#11'Font.Height'#2#245#11'ParentColor'#8#10'ParentFont'#8
+  +#0#0#5'TEdit'#10'edNewTable'#4'Left'#2#8#6'Height'#2#27#3'Top'#2#28#5'Width'
+  +#3#153#0#8'TabOrder'#2#0#0#0#11'TStringGrid'#11'StringGrid1'#4'Left'#2#8#6'H'
+  +'eight'#3'v'#1#3'Top'#2';'#5'Width'#3'?'#2#7'Anchors'#11#5'akTop'#6'akLeft'#7
+  +'akRight'#8'akBottom'#0#8'ColCount'#2#6#7'Columns'#14#1#13'Title.Caption'#6
+  +#10'Field Name'#5'Width'#2'd'#0#1#13'Title.Caption'#6#9'Data Type'#5'Width'#2
+  +'x'#0#1#13'Title.Caption'#6#4'Size'#0#1#11'ButtonStyle'#7#17'cbsCheckboxColu'
+  +'mn'#13'Title.Caption'#6#10'Allow Null'#5'Width'#2'Z'#0#1#11'ButtonStyle'#7
+  +#17'cbsCheckboxColumn'#13'Title.Caption'#6#5'P-Key'#11'Title.Color'#4#219#216
+  +#174#0#16'Title.Font.Color'#4#12#8#253#0#0#1#13'Title.Caption'#6#13'Default '
+  +'Value'#5'Width'#2'x'#0#0#10'FixedColor'#4#207#218#221#0#9'FixedCols'#2#0#7
+  +'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'#10'goHor'
+  +'zLine'#13'goRangeSelect'#9'goEditing'#14'goSmoothScroll'#0#8'RowCount'#2#3#8
+  +'TabOrder'#2#1#13'OnEditingDone'#7#25'StringGrid1PickListSelect'#7'OnKeyUp'#7
+  +#16'StringGrid1KeyUp'#9'OnMouseUp'#7#18'StringGrid1MouseUp'#16'OnPickListSel'
+  +'ect'#7#25'StringGrid1PickListSelect'#0#0#7'TBitBtn'#7'BitBtn2'#4'Left'#3#216
+  +#1#6'Height'#2' '#3'Top'#3#232#1#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'akB'
+  +'ottom'#0#6'Cancel'#9#7'Caption'#6#6'Cancel'#5'Color'#4#219#242#247#0#4'Kind'
+  +#7#8'bkCancel'#11'ModalResult'#2#2#8'TabOrder'#2#2#0#0#7'TBitBtn'#8'bbScript'
+  +#4'Left'#2#5#6'Height'#2' '#3'Top'#3#232#1#5'Width'#2'v'#7'Anchors'#11#6'akL'
+  +'eft'#8'akBottom'#0#7'Caption'#6#6'Script'#5'Color'#4#219#242#247#0#7'Defaul'
+  +'t'#9#4'Kind'#7#5'bkYes'#7'OnClick'#7#13'bbScriptClick'#8'TabOrder'#2#3#0#0#9
+  +'TCheckBox'#11'cxCreateGen'#4'Left'#2#8#6'Height'#2#22#3'Top'#3#193#1#5'Widt'
+  +'h'#3'F'#1#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6'+Create Auto i'
+  +'ncrement Generator and Trigger'#7'OnClick'#7#16'cxCreateGenClick'#8'TabOrde'
+  +'r'#2#4#0#0#0
 ]);

+ 34 - 30
newtable.pas

@@ -14,19 +14,14 @@ type
   { TfmNewTable }
 
   TfmNewTable = class(TForm)
-    bbCreate: TBitBtn;
     bbScript: TBitBtn;
     BitBtn2: TBitBtn;
     cxCreateGen: TCheckBox;
     edNewTable: TEdit;
     Label1: TLabel;
-    SQLQuery1: TSQLQuery;
     StringGrid1: TStringGrid;
-    SynAutoComplete1: TSynAutoComplete;
-    syScript: TSynEdit;
-    SynSQLSyn1: TSynSQLSyn;
-    procedure bbCreateClick(Sender: TObject);
     procedure bbScriptClick(Sender: TObject);
+    procedure cxCreateGenClick(Sender: TObject);
     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     procedure StringGrid1ChangeBounds(Sender: TObject);
     procedure StringGrid1EditingDone(Sender: TObject);
@@ -34,14 +29,13 @@ type
       Shift: TShiftState);
     procedure StringGrid1MouseUp(Sender: TObject; Button: TMouseButton;
       Shift: TShiftState; X, Y: Integer);
-    function GenerateCreateSQL: string;
+    function GenerateCreateSQL(var KeyField, GeneratorName: string): string;
     procedure Init(dbIndex: Integer);
     procedure StringGrid1PickListSelect(Sender: TObject);
   private
     fdbIndex: Integer;
     { private declarations }
   public
-    GeneratorName: string;
     { public declarations }
   end; 
 
@@ -55,7 +49,7 @@ implementation
 uses SysTables, Main;
 
 
-function TfmNewTable.GenerateCreateSQL: string;
+function TfmNewTable.GenerateCreateSQL(var KeyField, GeneratorName: string): string;
 var
   i: Integer;
   FieldLine: string;
@@ -85,6 +79,7 @@ begin
       begin
         PKey:= PKey + StringGrid1.Cells[0, i] + ',';
         GeneratorName:= Trim(edNewTable.Text) + '_' + StringGrid1.Cells[0, i] + '_Gen';
+        KeyField:= StringGrid1.Cells[0, i]; // Generator should work if there is only one Key field
       end;
       // Default value
       if Trim(StringGrid1.Cells[5, i]) <> '' then
@@ -115,11 +110,8 @@ var
 begin
   fdbIndex:= dbIndex;
   edNewTable.Clear;
-  bbCreate.Enabled:= False;
   cxCreateGen.Checked:= False;
   StringGrid1.RowCount:= 3;
-  syScript.Lines.Clear;
-  SQLQuery1.DataBase:= fmMain.RegisteredDatabases[dbIndex].IBConnection;
 
   StringGrid1.Columns[1].PickList.Clear;
   // Add Basic types
@@ -160,27 +152,38 @@ begin
 
 end;
 
-procedure TfmNewTable.bbCreateClick(Sender: TObject);
+procedure TfmNewTable.bbScriptClick(Sender: TObject);
+var
+  List: TStringList;
+  KeyField: string;
+  GeneratorName: string;
 begin
-  StringGrid1.Row:= 1;
-  if (Trim(edNewTable.Text) <> '') then
-  begin
-    SQLQuery1.Close;
-    SQLQuery1.SQL.Text:= syScript.Lines.Text;
-    SQLQuery1.ExecSQL;
-    fmMain.RegisteredDatabases[fdbIndex].SQLTrans.Commit;
-    fmMain.AddToSQLHistory(fmMain.RegisteredDatabases[fdbIndex].RegRec.Title, 'DDL', syScript.Lines.Text);
-    MessageDlg('Table ' + edNewTable.Text + ' has been created successfully', mtInformation, [mbOk], 0);
-    ModalResult:= mrOK;
-  end
-  else
-    MessageDlg('You should enter new table name', mtError, [mbOK], 0);
+  List:= TStringList.Create;
+  List.Text:= GenerateCreateSQL(KeyField, GeneratorName);
+  if cxCreateGen.Checked then
+  begin;
+    List.Add('');
+    List.Add('-- Generator');
+    List.Add('create generator ' + GeneratorName + ';');
+
+    List.Add('-- Trigger');
+    List.Add('CREATE TRIGGER ' + GeneratorName + ' FOR ' + edNewTable.Text);
+    List.Add('ACTIVE BEFORE INSERT POSITION 0 ');
+    List.Add('AS BEGIN ');
+    List.Add('IF (NEW.' + KeyField + ' IS NULL OR NEW.' + KeyField + ' = 0) THEN ');
+    List.Add('  NEW.' + KeyField + ' = GEN_ID(' + GeneratorName + ', 1);');
+    List.Add('END;');
+  end;
+
+  fmMain.ShowCompleteQueryWindow(fdbIndex, 'Create New Table: ' + edNewTable.Text, List.Text);
+  List.Free;
+  Close;
 end;
 
-procedure TfmNewTable.bbScriptClick(Sender: TObject);
+procedure TfmNewTable.cxCreateGenClick(Sender: TObject);
 begin
-  syScript.Lines.Text:= GenerateCreateSQL;
-  bbCreate.Enabled:= True;
+  if cxCreateGen.Checked and (StringGrid1.RowCount > 1) then
+    StringGrid1.Cells[3, 1]:= '1';
 end;
 
 procedure TfmNewTable.FormClose(Sender: TObject; var CloseAction: TCloseAction);
@@ -223,7 +226,8 @@ begin
   // Primary Key checked
   if (StringGrid1.Col = 4) and (StringGrid1.Cells[4, StringGrid1.Row] = '0') then
   begin
-    StringGrid1.Cells[3, StringGrid1.Row]:= '0'; // Uncheck Allow null
+    if not cxCreateGen.Checked then
+      StringGrid1.Cells[3, StringGrid1.Row]:= '0'; // Uncheck Allow null
     StringGrid1.Cells[5, StringGrid1.Row]:= ''; // Remove default value
   end;
 

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio