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

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

# Line 6 | Line 6 | interface
6  
7   uses
8    Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
9 <  StdCtrls, IBSystemTables, IBDatabase;
9 >  StdCtrls, IBSystemTables, IBDatabase, IBCustomDataSet;
10  
11   type
12  
# Line 16 | Line 16 | type
16      Button1: TButton;
17      Button2: TButton;
18      GenerateBtn: TButton;
19 +    GenerateParams: TCheckBox;
20      TestBtn: TButton;
21      FieldList: TListBox;
22      IBTransaction1: TIBTransaction;
# Line 46 | Line 47 | type
47   var
48    IBRefreshSQLEditorForm: TIBRefreshSQLEditorForm;
49  
50 < function EditSQL(Database: TIBDatabase; SelectSQL: TStrings): boolean;
50 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
51  
52   implementation
53  
54   {$R *.lfm}
55  
56 < function EditSQL(Database: TIBDatabase;  SelectSQL: TStrings): boolean;
56 > function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
57   begin
58    Result := false;
59 <  if assigned(Database) then
59 >  if assigned(DataSet) and assigned(DataSet.Database) then
60      try
61 <      Database.Connected := true;
61 >      DataSet.Database.Connected := true;
62      except on E: Exception do
63        ShowMessage(E.Message)
64      end;
65  
66    with TIBRefreshSQLEditorForm.Create(Application) do
67    try
68 <    SetDatabase(Database);
68 >    if assigned(DataSet) then
69 >    begin
70 >        SetDatabase(DataSet.Database);
71 >        GenerateParams.Checked := DataSet.GenerateParamNames;
72 >    end;
73      SQLText.Lines.Assign(SelectSQL);
74      Result := ShowModal = mrOK;
75      if Result then
76 <     SelectSQL.Assign(SQLText.Lines)
76 >    begin
77 >     SelectSQL.Assign(SQLText.Lines);
78 >     if assigned(DataSet) then
79 >          DataSet.GenerateParamNames := GenerateParams.Checked
80 >    end;
81    finally
82      Free
83    end;
# Line 121 | Line 130 | end;
130  
131   procedure TIBRefreshSQLEditorForm.TestBtnClick(Sender: TObject);
132   begin
133 <  FIBSystemTables.TestSQL(SQLText.Lines.Text)
133 >  FIBSystemTables.TestSQL(SQLText.Lines.Text,GenerateParams.Checked)
134   end;
135  
136   procedure TIBRefreshSQLEditorForm.TableNamesComboCloseUp(Sender: TObject);
# Line 149 | Line 158 | begin
158   end;
159  
160   end.
161 <
161 >

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines