ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/ibrefreshsqleditor.pas
Revision: 80
Committed: Mon Jan 1 11:31:07 2018 UTC (6 years, 11 months ago) by tony
Content type: text/x-pascal
File size: 2354 byte(s)
Log Message:
Fixes merged into public release

File Contents

# User Rev Content
1 tony 80 (*
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 tony 33 unit ibrefreshsqleditor;
28    
29     {$mode objfpc}{$H+}
30    
31     interface
32    
33     uses
34 tony 80 Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
35     ibselectsqleditor, IBDatabase, IBCustomDataset;
36 tony 33
37     type
38    
39     { TIBRefreshSQLEditorForm }
40    
41 tony 80 TIBRefreshSQLEditorForm = class(TIBSelectSQLEditorForm)
42 tony 33 procedure GenerateBtnClick(Sender: TObject);
43     private
44 tony 80
45 tony 33 public
46    
47 tony 80 end;
48    
49 tony 33 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 tony 80 IBSQLEditFrame1.Database := DataSet.Database;
73     GenerateParams.Checked := DataSet.GenerateParamNames;
74 tony 33 end;
75 tony 80 IBSQLEditFrame1.SQLText.Lines.Assign(SelectSQL);
76 tony 33 Result := ShowModal = mrOK;
77     if Result then
78     begin
79 tony 80 SelectSQL.Assign(IBSQLEditFrame1.SQLText.Lines);
80 tony 33 if assigned(DataSet) then
81     DataSet.GenerateParamNames := GenerateParams.Checked
82     end;
83     finally
84     Free
85     end;
86     end;
87    
88     { TIBRefreshSQLEditorForm }
89    
90     procedure TIBRefreshSQLEditorForm.GenerateBtnClick(Sender: TObject);
91     begin
92 tony 80 IBSQLEditFrame1.GenerateRefreshSQL(QuoteFields.Checked);
93 tony 33 end;
94    
95    
96 tony 80 end.
97 tony 33