mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-07-24 15:16:01 +02:00
* Finalized MySQL 5.1/5.5 support. Added ability to generate SQL from connection
git-svn-id: trunk@40575 -
This commit is contained in:
parent
fca96aeca6
commit
81ef0cf3c4
@ -73,7 +73,9 @@ Type
|
|||||||
Procedure Connect(Connectstring : String);
|
Procedure Connect(Connectstring : String);
|
||||||
Procedure DisConnect;
|
Procedure DisConnect;
|
||||||
Function CanCreateCode : Boolean;
|
Function CanCreateCode : Boolean;
|
||||||
|
Function CanCreateSQL : Boolean;
|
||||||
Procedure CreateCode;
|
Procedure CreateCode;
|
||||||
|
Procedure CreateSQL;
|
||||||
Property Engine : TFPDDEngine Read FEngine Write SetEngine;
|
Property Engine : TFPDDEngine Read FEngine Write SetEngine;
|
||||||
Property ObjectType : TObjectType Read GetCurrentObjectType;
|
Property ObjectType : TObjectType Read GetCurrentObjectType;
|
||||||
Property Description : String Read FDescription Write SetDescription;
|
Property Description : String Read FDescription Write SetDescription;
|
||||||
@ -103,7 +105,7 @@ Const
|
|||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses typinfo, datapanel;
|
uses typinfo, datapanel, frmgeneratesql;
|
||||||
|
|
||||||
{ TConnectionEditor }
|
{ TConnectionEditor }
|
||||||
|
|
||||||
@ -239,6 +241,50 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TConnectionEditor.CanCreateSQL: Boolean;
|
||||||
|
begin
|
||||||
|
Result:=(ObjectType in [otTable,otFields,otField,otTableData,otIndexDefs]);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TConnectionEditor.CreateSQL;
|
||||||
|
|
||||||
|
Var
|
||||||
|
N,PN,PPN : TTreeNode;
|
||||||
|
TN : String;
|
||||||
|
TS : TDDTableDefs;
|
||||||
|
L : TStringList;
|
||||||
|
begin
|
||||||
|
N:=FTV.Selected;
|
||||||
|
If N=Nil then
|
||||||
|
exit;
|
||||||
|
If Assigned(N.Parent) then
|
||||||
|
begin
|
||||||
|
PN:=N.Parent;
|
||||||
|
If Assigned(PN) then
|
||||||
|
PPN:=PN.Parent;
|
||||||
|
end;
|
||||||
|
Case ObjectType of
|
||||||
|
otTable : TN:=N.Text;
|
||||||
|
otFields,
|
||||||
|
otTableData,
|
||||||
|
otIndexDefs : TN:=PN.Text;
|
||||||
|
otField : TN:=PPN.Text;
|
||||||
|
end;
|
||||||
|
TS:=TDDTableDefs.Create(TDDTableDef);
|
||||||
|
try
|
||||||
|
L:=TStringList.Create;
|
||||||
|
try
|
||||||
|
L.Add(TN);
|
||||||
|
FEngine.ImportTables(TS,L,True);
|
||||||
|
finally
|
||||||
|
L.Free;
|
||||||
|
end;
|
||||||
|
TGenerateSQLForm.GenerateSQLDialog(TS,TN,False);
|
||||||
|
finally
|
||||||
|
TS.Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TConnectionEditor.CreateCode;
|
procedure TConnectionEditor.CreateCode;
|
||||||
|
|
||||||
Var
|
Var
|
||||||
|
@ -8,7 +8,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
ClientHeight = 395
|
ClientHeight = 395
|
||||||
ClientWidth = 812
|
ClientWidth = 812
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '1.1'
|
||||||
object PCSQL: TPageControl
|
object PCSQL: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 359
|
Height = 359
|
||||||
@ -25,17 +25,17 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
ChildSizing.ShrinkHorizontal = crsScaleChilds
|
||||||
ChildSizing.ShrinkVertical = crsScaleChilds
|
ChildSizing.ShrinkVertical = crsScaleChilds
|
||||||
ChildSizing.ControlsPerLine = 3
|
ChildSizing.ControlsPerLine = 3
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
OnResize = TSResize
|
OnResize = TSResize
|
||||||
object POptions: TPanel
|
object POptions: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 333
|
Height = 325
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 254
|
Width = 254
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 254
|
ClientWidth = 254
|
||||||
Constraints.MinWidth = 180
|
Constraints.MinWidth = 180
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
@ -76,11 +76,11 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object CBTables: TComboBox
|
object CBTables: TComboBox
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 21
|
Height = 24
|
||||||
Top = 26
|
Top = 26
|
||||||
Width = 238
|
Width = 238
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
ItemHeight = 13
|
ItemHeight = 0
|
||||||
OnChange = CBTablesChange
|
OnChange = CBTablesChange
|
||||||
Sorted = True
|
Sorted = True
|
||||||
Style = csDropDownList
|
Style = csDropDownList
|
||||||
@ -89,7 +89,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
object BGenerate: TButton
|
object BGenerate: TButton
|
||||||
Left = 4
|
Left = 4
|
||||||
Height = 25
|
Height = 25
|
||||||
Top = 304
|
Top = 296
|
||||||
Width = 238
|
Width = 238
|
||||||
Anchors = [akLeft, akRight, akBottom]
|
Anchors = [akLeft, akRight, akBottom]
|
||||||
BorderSpacing.InnerBorder = 4
|
BorderSpacing.InnerBorder = 4
|
||||||
@ -100,7 +100,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object SEindent: TTISpinEdit
|
object SEindent: TTISpinEdit
|
||||||
Left = 204
|
Left = 204
|
||||||
Height = 21
|
Height = 18
|
||||||
Top = 202
|
Top = 202
|
||||||
Width = 34
|
Width = 34
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
@ -109,7 +109,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object SELineLength: TTISpinEdit
|
object SELineLength: TTISpinEdit
|
||||||
Left = 205
|
Left = 205
|
||||||
Height = 21
|
Height = 18
|
||||||
Top = 231
|
Top = 231
|
||||||
Width = 34
|
Width = 34
|
||||||
Anchors = [akTop, akRight]
|
Anchors = [akTop, akRight]
|
||||||
@ -135,9 +135,9 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object CBIgnoreSelection: TCheckBox
|
object CBIgnoreSelection: TCheckBox
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 17
|
Height = 26
|
||||||
Top = 257
|
Top = 257
|
||||||
Width = 159
|
Width = 170
|
||||||
Caption = 'Create full table creation SQL'
|
Caption = 'Create full table creation SQL'
|
||||||
TabOrder = 5
|
TabOrder = 5
|
||||||
end
|
end
|
||||||
@ -147,12 +147,12 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
AnchorSideLeft.Side = asrBottom
|
AnchorSideLeft.Side = asrBottom
|
||||||
AnchorSideRight.Control = PSelectFields
|
AnchorSideRight.Control = PSelectFields
|
||||||
Left = 254
|
Left = 254
|
||||||
Height = 333
|
Height = 325
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 262
|
Width = 262
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 262
|
ClientWidth = 262
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object LLBKeyFields: TLabel
|
object LLBKeyFields: TLabel
|
||||||
@ -169,24 +169,26 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object LBKeyFields: TListBox
|
object LBKeyFields: TListBox
|
||||||
Left = 2
|
Left = 2
|
||||||
Height = 288
|
Height = 280
|
||||||
Top = 34
|
Top = 34
|
||||||
Width = 256
|
Width = 256
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
MultiSelect = True
|
MultiSelect = True
|
||||||
|
ScrollWidth = 252
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object PSelectFields: TPanel
|
object PSelectFields: TPanel
|
||||||
Left = 516
|
Left = 516
|
||||||
Height = 333
|
Height = 325
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 288
|
Width = 288
|
||||||
Align = alRight
|
Align = alRight
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 288
|
ClientWidth = 288
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
object Label2: TLabel
|
object Label2: TLabel
|
||||||
@ -203,20 +205,22 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object LBFields: TListBox
|
object LBFields: TListBox
|
||||||
Left = 12
|
Left = 12
|
||||||
Height = 288
|
Height = 280
|
||||||
Top = 34
|
Top = 34
|
||||||
Width = 266
|
Width = 266
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
ItemHeight = 0
|
ItemHeight = 0
|
||||||
MultiSelect = True
|
MultiSelect = True
|
||||||
|
ScrollWidth = 262
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
|
TopIndex = -1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object TSSelect: TTabSheet
|
object TSSelect: TTabSheet
|
||||||
Caption = '&Select'
|
Caption = '&Select'
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
object MSelect: TMemo
|
object MSelect: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -233,7 +237,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object TSInsert: TTabSheet
|
object TSInsert: TTabSheet
|
||||||
Caption = '&Insert'
|
Caption = '&Insert'
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
object MInsert: TMemo
|
object MInsert: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -250,7 +254,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object TSUpdate: TTabSheet
|
object TSUpdate: TTabSheet
|
||||||
Caption = '&Update'
|
Caption = '&Update'
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
object MUpdate: TMemo
|
object MUpdate: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -267,7 +271,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object TSDelete: TTabSheet
|
object TSDelete: TTabSheet
|
||||||
Caption = '&Delete'
|
Caption = '&Delete'
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
object MDelete: TMemo
|
object MDelete: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
@ -284,7 +288,7 @@ object GenerateSQLForm: TGenerateSQLForm
|
|||||||
end
|
end
|
||||||
object TSCreate: TTabSheet
|
object TSCreate: TTabSheet
|
||||||
Caption = 'Create table'
|
Caption = 'Create table'
|
||||||
ClientHeight = 333
|
ClientHeight = 325
|
||||||
ClientWidth = 804
|
ClientWidth = 804
|
||||||
object MCreate: TMemo
|
object MCreate: TMemo
|
||||||
Left = 8
|
Left = 8
|
||||||
|
@ -72,9 +72,11 @@ type
|
|||||||
FTableDefs : TDDTableDefs;
|
FTableDefs : TDDTableDefs;
|
||||||
FGenerator : TFPDDSQLEngine;
|
FGenerator : TFPDDSQLEngine;
|
||||||
FSQLGenerated : Boolean;
|
FSQLGenerated : Boolean;
|
||||||
|
function GetAS: Boolean;
|
||||||
function GetSQLStatement(Index: integer): TStrings;
|
function GetSQLStatement(Index: integer): TStrings;
|
||||||
function GetTableDef: TDDTableDef;
|
function GetTableDef: TDDTableDef;
|
||||||
function GetTableName: String;
|
function GetTableName: String;
|
||||||
|
procedure SetAS(AValue: Boolean);
|
||||||
procedure SetTableDefs(const AValue: TDDTableDefs);
|
procedure SetTableDefs(const AValue: TDDTableDefs);
|
||||||
procedure SetTableName(const AValue: String);
|
procedure SetTableName(const AValue: String);
|
||||||
Procedure SetFieldLists(TD : TDDTableDef);
|
Procedure SetFieldLists(TD : TDDTableDef);
|
||||||
@ -84,6 +86,7 @@ type
|
|||||||
Procedure RefreshTableList;
|
Procedure RefreshTableList;
|
||||||
Procedure GenerateSQL;
|
Procedure GenerateSQL;
|
||||||
Procedure ClearSQL;
|
Procedure ClearSQL;
|
||||||
|
Class Function GenerateSQLDialog(TDS : TDDTableDefs; TN : String; AllowChangeTable : Boolean = True) : Boolean;
|
||||||
Property TableDefs : TDDTableDefs Read FTableDefs Write SetTableDefs;
|
Property TableDefs : TDDTableDefs Read FTableDefs Write SetTableDefs;
|
||||||
Property TableName : String Read GetTableName Write SetTableName;
|
Property TableName : String Read GetTableName Write SetTableName;
|
||||||
Property SelectSQL : TStrings Index 0 Read GetSQLStatement;
|
Property SelectSQL : TStrings Index 0 Read GetSQLStatement;
|
||||||
@ -92,13 +95,29 @@ type
|
|||||||
Property DeleteSQL : TStrings Index 3 Read GetSQLStatement;
|
Property DeleteSQL : TStrings Index 3 Read GetSQLStatement;
|
||||||
Property CreateSQL : TStrings Index 4 Read GetSQLStatement;
|
Property CreateSQL : TStrings Index 4 Read GetSQLStatement;
|
||||||
Property TableDef : TDDTableDef Read GetTableDef;
|
Property TableDef : TDDTableDef Read GetTableDef;
|
||||||
|
Property AllowSelectTable : Boolean Read GetAS Write SetAS;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
GenerateSQLForm: TGenerateSQLForm;
|
GenerateSQLForm: TGenerateSQLForm;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
Class Function TGenerateSQLFOrm.GenerateSQLDialog(TDS : TDDTableDefs; TN : String; AllowChangeTable : Boolean = True) : Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
With TGenerateSQLFOrm.Create(Application) do
|
||||||
|
try
|
||||||
|
TableDefs:=TDS;
|
||||||
|
TableName:=TN;
|
||||||
|
AllowSelectTable:=AllowChangeTable;
|
||||||
|
Result:=ShowModal=mroK;
|
||||||
|
Finally
|
||||||
|
Free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
{ TGenerateSQLForm }
|
{ TGenerateSQLForm }
|
||||||
@ -127,6 +146,11 @@ begin
|
|||||||
Result:=CBTables.Text;
|
Result:=CBTables.Text;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGenerateSQLForm.SetAS(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
CBTables.Enabled:=AValue;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGenerateSQLForm.GetSQLStatement(Index: integer): TStrings;
|
function TGenerateSQLForm.GetSQLStatement(Index: integer): TStrings;
|
||||||
begin
|
begin
|
||||||
Case Index of
|
Case Index of
|
||||||
@ -138,6 +162,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGenerateSQLForm.GetAS: Boolean;
|
||||||
|
begin
|
||||||
|
Result:=CBTables.Enabled;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGenerateSQLForm.GetTableDef: TDDTableDef;
|
function TGenerateSQLForm.GetTableDef: TDDTableDef;
|
||||||
begin
|
begin
|
||||||
With CBTables do
|
With CBTables do
|
||||||
|
@ -5,7 +5,7 @@ object MainForm: TMainForm
|
|||||||
Width = 666
|
Width = 666
|
||||||
ActiveControl = PCDD
|
ActiveControl = PCDD
|
||||||
Caption = 'Lazarus Database Desktop'
|
Caption = 'Lazarus Database Desktop'
|
||||||
ClientHeight = 453
|
ClientHeight = 464
|
||||||
ClientWidth = 666
|
ClientWidth = 666
|
||||||
Menu = MainMenu1
|
Menu = MainMenu1
|
||||||
OnClose = FormClose
|
OnClose = FormClose
|
||||||
@ -110,7 +110,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object PCDD: TPageControl
|
object PCDD: TPageControl
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 407
|
Height = 418
|
||||||
Top = 26
|
Top = 26
|
||||||
Width = 666
|
Width = 666
|
||||||
ActivePage = TSRecent
|
ActivePage = TSRecent
|
||||||
@ -119,13 +119,13 @@ object MainForm: TMainForm
|
|||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
object TSRecent: TTabSheet
|
object TSRecent: TTabSheet
|
||||||
Caption = 'Dictionaries'
|
Caption = 'Dictionaries'
|
||||||
ClientHeight = 374
|
ClientHeight = 384
|
||||||
ClientWidth = 662
|
ClientWidth = 658
|
||||||
object LVDicts: TListView
|
object LVDicts: TListView
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 374
|
Height = 384
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 662
|
Width = 658
|
||||||
Align = alClient
|
Align = alClient
|
||||||
Columns = <
|
Columns = <
|
||||||
item
|
item
|
||||||
@ -138,7 +138,7 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
item
|
item
|
||||||
Caption = 'Last used on'
|
Caption = 'Last used on'
|
||||||
Width = 487
|
Width = 617
|
||||||
end>
|
end>
|
||||||
PopupMenu = PMDataDict
|
PopupMenu = PMDataDict
|
||||||
ReadOnly = True
|
ReadOnly = True
|
||||||
@ -152,8 +152,8 @@ object MainForm: TMainForm
|
|||||||
end
|
end
|
||||||
object TSConnections: TTabSheet
|
object TSConnections: TTabSheet
|
||||||
Caption = 'Connections'
|
Caption = 'Connections'
|
||||||
ClientHeight = 374
|
ClientHeight = 384
|
||||||
ClientWidth = 662
|
ClientWidth = 658
|
||||||
object LVConnections: TListView
|
object LVConnections: TListView
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 374
|
Height = 374
|
||||||
@ -191,7 +191,7 @@ object MainForm: TMainForm
|
|||||||
object PStatus: TPanel
|
object PStatus: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 433
|
Top = 444
|
||||||
Width = 666
|
Width = 666
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
@ -910,7 +910,7 @@ object MainForm: TMainForm
|
|||||||
Hint = 'Generate SQL statements for the current table'
|
Hint = 'Generate SQL statements for the current table'
|
||||||
ImageIndex = 7
|
ImageIndex = 7
|
||||||
OnExecute = AGenerateSQLExecute
|
OnExecute = AGenerateSQLExecute
|
||||||
OnUpdate = HaveTables
|
OnUpdate = AllowSQL
|
||||||
ShortCut = 16455
|
ShortCut = 16455
|
||||||
end
|
end
|
||||||
object ASaveAs: TAction
|
object ASaveAs: TAction
|
||||||
|
@ -159,6 +159,7 @@ type
|
|||||||
procedure ADeleteRecentDataDictExecute(Sender: TObject);
|
procedure ADeleteRecentDataDictExecute(Sender: TObject);
|
||||||
procedure AExitExecute(Sender: TObject);
|
procedure AExitExecute(Sender: TObject);
|
||||||
procedure AGenerateSQLExecute(Sender: TObject);
|
procedure AGenerateSQLExecute(Sender: TObject);
|
||||||
|
procedure AllowSQL(Sender: TObject);
|
||||||
procedure ANewConnectionExecute(Sender: TObject);
|
procedure ANewConnectionExecute(Sender: TObject);
|
||||||
procedure ANewExecute(Sender: TObject);
|
procedure ANewExecute(Sender: TObject);
|
||||||
procedure ANewFieldExecute(Sender: TObject);
|
procedure ANewFieldExecute(Sender: TObject);
|
||||||
@ -263,6 +264,8 @@ uses
|
|||||||
fpddmysql40, // MySQL 4.0
|
fpddmysql40, // MySQL 4.0
|
||||||
fpddmysql41, // MySQL 4.1
|
fpddmysql41, // MySQL 4.1
|
||||||
fpddmysql50, // MySQL 5.0
|
fpddmysql50, // MySQL 5.0
|
||||||
|
fpddmysql51, // MySQL 5.1
|
||||||
|
fpddmysql55, // MySQL 5.5
|
||||||
fpddoracle, // Oracle
|
fpddoracle, // Oracle
|
||||||
fpddpq, // PostgreSQL
|
fpddpq, // PostgreSQL
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -472,6 +475,8 @@ begin
|
|||||||
RegisterMySQL40DDEngine;
|
RegisterMySQL40DDEngine;
|
||||||
RegisterMySQL41DDEngine;
|
RegisterMySQL41DDEngine;
|
||||||
RegisterMySQL50DDEngine;
|
RegisterMySQL50DDEngine;
|
||||||
|
RegisterMySQL51DDEngine;
|
||||||
|
RegisterMySQL55DDEngine;
|
||||||
RegisterOracleDDEngine;
|
RegisterOracleDDEngine;
|
||||||
RegisterPostgreSQLDDengine;
|
RegisterPostgreSQLDDengine;
|
||||||
{$endif}
|
{$endif}
|
||||||
@ -499,6 +504,8 @@ begin
|
|||||||
MaybeRegisterConnectionStringCallback('TSQLDBMySql40DDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBMySql40DDEngine',@GetSQLConnectionDlg);
|
||||||
MaybeRegisterConnectionStringCallback('TSQLDBMySql41DDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBMySql41DDEngine',@GetSQLConnectionDlg);
|
||||||
MaybeRegisterConnectionStringCallback('TSQLDBMySql5DDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBMySql5DDEngine',@GetSQLConnectionDlg);
|
||||||
|
MaybeRegisterConnectionStringCallback('TSQLDBMySql51DDEngine',@GetSQLConnectionDlg);
|
||||||
|
MaybeRegisterConnectionStringCallback('TSQLDBMySql55DDEngine',@GetSQLConnectionDlg);
|
||||||
MaybeRegisterConnectionStringCallback('TSQLDBODBCDDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBODBCDDEngine',@GetSQLConnectionDlg);
|
||||||
MaybeRegisterConnectionStringCallback('TSQLDBPOSTGRESQLDDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBPOSTGRESQLDDEngine',@GetSQLConnectionDlg);
|
||||||
MaybeRegisterConnectionStringCallback('TSQLDBFBDDEngine',@GetSQLConnectionDlg);
|
MaybeRegisterConnectionStringCallback('TSQLDBFBDDEngine',@GetSQLConnectionDlg);
|
||||||
@ -787,6 +794,18 @@ begin
|
|||||||
ShowGenerateSQL;
|
ShowGenerateSQL;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.AllowSQL(Sender: TObject);
|
||||||
|
|
||||||
|
Var
|
||||||
|
B : Boolean;
|
||||||
|
|
||||||
|
begin
|
||||||
|
B:=Assigned(CurrentEditor) and (CurrentEditor.DataDictionary.Tables.Count>0);
|
||||||
|
If not B then
|
||||||
|
B:=Assigned(CurrentConnection) and CurrentConnection.CanCreateSQL;
|
||||||
|
(Sender as TAction).Enabled:=B;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TMainForm.ANewConnectionExecute(Sender: TObject);
|
procedure TMainForm.ANewConnectionExecute(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
NewConnection;
|
NewConnection;
|
||||||
@ -1209,16 +1228,18 @@ end;
|
|||||||
|
|
||||||
procedure TMainForm.ShowGenerateSQL;
|
procedure TMainForm.ShowGenerateSQL;
|
||||||
|
|
||||||
|
Var
|
||||||
|
TN : String;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
With TGenerateSQLFOrm.Create(Self) do
|
if Assigned(CurrentConnection) then
|
||||||
try
|
CurrentConnection.CreateSQL
|
||||||
TableDefs:=CurrentEditor.DataDictionary.Tables;
|
else
|
||||||
|
begin
|
||||||
If CurrentEditor.CurrentTable<>Nil then
|
If CurrentEditor.CurrentTable<>Nil then
|
||||||
TableName:=CurrentEditor.CurrentTable.TableName;
|
TN:=CurrentEditor.CurrentTable.TableName;
|
||||||
ShowModal;
|
TGenerateSQLForm.GenerateSQLDialog(CurrentEditor.DataDictionary.Tables,TN,True);
|
||||||
Finally
|
end
|
||||||
Free;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TMainForm.DeleteCurrentObject;
|
procedure TMainForm.DeleteCurrentObject;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<ProjectOptions>
|
<ProjectOptions>
|
||||||
<Version Value="8"/>
|
<Version Value="9"/>
|
||||||
<General>
|
<General>
|
||||||
<Flags>
|
<Flags>
|
||||||
<LRSInOutputDirectory Value="False"/>
|
<LRSInOutputDirectory Value="False"/>
|
||||||
@ -9,16 +9,15 @@
|
|||||||
<SessionStorage Value="InProjectDir"/>
|
<SessionStorage Value="InProjectDir"/>
|
||||||
<MainUnit Value="0"/>
|
<MainUnit Value="0"/>
|
||||||
<AutoCreateForms Value="False"/>
|
<AutoCreateForms Value="False"/>
|
||||||
<TargetFileExt Value=".exe"/>
|
|
||||||
<Title Value="Lazarus Data Desktop"/>
|
<Title Value="Lazarus Data Desktop"/>
|
||||||
<UseXPManifest Value="True"/>
|
<UseXPManifest Value="True"/>
|
||||||
</General>
|
</General>
|
||||||
<i18n>
|
<i18n>
|
||||||
<OutDir Value="languages"/>
|
<OutDir Value="languages"/>
|
||||||
</i18n>
|
</i18n>
|
||||||
<VersionInfo>
|
<BuildModes Count="1">
|
||||||
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion="0.0.0.0"/>
|
<Item1 Name="default" Default="True"/>
|
||||||
</VersionInfo>
|
</BuildModes>
|
||||||
<PublishOptions>
|
<PublishOptions>
|
||||||
<Version Value="2"/>
|
<Version Value="2"/>
|
||||||
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
|
||||||
@ -64,6 +63,7 @@
|
|||||||
<Filename Value="frmmain.pp"/>
|
<Filename Value="frmmain.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="MainForm"/>
|
<ComponentName Value="MainForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="frmmain"/>
|
<UnitName Value="frmmain"/>
|
||||||
</Unit1>
|
</Unit1>
|
||||||
@ -76,6 +76,7 @@
|
|||||||
<Filename Value="frmimportdd.pp"/>
|
<Filename Value="frmimportdd.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="ImportDDform"/>
|
<ComponentName Value="ImportDDform"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="frmimportdd"/>
|
<UnitName Value="frmimportdd"/>
|
||||||
</Unit3>
|
</Unit3>
|
||||||
@ -83,6 +84,7 @@
|
|||||||
<Filename Value="frmgeneratesql.pp"/>
|
<Filename Value="frmgeneratesql.pp"/>
|
||||||
<IsPartOfProject Value="True"/>
|
<IsPartOfProject Value="True"/>
|
||||||
<ComponentName Value="GenerateSQLForm"/>
|
<ComponentName Value="GenerateSQLForm"/>
|
||||||
|
<HasResources Value="True"/>
|
||||||
<ResourceBaseClass Value="Form"/>
|
<ResourceBaseClass Value="Form"/>
|
||||||
<UnitName Value="frmgeneratesql"/>
|
<UnitName Value="frmgeneratesql"/>
|
||||||
</Unit4>
|
</Unit4>
|
||||||
@ -132,7 +134,7 @@
|
|||||||
</Units>
|
</Units>
|
||||||
</ProjectOptions>
|
</ProjectOptions>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="9"/>
|
<Version Value="11"/>
|
||||||
<Target>
|
<Target>
|
||||||
<Filename Value="lazdatadesktop"/>
|
<Filename Value="lazdatadesktop"/>
|
||||||
</Target>
|
</Target>
|
||||||
|
Loading…
Reference in New Issue
Block a user