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 7 by tony, Sun Aug 5 18:28:19 2012 UTC vs.
Revision 45 by tony, Tue Dec 6 10:33:46 2016 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, IB;
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  
93 uses IBSQL;
94
92   {$R *.lfm}
93  
94 < function EditSQL(Database: TIBDatabase;  SelectSQL: TStrings): boolean;
94 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
95   begin
96    Result := false;
97 <  if assigned(Database) then
97 >  if assigned(DataSet) and assigned(DataSet.Database) then
98      try
99 <      Database.Connected := true;
99 >      DataSet.Database.Connected := true;
100      except on E: Exception do
101        ShowMessage(E.Message)
102      end;
103  
104    with TIBSelectSQLEditorForm.Create(Application) do
105    try
106 <    SetDatabase(Database);
106 >    if assigned(DataSet) then
107 >    begin
108 >        SetDatabase(DataSet.Database);
109 >        GenerateParams.Checked := DataSet.GenerateParamNames;
110 >    end;
111      SQLText.Lines.Assign(SelectSQL);
112      Result := ShowModal = mrOK;
113      if Result then
114 <     SelectSQL.Assign(SQLText.Lines)
114 >    begin
115 >     SelectSQL.Assign(SQLText.Lines);
116 >     if assigned(DataSet) then
117 >          DataSet.GenerateParamNames := GenerateParams.Checked
118 >    end;
119    finally
120      Free
121    end;
# Line 192 | Line 197 | end;
197  
198   procedure TIBSelectSQLEditorForm.TestBtnClick(Sender: TObject);
199   begin
200 <  FIBSystemTables.TestSQL(SQLText.Lines.Text)
200 >  FIBSystemTables.TestSQL(SQLText.Lines.Text,GenerateParams.Checked)
201   end;
202  
203   procedure TIBSelectSQLEditorForm.ExecutePageShow(Sender: TObject);
# Line 239 | Line 244 | begin
244   end;
245  
246   end.
242

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines