Kaynağa Gözat

Table references
modified: TurboBird.lpi
modified: TurboBird.lpr
modified: TurboBird.res
modified: main.pas
modified: systables.pas
modified: tablemanage.lfm
modified: tablemanage.lrs
modified: tablemanage.pas

motaz 11 yıl önce
ebeveyn
işleme
982c915eb8
8 değiştirilmiş dosya ile 358 ekleme ve 151 silme
  1. 86 81
      TurboBird.lpi
  2. 3 3
      TurboBird.lpr
  3. BIN
      TurboBird.res
  4. 2 0
      main.pas
  5. 37 0
      systables.pas
  6. 90 5
      tablemanage.lfm
  7. 113 62
      tablemanage.lrs
  8. 27 0
      tablemanage.pas

+ 86 - 81
TurboBird.lpi

@@ -17,8 +17,8 @@
       <UseVersionInfo Value="True"/>
       <AutoIncrementBuild Value="True"/>
       <MinorVersionNr Value="9"/>
-      <RevisionNr Value="12"/>
-      <BuildNr Value="1093"/>
+      <RevisionNr Value="13"/>
+      <BuildNr Value="1094"/>
       <StringTable ProductVersion="0.9"/>
     </VersionInfo>
     <BuildModes Count="1">
@@ -60,10 +60,10 @@
         <Filename Value="TurboBird.lpr"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="TurboBird"/>
-        <EditorIndex Value="7"/>
+        <EditorIndex Value="8"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="54"/>
-        <CursorPos X="33" Y="32"/>
+        <TopLine Value="1"/>
+        <CursorPos X="35" Y="5"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
       </Unit0>
@@ -76,8 +76,8 @@
         <UnitName Value="main"/>
         <EditorIndex Value="4"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="1437"/>
-        <CursorPos X="101" Y="1461"/>
+        <TopLine Value="2339"/>
+        <CursorPos X="105" Y="2348"/>
         <UsageCount Value="200"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
@@ -101,7 +101,7 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="Reg"/>
-        <EditorIndex Value="6"/>
+        <EditorIndex Value="7"/>
         <WindowIndex Value="0"/>
         <TopLine Value="243"/>
         <CursorPos X="29" Y="252"/>
@@ -243,7 +243,6 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="About"/>
-        <IsVisibleTab Value="True"/>
         <EditorIndex Value="2"/>
         <WindowIndex Value="0"/>
         <TopLine Value="67"/>
@@ -386,7 +385,7 @@
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="EditTable"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="1"/>
+        <TopLine Value="62"/>
         <CursorPos X="58" Y="90"/>
         <UsageCount Value="200"/>
       </Unit34>
@@ -466,10 +465,12 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="DataModule"/>
         <UnitName Value="SysTables"/>
+        <EditorIndex Value="5"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="713"/>
-        <CursorPos X="18" Y="749"/>
+        <TopLine Value="298"/>
+        <CursorPos X="3" Y="309"/>
         <UsageCount Value="200"/>
+        <Loaded Value="True"/>
       </Unit42>
       <Unit43>
         <Filename Value="/usr/lib/lazarus/0.9.28.2/components/synedit/syneditmiscclasses.pp"/>
@@ -545,10 +546,12 @@
         <Filename Value="scriptdb.pas"/>
         <IsPartOfProject Value="True"/>
         <UnitName Value="Scriptdb"/>
+        <EditorIndex Value="9"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="491"/>
-        <CursorPos X="46" Y="518"/>
+        <TopLine Value="445"/>
+        <CursorPos X="63" Y="445"/>
         <UsageCount Value="200"/>
+        <Loaded Value="True"/>
       </Unit51>
       <Unit52>
         <Filename Value="connectas.pas"/>
@@ -585,10 +588,14 @@
         <HasResources Value="True"/>
         <ResourceBaseClass Value="Form"/>
         <UnitName Value="TableManage"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="6"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="304"/>
-        <CursorPos X="39" Y="310"/>
+        <TopLine Value="344"/>
+        <CursorPos X="48" Y="357"/>
         <UsageCount Value="200"/>
+        <Loaded Value="True"/>
+        <LoadedDesigner Value="True"/>
       </Unit55>
       <Unit56>
         <Filename Value="/usr/lib/lazarus/0.9.29/lcl/grids.pas"/>
@@ -734,9 +741,9 @@
         <UnitName Value="SQLHistory"/>
         <EditorIndex Value="1"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="129"/>
+        <TopLine Value="128"/>
         <CursorPos X="3" Y="148"/>
-        <UsageCount Value="189"/>
+        <UsageCount Value="192"/>
         <Loaded Value="True"/>
       </Unit71>
       <Unit72>
@@ -763,7 +770,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="51" Y="14"/>
-        <UsageCount Value="160"/>
+        <UsageCount Value="163"/>
       </Unit74>
       <Unit75>
         <Filename Value="/usr/lib/lazarus/0.9.30/lcl/comctrls.pp"/>
@@ -956,7 +963,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="64"/>
         <CursorPos X="16" Y="66"/>
-        <UsageCount Value="128"/>
+        <UsageCount Value="131"/>
       </Unit98>
       <Unit99>
         <Filename Value="../../FromInternet/fpc2.4/fpc-2.4.4/packages/ibase/src/ibase60dyn.pp"/>
@@ -991,7 +998,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="15" Y="255"/>
-        <UsageCount Value="115"/>
+        <UsageCount Value="118"/>
       </Unit102>
       <Unit103>
         <Filename Value="/usr/share/fpcsrc/2.6.0/rtl/inc/systemh.inc"/>
@@ -1025,7 +1032,7 @@
         <WindowIndex Value="0"/>
         <TopLine Value="1"/>
         <CursorPos X="1" Y="1"/>
-        <UsageCount Value="61"/>
+        <UsageCount Value="64"/>
       </Unit106>
       <Unit107>
         <Filename Value="../../../lazarus/lcl/interfaces/win32/win32object.inc"/>
@@ -1101,9 +1108,9 @@
         <UnitName Value="Update"/>
         <EditorIndex Value="3"/>
         <WindowIndex Value="0"/>
-        <TopLine Value="1"/>
+        <TopLine Value="143"/>
         <CursorPos X="40" Y="171"/>
-        <UsageCount Value="25"/>
+        <UsageCount Value="28"/>
         <Loaded Value="True"/>
         <LoadedDesigner Value="True"/>
       </Unit116>
@@ -1117,12 +1124,10 @@
       </Unit117>
       <Unit118>
         <Filename Value="/usr/share/fpcsrc/2.6.2/rtl/objpas/sysutils/finah.inc"/>
-        <EditorIndex Value="5"/>
         <WindowIndex Value="0"/>
         <TopLine Value="7"/>
         <CursorPos X="10" Y="21"/>
         <UsageCount Value="10"/>
-        <Loaded Value="True"/>
       </Unit118>
       <Unit119>
         <Filename Value="/usr/share/fpcsrc/2.6.2/rtl/objpas/sysutils/fina.inc"/>
@@ -1134,124 +1139,124 @@
     </Units>
     <JumpHistory Count="30" HistoryIndex="29">
       <Position1>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1725" Column="15" TopLine="1701"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="251" Column="29" TopLine="229"/>
       </Position1>
       <Position2>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1866" Column="15" TopLine="1842"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="252" Column="36" TopLine="230"/>
       </Position2>
       <Position3>
-        <Filename Value="querywindow.pas"/>
+        <Filename Value="main.pas"/>
         <Caret Line="1" Column="1" TopLine="1"/>
       </Position3>
       <Position4>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1725" Column="15" TopLine="1701"/>
+        <Filename Value="about.pas"/>
+        <Caret Line="94" Column="66" TopLine="66"/>
       </Position4>
       <Position5>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1866" Column="15" TopLine="1866"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="310" Column="39" TopLine="304"/>
       </Position5>
       <Position6>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="311" Column="39" TopLine="305"/>
       </Position6>
       <Position7>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="79" Column="23" TopLine="56"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="315" Column="3" TopLine="313"/>
       </Position7>
       <Position8>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="87" Column="11" TopLine="64"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="755" Column="3" TopLine="751"/>
       </Position8>
       <Position9>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="141" Column="21" TopLine="118"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="315" Column="3" TopLine="313"/>
       </Position9>
       <Position10>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="356" Column="23" TopLine="333"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="755" Column="3" TopLine="742"/>
       </Position10>
       <Position11>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="365" Column="19" TopLine="341"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="1461" Column="23" TopLine="1437"/>
       </Position11>
       <Position12>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="260" Column="20" TopLine="248"/>
       </Position12>
       <Position13>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="79" Column="23" TopLine="56"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="735" Column="24" TopLine="711"/>
       </Position13>
       <Position14>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="87" Column="11" TopLine="64"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="1461" Column="23" TopLine="1437"/>
       </Position14>
       <Position15>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="141" Column="21" TopLine="118"/>
+        <Filename Value="main.pas"/>
+        <Caret Line="2027" Column="35" TopLine="2004"/>
       </Position15>
       <Position16>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="356" Column="23" TopLine="333"/>
+        <Filename Value="systables.pas"/>
+        <Caret Line="272" Column="3" TopLine="227"/>
       </Position16>
       <Position17>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="365" Column="19" TopLine="341"/>
+        <Filename Value="systables.pas"/>
+        <Caret Line="1" Column="1" TopLine="94"/>
       </Position17>
       <Position18>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="315" Column="3" TopLine="307"/>
       </Position18>
       <Position19>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="95" Column="14" TopLine="72"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="317" Column="3" TopLine="309"/>
       </Position19>
       <Position20>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="134" Column="24" TopLine="111"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="347" Column="3" TopLine="345"/>
       </Position20>
       <Position21>
-        <Filename Value="querywindow.pas"/>
-        <Caret Line="218" Column="17" TopLine="194"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="320" Column="8" TopLine="315"/>
       </Position21>
       <Position22>
-        <Filename Value="sqlhistory.pas"/>
-        <Caret Line="140" Column="21" TopLine="130"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="348" Column="3" TopLine="345"/>
       </Position22>
       <Position23>
         <Filename Value="main.pas"/>
-        <Caret Line="3860" Column="1" TopLine="3840"/>
+        <Caret Line="757" Column="1" TopLine="751"/>
       </Position23>
       <Position24>
         <Filename Value="main.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Caret Line="1143" Column="21" TopLine="1119"/>
       </Position24>
       <Position25>
-        <Filename Value="main.pas"/>
-        <Caret Line="56" Column="15" TopLine="32"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="406" Column="3" TopLine="412"/>
       </Position25>
       <Position26>
-        <Filename Value="main.pas"/>
-        <Caret Line="210" Column="19" TopLine="187"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="348" Column="21" TopLine="334"/>
       </Position26>
       <Position27>
         <Filename Value="main.pas"/>
-        <Caret Line="251" Column="29" TopLine="229"/>
+        <Caret Line="1233" Column="1" TopLine="1122"/>
       </Position27>
       <Position28>
         <Filename Value="main.pas"/>
-        <Caret Line="252" Column="36" TopLine="230"/>
+        <Caret Line="2348" Column="105" TopLine="2339"/>
       </Position28>
       <Position29>
-        <Filename Value="main.pas"/>
-        <Caret Line="1" Column="1" TopLine="1"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="349" Column="18" TopLine="344"/>
       </Position29>
       <Position30>
-        <Filename Value="about.pas"/>
-        <Caret Line="94" Column="66" TopLine="66"/>
+        <Filename Value="tablemanage.pas"/>
+        <Caret Line="359" Column="48" TopLine="344"/>
       </Position30>
     </JumpHistory>
   </ProjectOptions>

+ 3 - 3
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      :  9.Dec.2013                                          }
+{  Last updated      :  1.Jan.2014                                          }
 {  License           : GPL for GUI, LGPL for Units                          }
 {***************************************************************************}
 
@@ -27,9 +27,9 @@ uses
 const
   Major = 0;
   Minor = 9;
-  Release = 12;
+  Release = 13;
 
-  VersionDate = '2010 - December 2013';
+  VersionDate = '2010 - January 2014';
 {$IFDEF Unix}
 {$DEFINE extdecl:=cdecl}
     fbclib = 'libfbclient.' + sharedsuffix;

BIN
TurboBird.res


+ 2 - 0
main.pas

@@ -1229,6 +1229,7 @@ begin
   end;
   AQuery.Close;
   AQuery.Free;
+
   if Form.sgIndices.RowCount > 1 then
     Form.sgIndices.Row:= 1;
 end;
@@ -2353,6 +2354,7 @@ begin
     // Permissions
     fmTableManage.FillPermissions;
 
+    fmTableManage.bbRefreshReferencesClick(nil);
     fmTableManage.Show;
 
   except

+ 37 - 0
systables.pas

@@ -69,6 +69,8 @@ type
 
     procedure GetTableFields(dbIndex: Integer; ATableName: string; FieldsList: TStringList);
 
+    function GetConstraintsOfTable(ATableName: string; var SqlQuery: TSQLQuery;
+      ConstraintsList: TStringList=nil): Boolean;
 
     { public declarations }
   end; 
@@ -299,6 +301,41 @@ begin
 
 end;
 
+(**********  Get Constraints for a table Info  ********************)
+
+function TdmSysTables.GetConstraintsOfTable(ATableName: string; var SqlQuery: TSQLQuery;
+   ConstraintsList: TStringList = nil): Boolean;
+begin
+  SqlQuery.Close;
+  SqlQuery.SQL.Text:= 'select Trim(Refc.RDB$Constraint_Name) as ConstName, ' +
+    'Trim(Refc.RDB$CONST_NAME_UQ) as KeyName, ' +
+    'Trim(Ind.RDB$Relation_Name) as CurrentTableName, ' +
+    'Trim(Seg.RDB$Field_name) as CurrentFieldName, ' +
+    'Trim(Con.RDB$Relation_Name) as OtherTableName, ' +
+    'Trim(Ind.RDB$Foreign_key) as OtherFieldName, ' +
+    'RDB$Update_Rule as UpdateRule, RDB$Delete_Rule as DeleteRule ' +
+    'from RDB$RELATION_CONSTRAINTS Con, rdb$REF_Constraints Refc, RDB$INDEX_SEGMENTS Seg, ' +
+    'RDB$INDICES Ind ' +
+    'where Con.RDB$COnstraint_Name = Refc.RDB$Const_Name_UQ ' +
+    '  and Refc.RDB$COnstraint_Name = Ind.RDB$Index_Name' +
+    '  and Refc.RDB$COnstraint_Name = Seg.RDB$Index_Name' +
+    '  and Con.RDB$Relation_Name = ''' + UpperCase(ATableName) + '''';
+  SqlQuery.Open;
+  Result:= SqlQuery.RecordCount > 0;
+  with SqlQuery do
+  if Result and Assigned(ConstraintsList) then
+  begin
+    ConstraintsList.Clear;
+    while not Eof do
+    begin
+      ConstraintsList.Add(FieldByName('ConstName').AsString);
+      Next;
+    end;
+    First;
+  end;
+
+end;
+
 function TdmSysTables.GetAllConstraints(dbIndex: Integer; ConstraintsList, TablesList: TStringList): Boolean;
 begin
   Init(dbIndex);

+ 90 - 5
tablemanage.lfm

@@ -10,16 +10,16 @@ object fmTableManage: TfmTableManage
   ClientWidth = 819
   OnClose = FormClose
   Position = poScreenCenter
-  LCLVersion = '1.0.4.0'
+  LCLVersion = '1.0.14.0'
   object PageControl1: TPageControl
     Left = 0
     Height = 413
     Top = 29
     Width = 817
-    ActivePage = tsIndices
+    ActivePage = tsReferences
     Anchors = [akTop, akLeft, akRight, akBottom]
     Images = ImageList1
-    TabIndex = 1
+    TabIndex = 5
     TabOrder = 0
     object tsFields: TTabSheet
       Caption = 'Fields'
@@ -1192,6 +1192,59 @@ object fmTableManage: TfmTableManage
         TabOrder = 3
       end
     end
+    object tsReferences: TTabSheet
+      Caption = 'References'
+      ClientHeight = 382
+      ClientWidth = 813
+      ImageIndex = 5
+      object sgReferences: TStringGrid
+        Left = 0
+        Height = 278
+        Top = 0
+        Width = 813
+        Align = alTop
+        Anchors = [akTop, akLeft, akRight, akBottom]
+        ColCount = 4
+        Columns = <        
+          item
+            Title.Caption = 'Constraint name'
+            Width = 200
+          end        
+          item
+            Title.Caption = 'Foreign Table'
+            Width = 200
+          end        
+          item
+            ButtonStyle = cbsPickList
+            PickList.Strings = (
+              'Asc'
+              'Desc'
+            )
+            Title.Caption = 'Foreign Field'
+            Width = 190
+          end        
+          item
+            Title.Caption = 'On key'
+            Width = 190
+          end>
+        FixedColor = 14539471
+        FixedCols = 0
+        Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goColSizing, goRowSelect, goSmoothScroll]
+        TabOrder = 0
+      end
+      object bbRefreshReferences: TBitBtn
+        Left = 697
+        Height = 43
+        Top = 338
+        Width = 99
+        Anchors = [akRight, akBottom]
+        Caption = 'Refresh'
+        Color = 16249563
+        Kind = bkRetry
+        OnClick = bbRefreshReferencesClick
+        TabOrder = 1
+      end
+    end
   end
   object bbClose: TBitBtn
     Left = 791
@@ -1211,7 +1264,7 @@ object fmTableManage: TfmTableManage
     left = 688
     top = 240
     Bitmap = {
-      4C69050000001000000010000000EFFCFEFFF4FEFEFFFFFDFCFFFFFDFCFFFFFA
+      4C69060000001000000010000000EFFCFEFFF4FEFEFFFFFDFCFFFFFDFCFFFFFA
       FFFFFFF7FEFFFFFCFFFFFFFDFDFFFFFDF8FFFFFEF4FFF9FEF5FFFCFEFEFFFFF8
       FFFFFFF6FFFFF9F1FCFFFFFBFFFFF4FFFFFFF8FFFFFFEFF3EEFFFFFFFCFFFFFA
       FCFFF9F3F8FFFFFDFFFFFFFFFFFFFAFDF4FFFDFFF7FFF8FFF6FFFDFFFEFFF7F3
@@ -1371,7 +1424,39 @@ object fmTableManage: TfmTableManage
       FFFFFDFFFFFFFBFDFDFFFDFFFFFFFDFFFFFFFDFFFFFFF6F8F9FFFDFEFFFFFBFE
       FFFFFBFDFFFFF8FAFFFFF4F6FFFFFAFFFF00F6FBFCFFFBFFFFFFFAFFFDFFFDFF
       FEFFFAFEF8FFF7FBF5FFFDFFF9FFFAFFF6FFFDFFF9FFFDFFFCFFFDFFFCFFF8FD
-      FCFFF4F9F8FFFAFFFF00FAFFFF00
+      FCFFF4F9F8FFFAFFFF00FAFFFF00000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000506050003040402030303010404040000000000000000000506
+      0500030404020303030104040400000000000000000000000000000000000505
+      050000000001494B4A245F61616F3B3E3D1C3E403F000404040000000001484A
+      49245F61616F3B3D3C1C3D403F00000000000000000000000000616463002A2C
+      2B0F76787761B6B7B7D0B3B5B4E14C4E4D2953565500282A290F75777662B5B7
+      B6D0B3B5B4E14A4C4C295052510000000000323433000F1110056668683EA3A5
+      A4AED6D8D7F6EFF2F1FFC7C9C8E24A4C4B2C6668673BA3A4A4AED6D8D7F6EFF2
+      F0FFC6C8C7E351525228565858005E616000555857128B8E8D85C7C9C8E8EAED
+      EBFFF2F4F3FFF2F5F3FFC5C7C6EA838585A3C6C9C8E6E7EAE8FFEFF1F0FFEEF1
+      EFFFC8CAC9E26062612762656400636766005A5D5C1196989885D0D3D2E8EAED
+      EBFFF2F4F3FFF6F8F7FFCDCFCEEA909392A2D0D3D2E6E9ECEBFFF2F4F3FFF5F7
+      F6FFD2D4D3E275787727777B790000000000636766003D4140049194933CBFC2
+      C1ACE4E6E5F5F7F9F8FFDADCDBE18589872A9094933ABFC3C1ACE4E6E5F5F7F9
+      F8FFDADCDBE28B908E278C918F00000000000000000041454400ADB2B0008085
+      830EB2B6B45FD7DAD9CFD5D8D7E0A4A9A727A3A8A6007F84820EB1B6B45FD7DA
+      D9CFD5D8D7E0A3A8A627A0A6A40000000000000000000000000000000000858B
+      890000000000AFB4B222B8BEBC6BB4BAB81AAEB5B2008288860000000000AEB4
+      B222B8BEBC6BB3B9B71AAEB4B200000000000000000000000000000000000000
+      000000000000F8FBFA00E2E6E501F3F6F501F4F7F6000000000000000000F5F7
+      F500DFE3E001F0F2F101F1F3F100000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000000000000000000000000000000000000000
+      0000000000000000000000000000
     }
   end
   object SQLQuery1: TSQLQuery

+ 113 - 62
tablemanage.lrs

@@ -1,56 +1,58 @@
+{ This is an automatically generated lazarus resource file }
+
 LazarusResources.Add('TfmTableManage','FORMDATA',[
   'TPF0'#14'TfmTableManage'#13'fmTableManage'#4'Left'#3'B'#1#6'Height'#3#192#1#3
   +'Top'#3#200#0#5'Width'#3'3'#3#13'ActiveControl'#7#12'PageControl1'#7'Anchors'
   +#11#5'akTop'#6'akLeft'#7'akRight'#0#7'Caption'#6#16'Table Management'#12'Cli'
   +'entHeight'#3#192#1#11'ClientWidth'#3'3'#3#7'OnClose'#7#9'FormClose'#8'Posit'
-  +'ion'#7#14'poScreenCenter'#10'LCLVersion'#6#7'1.0.4.0'#0#12'TPageControl'#12
+  +'ion'#7#14'poScreenCenter'#10'LCLVersion'#6#8'1.0.14.0'#0#12'TPageControl'#12
   +'PageControl1'#4'Left'#2#0#6'Height'#3#157#1#3'Top'#2#29#5'Width'#3'1'#3#10
-  +'ActivePage'#7#9'tsIndices'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'ak'
-  +'Bottom'#0#6'Images'#7#10'ImageList1'#8'TabIndex'#2#1#8'TabOrder'#2#0#0#9'TT'
-  +'abSheet'#8'tsFields'#7'Caption'#6#6'Fields'#12'ClientHeight'#3'~'#1#11'Clie'
-  +'ntWidth'#3'-'#3#0#11'TStringGrid'#8'sgFields'#4'Left'#2#0#6'Height'#3'D'#1#3
-  +'Top'#2#0#5'Width'#3'-'#3#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akLef'
-  +'t'#7'akRight'#8'akBottom'#0#8'ColCount'#2#7#7'Columns'#14#1#11'ButtonStyle'
-  +#7#17'cbsCheckboxColumn'#5'Color'#4#234#219#219#0#7'MaxSize'#2'2'#8'ReadOnly'
-  +#9#13'Title.Caption'#6#5'P-Key'#16'Title.Font.Color'#4#229'TT'#0#17'Title.Fo'
-  +'nt.Height'#2#245#16'Title.Font.Style'#11#6'fsBold'#0#5'Width'#2'2'#0#1#13'T'
-  +'itle.Caption'#6#10'Field Name'#5'Width'#3#130#0#0#1#13'Title.Caption'#6#9'D'
-  +'ata Type'#5'Width'#2'x'#0#1#13'Title.Caption'#6#4'Size'#16'Title.Font.Color'
-  +#4#21'-'#254#0#16'Title.Font.Style'#11#6'fsBold'#0#0#1#11'ButtonStyle'#7#17
-  +'cbsCheckboxColumn'#13'Title.Caption'#6#10'Allow Null'#5'Width'#2'Z'#0#1#13
-  +'Title.Caption'#6#13'Default Value'#5'Width'#2'x'#0#1#13'Title.Caption'#6#11
-  +'Description'#5'Width'#3#200#0#0#0#10'FixedColor'#4#207#218#221#0#9'FixedCol'
-  +'s'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLine'
-  +#10'goHorzLine'#11'goColSizing'#11'goColMoving'#11'goRowSelect'#14'goSmoothS'
-  +'croll'#0#8'RowCount'#2#4#8'TabOrder'#2#0#15'TitleFont.Style'#11#6'fsBold'#0
-  +#14'UseXORFeatures'#9#0#0#7'TBitBtn'#6'bbEdit'#4'Left'#3#138#0#6'Height'#2'1'
-  +#3'Top'#3'J'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'
-  +#6#4'Edit'#5'Color'#4#219#242#247#0#10'Glyph.Data'#10':'#9#0#0'6'#9#0#0'BM6'
-  +#9#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#24#0#0#0#24#0#0#0#1#0' '#0#0#0#0#0#0#9#0#0
-  +'d'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255#255#0
+  +'ActivePage'#7#12'tsReferences'#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8
+  +'akBottom'#0#6'Images'#7#10'ImageList1'#8'TabIndex'#2#5#8'TabOrder'#2#0#0#9
+  +'TTabSheet'#8'tsFields'#7'Caption'#6#6'Fields'#12'ClientHeight'#3'~'#1#11'Cl'
+  +'ientWidth'#3'-'#3#0#11'TStringGrid'#8'sgFields'#4'Left'#2#0#6'Height'#3'D'#1
+  +#3'Top'#2#0#5'Width'#3'-'#3#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akL'
+  +'eft'#7'akRight'#8'akBottom'#0#8'ColCount'#2#7#7'Columns'#14#1#11'ButtonStyl'
+  +'e'#7#17'cbsCheckboxColumn'#5'Color'#4#234#219#219#0#7'MaxSize'#2'2'#8'ReadO'
+  +'nly'#9#13'Title.Caption'#6#5'P-Key'#16'Title.Font.Color'#4#229'TT'#0#17'Tit'
+  +'le.Font.Height'#2#245#16'Title.Font.Style'#11#6'fsBold'#0#5'Width'#2'2'#0#1
+  +#13'Title.Caption'#6#10'Field Name'#5'Width'#3#130#0#0#1#13'Title.Caption'#6
+  +#9'Data Type'#5'Width'#2'x'#0#1#13'Title.Caption'#6#4'Size'#16'Title.Font.Co'
+  +'lor'#4#21'-'#254#0#16'Title.Font.Style'#11#6'fsBold'#0#0#1#11'ButtonStyle'#7
+  +#17'cbsCheckboxColumn'#13'Title.Caption'#6#10'Allow Null'#5'Width'#2'Z'#0#1
+  +#13'Title.Caption'#6#13'Default Value'#5'Width'#2'x'#0#1#13'Title.Caption'#6
+  +#11'Description'#5'Width'#3#200#0#0#0#10'FixedColor'#4#207#218#221#0#9'Fixed'
+  +'Cols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLi'
+  +'ne'#10'goHorzLine'#11'goColSizing'#11'goColMoving'#11'goRowSelect'#14'goSmo'
+  +'othScroll'#0#8'RowCount'#2#4#8'TabOrder'#2#0#15'TitleFont.Style'#11#6'fsBol'
+  +'d'#0#14'UseXORFeatures'#9#0#0#7'TBitBtn'#6'bbEdit'#4'Left'#3#138#0#6'Height'
+  +#2'1'#3'Top'#3'J'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Ca'
+  +'ption'#6#4'Edit'#5'Color'#4#219#242#247#0#10'Glyph.Data'#10':'#9#0#0'6'#9#0
+  +#0'BM6'#9#0#0#0#0#0#0'6'#0#0#0'('#0#0#0#24#0#0#0#24#0#0#0#1#0' '#0#0#0#0#0#0
+  +#9#0#0'd'#0#0#0'd'#0#0#0#0#0#0#0#0#0#0#0#255#255#255#0#255#255#255#0#255#255
+  +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
   +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
   +#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
   +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
-  +#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255
-  +#255#255#0#255#255#255#0#255#255#255#0#0#0#0#1'+++'#6'+++'#6'+++'#6'+++'#6'+'
-  +'++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6
-  +'+++'#6'+++'#6#0#0#0#4#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255
-  +#0#0#0#0#1#140#140#140'Ehhh'#202'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212
-  +'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'
-  +#212'ddd'#212'RRR'#205#20#20#20'~'#0#0#0#4#255#255#255#0#255#255#255#0#255
-  +#255#255#0#0#0#0#2#229#229#229#241#204#204#204#255#188#188#188#255#188#188
-  +#188#255#188#188#188#255#179#179#179#255#188#188#188#255#188#188#188#255#188
-  +#188#188#255#179#179#179#255#188#188#188#255#188#188#188#255#188#188#188#255
-  +#184#184#184#255#188#188#188#255#188#188#188#255#188#188#188#255#231#231#231
-  +#255'HHH'#192'+++'#6#255#255#255#0#255#255#255#0#255#255#255#0#0#0#0#2#233
-  +#233#233#254#133#133#133#255#188#188#188#255#188#188#188#255#188#188#188#255
-  +'vvv'#255#188#188#188#255#188#188#188#255#188#188#188#255'uuu'#255#188#188
-  +#188#255#188#188#188#255#188#188#188#255'JJJ'#255'[[['#255'[[['#255'EEE'#255
-  +#232#232#232#255'XXX'#199'+++'#6#255#255#255#0#255#255#255#0#255#255#255#0#0
-  +#0#0#2#233#233#233#254#145#145#145#255#232#232#232#255#232#232#232#255#232
-  +#232#232#255#145#145#145#255#232#232#232#255#232#232#232#255#232#232#232#255
-  +#145#145#145#255#232#232#232#255#232#232#232#255#232#232#232#255'UUU'#255'dd'
-  +'d'#255'ddd'#255'RRR'#255#232#232#232#255'XXX'#199'+++'#6#255#255#255#0#255
+  +#255#255#255#0#255#255#255#0#255#255#255#0#0#0#0#1'+++'#6'+++'#6'+++'#6'+++'
+  +#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'#6'+++'
+  +#6'+++'#6'+++'#6#0#0#0#4#255#255#255#0#255#255#255#0#255#255#255#0#255#255
+  +#255#0#0#0#0#1#140#140#140'Ehhh'#202'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'
+  +#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212'ddd'#212
+  +'ddd'#212'ddd'#212'RRR'#205#20#20#20'~'#0#0#0#4#255#255#255#0#255#255#255#0
+  +#255#255#255#0#0#0#0#2#229#229#229#241#204#204#204#255#188#188#188#255#188
+  +#188#188#255#188#188#188#255#179#179#179#255#188#188#188#255#188#188#188#255
+  +#188#188#188#255#179#179#179#255#188#188#188#255#188#188#188#255#188#188#188
+  +#255#184#184#184#255#188#188#188#255#188#188#188#255#188#188#188#255#231#231
+  +#231#255'HHH'#192'+++'#6#255#255#255#0#255#255#255#0#255#255#255#0#0#0#0#2
+  +#233#233#233#254#133#133#133#255#188#188#188#255#188#188#188#255#188#188#188
+  +#255'vvv'#255#188#188#188#255#188#188#188#255#188#188#188#255'uuu'#255#188
+  +#188#188#255#188#188#188#255#188#188#188#255'JJJ'#255'[[['#255'[[['#255'EEE'
+  +#255#232#232#232#255'XXX'#199'+++'#6#255#255#255#0#255#255#255#0#255#255#255
+  +#0#0#0#0#2#233#233#233#254#145#145#145#255#232#232#232#255#232#232#232#255
+  +#232#232#232#255#145#145#145#255#232#232#232#255#232#232#232#255#232#232#232
+  +#255#145#145#145#255#232#232#232#255#232#232#232#255#232#232#232#255'UUU'#255
+  +'ddd'#255'ddd'#255'RRR'#255#232#232#232#255'XXX'#199'+++'#6#255#255#255#0#255
   +#255#255#0#255#255#255#0#0#0#0#2#233#233#233#254#145#145#145#255#232#232#232
   +#255#232#232#232#255#232#232#232#255#145#145#145#255#232#232#232#255#232#232
   +#232#255#232#232#232#255#145#145#145#255#232#232#232#255#232#232#232#255#232
@@ -962,12 +964,27 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   ,#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255
   +#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0#255#255#255#0
   +#255#255#255#0#24'qG6'#0#128#0#2#255#255#255#0#255#255#255#0#7'OnClick'#7#14
-  +'bbAddUserClick'#8'TabOrder'#2#3#0#0#0#0#7'TBitBtn'#7'bbClose'#4'Left'#3#23#3
-  +#6'Height'#2#24#3'Top'#2#0#5'Width'#2#27#7'Anchors'#11#5'akTop'#7'akRight'#0
-  +#7'Caption'#6#4' X  '#5'Color'#4#219#242#247#0#10'Font.Style'#11#6'fsBold'#0
-  +#7'OnClick'#7#12'bbCloseClick'#10'ParentFont'#8#8'TabOrder'#2#1#0#0#10'TImag'
-  +'eList'#10'ImageList1'#12'DrawingStyle'#7#7'dsFocus'#4'left'#3#176#2#3'top'#3
-  +#240#0#6'Bitmap'#10#14#20#0#0'Li'#5#0#0#0#16#0#0#0#16#0#0#0#239#252#254#255
+  +'bbAddUserClick'#8'TabOrder'#2#3#0#0#0#9'TTabSheet'#12'tsReferences'#7'Capti'
+  +'on'#6#10'References'#12'ClientHeight'#3'~'#1#11'ClientWidth'#3'-'#3#10'Imag'
+  +'eIndex'#2#5#0#11'TStringGrid'#12'sgReferences'#4'Left'#2#0#6'Height'#3#22#1
+  +#3'Top'#2#0#5'Width'#3'-'#3#5'Align'#7#5'alTop'#7'Anchors'#11#5'akTop'#6'akL'
+  +'eft'#7'akRight'#8'akBottom'#0#8'ColCount'#2#4#7'Columns'#14#1#13'Title.Capt'
+  +'ion'#6#15'Constraint name'#5'Width'#3#200#0#0#1#13'Title.Caption'#6#13'Fore'
+  +'ign Table'#5'Width'#3#200#0#0#1#11'ButtonStyle'#7#11'cbsPickList'#16'PickLi'
+  +'st.Strings'#1#6#3'Asc'#6#4'Desc'#0#13'Title.Caption'#6#13'Foreign Field'#5
+  +'Width'#3#190#0#0#1#13'Title.Caption'#6#6'On key'#5'Width'#3#190#0#0#0#10'Fi'
+  +'xedColor'#4#207#218#221#0#9'FixedCols'#2#0#7'Options'#11#15'goFixedVertLine'
+  +#15'goFixedHorzLine'#10'goVertLine'#10'goHorzLine'#13'goRangeSelect'#11'goCo'
+  +'lSizing'#11'goRowSelect'#14'goSmoothScroll'#0#8'TabOrder'#2#0#0#0#7'TBitBtn'
+  +#19'bbRefreshReferences'#4'Left'#3#185#2#6'Height'#2'+'#3'Top'#3'R'#1#5'Widt'
+  +'h'#2'c'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#7'Refresh'#5'Co'
+  +'lor'#4#219#242#247#0#4'Kind'#7#7'bkRetry'#7'OnClick'#7#24'bbRefreshReferenc'
+  +'esClick'#8'TabOrder'#2#1#0#0#0#0#7'TBitBtn'#7'bbClose'#4'Left'#3#23#3#6'Hei'
+  +'ght'#2#24#3'Top'#2#0#5'Width'#2#27#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Ca'
+  +'ption'#6#4' X  '#5'Color'#4#219#242#247#0#10'Font.Style'#11#6'fsBold'#0#7'O'
+  +'nClick'#7#12'bbCloseClick'#10'ParentFont'#8#8'TabOrder'#2#1#0#0#10'TImageLi'
+  +'st'#10'ImageList1'#12'DrawingStyle'#7#7'dsFocus'#4'left'#3#176#2#3'top'#3
+  +#240#0#6'Bitmap'#10#14#24#0#0'Li'#6#0#0#0#16#0#0#0#16#0#0#0#239#252#254#255
   +#244#254#254#255#255#253#252#255#255#253#252#255#255#250#255#255#255#247#254
   +#255#255#252#255#255#255#253#253#255#255#253#248#255#255#254#244#255#249#254
   +#245#255#252#254#254#255#255#248#255#255#255#246#255#255#249#241#252#255#255
@@ -1008,7 +1025,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#255#232#255#244#255#245#255#239#255#241#255#203#255#213#255#194#255#205#255
   +#212#255#219#255#218#255#224#255#214#255#219#255#209#255#212#255#230#255#232
   +#255#240#255#240#255#236#255#240#255#219#255#222#255#209#255#214#255#209#255
-  +#214#255#205#254#208#255#224#255#228#255#216#243#217#255#220#254#223#255#206
+  ,#214#255#205#254#208#255#224#255#228#255#216#243#217#255#220#254#223#255#206
   +#255#209#255#198#255#203#255#209#255#214#255#209#255#214#255#205#255#211#255
   +#209#255#216#255#214#252#216#255#230#255#231#255#10'%'#17#255#31'>#'#255#13
   +'2'#12#255#8'-'#5#255#24'7'#24#255#18'-'#19#255':O9'#255#13')'#12#255#8'1'#4
@@ -1023,7 +1040,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#251#255#244#255#251#255#249#255#253#255#255#253#253#255#255#250#254#255#255
   +#250#255#255#241#255#255#255#236#255#255#255#248#251#255#255#245#246#255#255
   +#246#252#255#255#229#243#255#255#236#254#255#255#239#253#255#255#251#251#255
-  ,#255#255#250#255#255#246#255#252#255#245#255#249#255#250#255#253#255#255#255
+  +#255#255#250#255#255#246#255#252#255#245#255#249#255#250#255#253#255#255#255
   +#254#255#255#252#255#255#255#251#255#255#247#252#255#255#243#255#255#255#251
   +#254#255#255#247#246#255#255#249#252#255#255#250#254#255#255#243#254#255#255
   +#239#248#252#255#245#245#251#255#255#253#255#255#255#255#254#255#253#254#252
@@ -1072,7 +1089,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#254#255#255#225#255#255#255#228#253#255#255#228#255#255#255#221#255#255#255
   +#230#255#255#255#253#253#255#255#255#248#255#255#248#255#255#255#248#254#255
   +#255#246#247#255#255#250#247#255#255#244#236#255#255#248#243#255#255#243#242
-  +#255#255#246#250#255#255#244#251#255#255#240#246#255#255#244#249#255#255#240
+  ,#255#255#246#250#255#255#244#251#255#255#240#246#255#255#244#249#255#255#240
   +#244#255#255#244#247#255#255#243#246#255#255#238#238#255#255#241#243#255#255
   +#236#243#240#255#250#255#255#255#244#247#255#255#224#223#255#255#163#157#206
   +#255#173#167#216#255#248#246#255#255#246#250#255#255#181#185#203#255#164#169
@@ -1087,7 +1104,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#252#254#254#255#239#250#255#255'^i'#155#255'ki'#194#255#176#172#247#255#241
   +#244#255#255#253#255#249#255#248#248#254#255#244#243#255#255'db'#194#255'jj'
   +#220#255'^f'#196#255'kq'#190#255'jg'#165#255#242#234#255#255#255#255#252#255
-  ,#250#249#255#255#222#230#255#255'it'#174#255'cg'#182#255#206#209#255#255#248
+  +#250#249#255#255#222#230#255#255'it'#174#255'cg'#182#255#206#209#255#255#248
   +#254#255#255#251#255#246#255#251#252#255#255#239#235#255#255#148#140#255#255
   +'ZT'#225#255'UT'#210#255'cf'#200#255#215#217#255#255#231#233#255#255#252#245
   +#252#255#251#246#255#255#216#214#255#255'!#q'#255'"-g'#255#234#246#255#255
@@ -1136,7 +1153,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +'m_5'#255#247#244#246#255#255#255#254#255#255#255#248#255#254#255#235#255#255
   +#255#228#255'\j:'#255#255#255#217#255#251#255#211#255#249#255#210#255#251#255
   +#213#255#245#255#211#255#255#255#226#255#255#255#231#255#255#255#233#255#255
-  +#255#244#255#255#255#247#255#255#253#255#255#255#254#255#255#246#243#235#255
+  ,#255#244#255#255#255#247#255#255#253#255#255#255#254#255#255#246#243#235#255
   +#255#255#241#255#255#255#233#255'Va3'#255#255#255#218#255'F]'#31#255'>W'#25
   +#255'E^&'#255'H]0'#255#238#255#221#255#255#255#241#255#253#254#245#255#255
   +#253#254#255#252#242#248#255#246#244#250#255#255#254#255#255#255#251#246#255
@@ -1151,7 +1168,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#255#246#255#254#255#247#252#255#255#251#253#255#255'.a/'#255'"U#'#255'-^,'
   +#255'*Y('#255'+Z)'#255'/`.'#255'$T$'#255'+\.'#255',\2'#255'5c?'#255'!I-'#255
   +#225#255#235#255#239#255#247#255#237#253#242#255#248#255#251#255#245#252#247
-  ,#255#219#255#238#255#225#255#242#255#206#242#220#255#235#255#241#255#239#255
+  +#255#219#255#238#255#225#255#242#255#206#242#220#255#235#255#241#255#239#255
   +#242#255#229#250#228#255#243#255#241#255#241#255#238#255#243#255#240#255#226
   +#251#225#255#239#255#238#255#232#255#231#255#210#238#208#255#240#255#236#255
   +#241#255#235#255#234#255#228#255#230#255#247#255#223#251#238#255#224#248#236
@@ -1200,7 +1217,7 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#255#251#252#255#255'poy'#255'jir'#255'qqw'#255'nnt'#255'ppv'#255'eek'#255's'
   +'r{'#255'qpy'#255#250#250#255#255#247#247#255#255#250#251#255#255#138#139#153
   +#255#131#132#146#255#250#251#255#255#251#251#255#255#244#245#255#255#253#252
-  +#255#255#253#252#255#255#251#251#255#255#253#253#255#255#252#252#255#255#253
+  ,#255#255#253#252#255#255#251#251#255#255#253#253#255#255#252#252#255#255#253
   +#253#255#255#253#252#255#255#239#238#247#255#251#251#255#255#251#251#255#255
   +#248#249#255#255#148#149#163#255#141#142#156#255#250#251#255#255#251#251#255
   +#255'jku'#255'lku'#255#253#252#255#255'eek'#255'llr'#255#248#248#254#255#253
@@ -1215,15 +1232,49 @@ LazarusResources.Add('TfmTableManage','FORMDATA',[
   +#127#156#255#250#247#255#255#242#239#255#255#251#247#255#255#248#245#255#255
   +#253#248#255#255#249#245#255#255#251#248#255#255#249#246#255#255#248#245#255
   +#255#253#250#255#255#250#246#255#255#250#245#255#255#251#248#255#255#245#242
-  ,#255#255#250#247#255#255#250#247#255#255#250#252#255#255#248#251#255#255#251
+  +#255#255#250#247#255#255#250#247#255#255#250#252#255#255#248#251#255#255#251
   +#253#255#255#248#251#255#255#253#254#255#255#253#255#255#255#251#253#253#255
   +#253#255#255#255#253#255#255#255#253#255#255#255#246#248#249#255#253#254#255
   +#255#251#254#255#255#251#253#255#255#248#250#255#255#244#246#255#255#250#255
   +#255#0#246#251#252#255#251#255#255#255#250#255#253#255#253#255#254#255#250
   +#254#248#255#247#251#245#255#253#255#249#255#250#255#246#255#253#255#249#255
   +#253#255#252#255#253#255#252#255#248#253#252#255#244#249#248#255#250#255#255
-  +#0#250#255#255#0#0#0#9'TSQLQuery'#9'SQLQuery1'#9'FieldDefs'#14#0#14'AutoCalc'
-  +'Fields'#8#6'Params'#14#0#4'left'#3#232#2#3'top'#3'('#1#0#0#9'TSQLQuery'#9'S'
-  +'QLQuery2'#9'FieldDefs'#14#0#14'AutoCalcFields'#8#6'Params'#14#0#4'left'#3'x'
-  +#2#3'top'#3#24#1#0#0#0
+  +#0#250#255#255#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#5#6#5#0
+  +#3#4#4#2#3#3#3#1#4#4#4#0#0#0#0#0#0#0#0#0#5#6#5#0#3#4#4#2#3#3#3#1#4#4#4#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#5#5#5#0#0#0#0#1'IKJ$_aao;>='#28'>@?'#0#4#4#4#0#0
+  +#0#0#1'HJI$_aao;=<'#28'=@?'#0#0#0#0#0#0#0#0#0#0#0#0#0'adc'#0'*,+'#15'vxwa'
+  +#182#183#183#208#179#181#180#225'LNM)SVU'#0'(*)'#15'uwvb'#181#183#182#208#179
+  +#181#180#225'JLL)PRQ'#0#0#0#0#0'243'#0#15#17#16#5'fhh>'#163#165#164#174#214
+  +#216#215#246#239#242#241#255#199#201#200#226'JLK,fhg;'#163#164#164#174#214
+  +#216#215#246#239#242#240#255#198#200#199#227'QRR(VXX'#0'^a`'#0'UXW'#18#139
+  +#142#141#133#199#201#200#232#234#237#235#255#242#244#243#255#242#245#243#255
+  +#197#199#198#234#131#133#133#163#198#201#200#230#231#234#232#255#239#241#240
+  +#255#238#241#239#255#200#202#201#226'`ba''bed'#0'cgf'#0'Z]\'#17#150#152#152
+  +#133#208#211#210#232#234#237#235#255#242#244#243#255#246#248#247#255#205#207
+  +#206#234#144#147#146#162#208#211#210#230#233#236#235#255#242#244#243#255#245
+  +#247#246#255#210#212#211#226'uxw''w{y'#0#0#0#0#0'cgf'#0'=A@'#4#145#148#147'<'
+  +#191#194#193#172#228#230#229#245#247#249#248#255#218#220#219#225#133#137#135
+  +'*'#144#148#147':'#191#195#193#172#228#230#229#245#247#249#248#255#218#220
+  +#219#226#139#144#142''''#140#145#143#0#0#0#0#0#0#0#0#0'AED'#0#173#178#176#0
+  +#128#133#131#14#178#182#180'_'#215#218#217#207#213#216#215#224#164#169#167
+  +''''#163#168#166#0#127#132#130#14#177#182#180'_'#215#218#217#207#213#216#215
+  +#224#163#168#166''''#160#166#164#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#133#139
+  +#137#0#0#0#0#0#175#180#178'"'#184#190#188'k'#180#186#184#26#174#181#178#0#130
+  +#136#134#0#0#0#0#0#174#180#178'"'#184#190#188'k'#179#185#183#26#174#180#178#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#248#251#250#0#226#230#229#1
+  +#243#246#245#1#244#247#246#0#0#0#0#0#0#0#0#0#245#247#245#0#223#227#224#1#240
+  +#242#241#1#241#243#241#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0
+  +#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#9'TSQLQuery'#9'SQLQuery1'#9'FieldDefs'#14#0
+  +#14'AutoCalcFields'#8#6'Params'#14#0#4'left'#3#232#2#3'top'#3'('#1#0#0#9'TSQ'
+  +'LQuery'#9'SQLQuery2'#9'FieldDefs'#14#0#14'AutoCalcFields'#8#6'Params'#14#0#4
+  +'left'#3'x'#2#3'top'#3#24#1#0#0#0
 ]);

+ 27 - 0
tablemanage.pas

@@ -22,6 +22,7 @@ type
     bbNewConstraint: TBitBtn;
     bbRefresh: TBitBtn;
     bbRefreshConstraint: TBitBtn;
+    bbRefreshReferences: TBitBtn;
     bbRefreshIndices: TBitBtn;
     bbRefreshTriggers: TBitBtn;
     bbNewTrigger: TBitBtn;
@@ -44,6 +45,7 @@ type
     Label3: TLabel;
     Label4: TLabel;
     PageControl1: TPageControl;
+    sgReferences: TStringGrid;
     sgTriggers: TStringGrid;
     sgPermissions: TStringGrid;
     SQLQuery1: TSQLQuery;
@@ -51,6 +53,7 @@ type
     sgFields: TStringGrid;
     sgIndices: TStringGrid;
     sgConstraints: TStringGrid;
+    tsReferences: TTabSheet;
     tsPermissions: TTabSheet;
     tsTriggers: TTabSheet;
     tsIndices: TTabSheet;
@@ -72,6 +75,7 @@ type
     procedure bbRefreshIndicesClick(Sender: TObject);
     procedure bbRefreshPermissionsClick(Sender: TObject);
     procedure bbRefreshTriggersClick(Sender: TObject);
+    procedure bbRefreshReferencesClick(Sender: TObject);
     procedure cbIndexTypeChange(Sender: TObject);
     procedure edDropClick(Sender: TObject);
     procedure edEditPermissionClick(Sender: TObject);
@@ -338,6 +342,29 @@ begin
   Show;
 end;
 
+procedure TfmTableManage.bbRefreshReferencesClick(Sender: TObject);
+begin
+  SQLTrans.Commit;
+  dmSysTables.Init(fdbIndex);
+  dmSysTables.GetConstraintsOfTable(fTableName, SQLQuery1);
+  sgReferences.RowCount:= 1;
+
+  SQLQuery1.First;
+  with SQLQuery1, sgReferences do
+  while not EOF do
+  begin
+    RowCount:= RowCount + 1;
+    Cells[0, RowCount - 1]:= FieldByName('ConstName').AsString;
+    Cells[1, RowCount - 1]:= FieldByName('CurrentTableName').AsString;
+    Cells[2, RowCount - 1]:= FieldByName('CurrentFieldName').AsString;
+    Cells[3, RowCount - 1]:= FieldByName('OtherFieldName').AsString;
+    Next;
+
+  end;
+  SQLQuery1.Close;
+
+end;
+
 procedure TfmTableManage.cbIndexTypeChange(Sender: TObject);
 begin
   case cbIndexType.ItemIndex of