ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/trunk/examples/DBAdmin/SelectSQLResultsUnit.pas
Revision: 380
Committed: Mon Jan 10 10:13:17 2022 UTC (2 years, 3 months ago) by tony
Content type: text/x-pascal
File size: 2623 byte(s)
Log Message:
propset for eol-style

File Contents

# Content
1 (*
2 * SelectSQLResultsUnit.pas
3 * Copyright (C) 2018 Tony Whyman <tony@mwasoftware.co.uk>
4 *
5 * DBAdmin is free software: you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
9 *
10 * DBAdmin is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program. If not, see <http://www.gnu.org/licenses/>.
17 *)
18
19 unit SelectSQLResultsUnit;
20
21 {$mode objfpc}{$H+}
22
23 interface
24
25 uses
26 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, db,
27 IBDynamicGrid, IBQuery, IBDatabase, IBXScript;
28
29 type
30
31 { TSelectSQLResults }
32
33 TSelectSQLResults = class(TForm)
34 DataSource1: TDataSource;
35 IBDynamicGrid1: TIBDynamicGrid;
36 IBTransaction1: TIBTransaction;
37 SelectQuery: TIBQuery;
38 procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
39 procedure FormShow(Sender: TObject);
40 procedure SelectQueryAfterOpen(DataSet: TDataSet);
41 private
42 { private declarations }
43 FScriptEngine: TIBXScript;
44 procedure Add2Log(const Msg: string; IsError: boolean);
45 public
46 { public declarations }
47 procedure Show(ScriptEngine: TIBXScript; SelectSQLText: string; EnableStatistics: boolean);
48 end;
49
50 var
51 SelectSQLResults: TSelectSQLResults;
52
53 implementation
54
55 {$R *.lfm}
56
57 uses IBDataOutput;
58
59 { TSelectSQLResults }
60
61 procedure TSelectSQLResults.FormShow(Sender: TObject);
62 begin
63 SelectQuery.Active := true;
64 end;
65
66 type
67 THackedIBXScript = class(TCustomIBXScript)
68 end;
69
70 procedure TSelectSQLResults.SelectQueryAfterOpen(DataSet: TDataSet);
71 begin
72 SelectQuery.Last;
73 if SelectQuery.EnableStatistics then
74 TIBCustomDataOutput.ShowPerfStats(SelectQuery.StmtHandle, @Add2Log );
75 end;
76
77 procedure TSelectSQLResults.Add2Log(const Msg: string; IsError: boolean);
78 begin
79 THackedIBXScript(FScriptEngine).Add2Log(msg,IsError);
80 end;
81
82 procedure TSelectSQLResults.FormClose(Sender: TObject;
83 var CloseAction: TCloseAction);
84 begin
85 SelectQuery.Active := false;
86 CloseAction := caFree;
87 end;
88
89 procedure TSelectSQLResults.Show(ScriptEngine: TIBXScript;
90 SelectSQLText: string; EnableStatistics: boolean);
91 begin
92 FScriptEngine := ScriptEngine;
93 SelectQuery.SQL.Text := SelectSQLText;
94 SelectQuery.EnableStatistics := EnableStatistics;
95 inherited Show;
96 end;
97
98 end.
99

Properties

Name Value
svn:eol-style native