ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/design/ibrefreshsqleditor.pas
Revision: 107
Committed: Thu Jan 18 14:37:40 2018 UTC (6 years, 9 months ago) by tony
Content type: text/x-pascal
File size: 2527 byte(s)
Log Message:
Fixes merged

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 tony 106 ibselectsqleditor, IBDatabase, IBCustomDataset, IBSQLEditFrame;
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 107 IBSQLEditFrame1.SelectProcs := true;
77 tony 33 Result := ShowModal = mrOK;
78     if Result then
79     begin
80 tony 80 SelectSQL.Assign(IBSQLEditFrame1.SQLText.Lines);
81 tony 33 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 tony 107 if PageControl.ActivePage = ExecutePage then
94     IBSQLEditFrame1.GenerateExecuteSQL(QuoteFields.Checked)
95     else
96     IBSQLEditFrame1.GenerateRefreshSQL(QuoteFields.Checked);
97 tony 33 end;
98    
99    
100 tony 80 end.
101 tony 33