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

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) 2015 Tony Whyman, MWA Software
19 * (http://www.mwasoftware.co.uk).
20 *
21 * All Rights Reserved.
22 *
23 * Contributor(s): ______________________________________.
24 *
25 *)
26
27 unit MainForm;
28
29 {$mode objfpc}{$H+}
30
31 interface
32
33 uses
34 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
35 ExtCtrls;
36
37 type
38
39 { TForm1 }
40
41 TForm1 = class(TForm)
42 HavingAllUnions: TCheckBox;
43 Button1: TButton;
44 WhereAllUnions: TCheckBox;
45 WhereCondition: TEdit;
46 HavingCondition: TEdit;
47 HavingConditionType: TRadioGroup;
48 OrderBy: TEdit;
49 Label1: TLabel;
50 Label2: TLabel;
51 Label3: TLabel;
52 Label4: TLabel;
53 Label5: TLabel;
54 OriginalSQL: TMemo;
55 GeneratedSQL: TMemo;
56 WhereConditionType: TRadioGroup;
57 procedure Button1Click(Sender: TObject);
58 private
59 { private declarations }
60 public
61 { public declarations }
62 end;
63
64 var
65 Form1: TForm1;
66
67 implementation
68
69 {$R *.lfm}
70
71 uses IBSQLParser;
72
73 { TForm1 }
74
75 procedure TForm1.Button1Click(Sender: TObject);
76 var Parser: TSelectSQLParser;
77 begin
78 Parser := TSelectSQLParser.Create(nil,OriginalSQL.Lines);
79 try
80 if WhereCondition.Text <> '' then
81 Parser.Add2WhereClause(WhereCondition.Text,WhereConditionType.ItemIndex <> 0,WhereAllUnions.Checked);
82 if HavingCondition.Text <> '' then
83 Parser.Add2HavingClause(HavingCondition.Text,HavingConditionType.ItemIndex <> 0,HavingAllUnions.Checked);
84 if OrderBy.Text <> ''then
85 Parser.OrderByClause := OrderBy.Text;
86 GeneratedSQL.Lines.Text := Parser.SQLText
87 finally
88 end;
89 end;
90
91 end.
92

Properties

Name Value
svn:eol-style native