32 |
|
|
33 |
|
uses |
34 |
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, |
35 |
< |
StdCtrls, IBSystemTables, IBDatabase; |
35 |
> |
StdCtrls, IBSystemTables, IBDatabase, IBCustomDataSet; |
36 |
|
|
37 |
|
type |
38 |
|
|
42 |
|
Button1: TButton; |
43 |
|
Button2: TButton; |
44 |
|
GenerateBtn: TButton; |
45 |
+ |
GenerateParams: TCheckBox; |
46 |
|
TestBtn: TButton; |
47 |
|
IBTransaction1: TIBTransaction; |
48 |
|
Label1: TLabel; |
70 |
|
var |
71 |
|
IBDeleteSQLEditorForm: TIBDeleteSQLEditorForm; |
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 |
< |
if assigned(Database) then |
82 |
> |
if assigned(DataSet) and assigned(DataSet.Database) then |
83 |
|
try |
84 |
< |
Database.Connected := true; |
84 |
> |
DataSet.Database.Connected := true; |
85 |
|
except on E: Exception do |
86 |
|
ShowMessage(E.Message) |
87 |
|
end; |
88 |
|
|
89 |
|
with TIBDeleteSQLEditorForm.Create(Application) do |
90 |
|
try |
91 |
< |
SetDatabase(Database); |
91 |
> |
if assigned(DataSet) then |
92 |
> |
begin |
93 |
> |
SetDatabase(DataSet.Database); |
94 |
> |
GenerateParams.Checked := DataSet.GenerateParamNames; |
95 |
> |
end; |
96 |
|
SQLText.Lines.Assign(SelectSQL); |
97 |
|
Result := ShowModal = mrOK; |
98 |
|
if Result then |
99 |
< |
SelectSQL.Assign(SQLText.Lines) |
99 |
> |
begin |
100 |
> |
SelectSQL.Assign(SQLText.Lines); |
101 |
> |
if assigned(DataSet) then |
102 |
> |
DataSet.GenerateParamNames := GenerateParams.Checked |
103 |
> |
end; |
104 |
|
finally |
105 |
|
Free |
106 |
|
end; |
142 |
|
|
143 |
|
procedure TIBDeleteSQLEditorForm.TestBtnClick(Sender: TObject); |
144 |
|
begin |
145 |
< |
FIBSystemTables.TestSQL(SQLText.Lines.Text) |
145 |
> |
FIBSystemTables.TestSQL(SQLText.Lines.Text,GenerateParams.Checked) |
146 |
|
end; |
147 |
|
|
148 |
|
procedure TIBDeleteSQLEditorForm.TableNamesComboCloseUp(Sender: TObject); |
169 |
|
end; |
170 |
|
|
171 |
|
end. |
172 |
< |
|
172 |
> |
|