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

Comparing ibx/trunk/design/ibselectsqleditor.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, ComCtrls, IBSystemTables, IBDatabase;
35 >  StdCtrls, ComCtrls, 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      SelectProcedure: TLabel;
47      TestBtn: TButton;
48      FieldList: TListBox;
# Line 83 | Line 84 | type
84      procedure SetDatabase(Database: TIBDatabase);
85    end;
86  
86 var
87  IBSelectSQLEditorForm: TIBSelectSQLEditorForm;
87  
88 < function EditSQL(Database: TIBDatabase;  SelectSQL: TStrings): boolean;
88 > function EditSQL(DataSet: TIBCustomDataSet;  SelectSQL: TStrings): boolean;
89  
90   implementation
91  
# Line 94 | Line 93 | uses IBSQL;
93  
94   {$R *.lfm}
95  
96 < function EditSQL(Database: TIBDatabase;  SelectSQL: TStrings): boolean;
96 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
97   begin
98    Result := false;
99 <  if assigned(Database) then
99 >  if assigned(DataSet) and assigned(DataSet.Database) then
100      try
101 <      Database.Connected := true;
101 >      DataSet.Database.Connected := true;
102      except on E: Exception do
103        ShowMessage(E.Message)
104      end;
105  
106    with TIBSelectSQLEditorForm.Create(Application) do
107    try
108 <    SetDatabase(Database);
108 >    if assigned(DataSet) then
109 >    begin
110 >        SetDatabase(DataSet.Database);
111 >        GenerateParams.Checked := DataSet.GenerateParamNames;
112 >    end;
113      SQLText.Lines.Assign(SelectSQL);
114      Result := ShowModal = mrOK;
115      if Result then
116 <     SelectSQL.Assign(SQLText.Lines)
116 >    begin
117 >     SelectSQL.Assign(SQLText.Lines);
118 >     if assigned(DataSet) then
119 >          DataSet.GenerateParamNames := GenerateParams.Checked
120 >    end;
121    finally
122      Free
123    end;
# Line 192 | Line 199 | end;
199  
200   procedure TIBSelectSQLEditorForm.TestBtnClick(Sender: TObject);
201   begin
202 <  FIBSystemTables.TestSQL(SQLText.Lines.Text)
202 >  FIBSystemTables.TestSQL(SQLText.Lines.Text,GenerateParams.Checked)
203   end;
204  
205   procedure TIBSelectSQLEditorForm.ExecutePageShow(Sender: TObject);
# Line 239 | Line 246 | begin
246   end;
247  
248   end.
249 <
249 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines