ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/ibinsertsqleditor.pas
(Generate patch)

Comparing ibx/trunk/design/ibinsertsqleditor.pas (file contents):
Revision 17 by tony, Sat Dec 28 19:22:24 2013 UTC vs.
Revision 19 by tony, Mon Jul 7 13:00:15 2014 UTC

# Line 32 | Line 32 | interface
32  
33   uses
34    Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
35 <  StdCtrls, IBSystemTables, IBDatabase;
35 >  StdCtrls, IBSystemTables, IBDatabase, IBCustomDataSet;
36  
37   type
38  
# Line 42 | Line 42 | type
42      Button1: TButton;
43      Button2: TButton;
44      GenerateBtn: TButton;
45 +    GenerateParams: TCheckBox;
46      TestBtn: TButton;
47      FieldList: TListBox;
48      IBTransaction1: TIBTransaction;
# Line 69 | Line 70 | type
70   var
71    IBInsertSQLEditorForm: TIBInsertSQLEditorForm;
72  
73 < function EditSQL(Database: TIBDatabase; SelectSQL: TStrings): boolean;
73 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
74  
75   implementation
76  
77   {$R *.lfm}
78  
79 < function EditSQL(Database: TIBDatabase; SelectSQL: TStrings): boolean;
79 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
80   begin
81   Result := false;
82  
83 < if assigned(Database) then
83 > if assigned(DataSet) and assigned(DataSet.Database) then
84      try
85 <      Database.Connected := true;
85 >      DataSet.Database.Connected := true;
86      except on E: Exception do
87        ShowMessage(E.Message)
88      end;
89  
90    with TIBInsertSQLEditorForm.Create(Application) do
91    try
92 <    SetDatabase(Database);
92 >    if assigned(DataSet) then
93 >    begin
94 >      SetDatabase(DataSet.Database);
95 >      GenerateParams.Checked := DataSet.GenerateParamNames;
96 >    end;
97      SQLText.Lines.Assign(SelectSQL);
98      Result := ShowModal = mrOK;
99      if Result then
100 <     SelectSQL.Assign(SQLText.Lines)
100 >    begin
101 >     SelectSQL.Assign(SQLText.Lines);
102 >     if assigned(DataSet) then
103 >          DataSet.GenerateParamNames := GenerateParams.Checked
104 >    end;
105    finally
106      Free
107    end;
# Line 142 | Line 151 | end;
151  
152   procedure TIBInsertSQLEditorForm.TestBtnClick(Sender: TObject);
153   begin
154 <  FIBSystemTables.TestSQL(SQLText.Lines.Text)
154 >  FIBSystemTables.TestSQL(SQLText.Lines.Text,GenerateParams.Checked)
155   end;
156  
157   procedure TIBInsertSQLEditorForm.TableNamesComboCloseUp(Sender: TObject);
# Line 169 | Line 178 | begin
178   end;
179  
180   end.
181 <
181 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines