ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/ibrefreshsqleditor.pas
Revision: 315
Committed: Thu Feb 25 11:56:36 2021 UTC (3 years, 1 month ago) by tony
Content type: text/x-pascal
File size: 2527 byte(s)
Log Message:
Updated for IBX 4 release

File Contents

# Content
1 (*
2 * IBX For Lazarus (Firebird Express)
3 *
4 * The contents of this file are subject to the Initial Developer's
5 * Public License Version 1.0 (the "License"); you may not use this
6 * file except in compliance with the License. You may obtain a copy
7 * of the License here:
8 *
9 * http://www.firebirdsql.org/index.php?op=doc&id=idpl
10 *
11 * Software distributed under the License is distributed on an "AS
12 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
13 * implied. See the License for the specific language governing rights
14 * and limitations under the License.
15 *
16 * The Initial Developer of the Original Code is Tony Whyman.
17 *
18 * The Original Code is (C) 2011 Tony Whyman, MWA Software
19 * (http://www.mwasoftware.co.uk).
20 *
21 * All Rights Reserved.
22 *
23 * Contributor(s): ______________________________________.
24 *
25 *)
26
27 unit ibrefreshsqleditor;
28
29 {$mode objfpc}{$H+}
30
31 interface
32
33 uses
34 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
35 ibselectsqleditor, IBDatabase, IBCustomDataSet, IBSQLEditFrame;
36
37 type
38
39 { TIBRefreshSQLEditorForm }
40
41 TIBRefreshSQLEditorForm = class(TIBSelectSQLEditorForm)
42 procedure GenerateBtnClick(Sender: TObject);
43 private
44
45 public
46
47 end;
48
49 var
50 IBRefreshSQLEditorForm: TIBRefreshSQLEditorForm;
51
52 function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
53
54 implementation
55
56 {$R *.lfm}
57
58 function EditSQL(DataSet: TIBCustomDataSet; SelectSQL: TStrings): boolean;
59 begin
60 Result := false;
61 if assigned(DataSet) and assigned(DataSet.Database) then
62 try
63 DataSet.Database.Connected := true;
64 except on E: Exception do
65 ShowMessage(E.Message)
66 end;
67
68 with TIBRefreshSQLEditorForm.Create(Application) do
69 try
70 if assigned(DataSet) then
71 begin
72 IBSQLEditFrame1.Database := DataSet.Database;
73 GenerateParams.Checked := DataSet.GenerateParamNames;
74 end;
75 IBSQLEditFrame1.SQLText.Lines.Assign(SelectSQL);
76 IBSQLEditFrame1.SelectProcs := true;
77 Result := ShowModal = mrOK;
78 if Result then
79 begin
80 SelectSQL.Assign(IBSQLEditFrame1.SQLText.Lines);
81 if assigned(DataSet) then
82 DataSet.GenerateParamNames := GenerateParams.Checked
83 end;
84 finally
85 Free
86 end;
87 end;
88
89 { TIBRefreshSQLEditorForm }
90
91 procedure TIBRefreshSQLEditorForm.GenerateBtnClick(Sender: TObject);
92 begin
93 if PageControl.ActivePage = ExecutePage then
94 IBSQLEditFrame1.GenerateExecuteSQL(QuoteFields.Checked)
95 else
96 IBSQLEditFrame1.GenerateRefreshSQL(QuoteFields.Checked);
97 end;
98
99
100 end.
101