zeoslib  UNKNOWN
 All Files
ZMySqlAnalyser.pas
Go to the documentation of this file.
1 {*********************************************************}
2 { }
3 { Zeos Database Objects }
4 { SQL Statements Analysing classes }
5 { }
6 { Originally written by Sergey Seroukhov }
7 { }
8 {*********************************************************}
9 
10 {@********************************************************}
11 { Copyright (c) 1999-2012 Zeos Development Group }
12 { }
13 { License Agreement: }
14 { }
15 { This library is distributed in the hope that it will be }
16 { useful, but WITHOUT ANY WARRANTY; without even the }
17 { implied warranty of MERCHANTABILITY or FITNESS FOR }
18 { A PARTICULAR PURPOSE. See the GNU Lesser General }
19 { Public License for more details. }
20 { }
21 { The source code of the ZEOS Libraries and packages are }
22 { distributed under the Library GNU General Public }
23 { License (see the file COPYING / COPYING.ZEOS) }
24 { with the following modification: }
25 { As a special exception, the copyright holders of this }
26 { library give you permission to link this library with }
27 { independent modules to produce an executable, }
28 { regardless of the license terms of these independent }
29 { modules, and to copy and distribute the resulting }
30 { executable under terms of your choice, provided that }
31 { you also meet, for each linked independent module, }
32 { the terms and conditions of the license of that module. }
33 { An independent module is a module which is not derived }
34 { from or based on this library. If you modify this }
35 { library, you may extend this exception to your version }
36 { of the library, but you are not obligated to do so. }
37 { If you do not wish to do so, delete this exception }
38 { statement from your version. }
39 { }
40 { }
41 { The project web site is located on: }
42 { http://zeos.firmos.at (FORUM) }
43 { http://sourceforge.net/p/zeoslib/tickets/ (BUGTRACKER)}
44 { svn://svn.code.sf.net/p/zeoslib/code-0/trunk (SVN) }
45 { }
46 { http://www.sourceforge.net/projects/zeoslib. }
47 { }
48 { }
49 { Zeos Development Group. }
50 {********************************************************@}
51 
52 unit ZMySqlAnalyser;
53 
54 interface
55 
56 {$I ZParseSql.inc}
57 
58 uses Classes, ZGenericSqlAnalyser;
59 
60 type
61 
62  {** Implements an MySQL statements analyser. }
63  TZMySQLStatementAnalyser = class (TZGenericStatementAnalyser)
64  public
65  constructor Create;
66  end;
67 
68 implementation
69 
70 const
71  {** The generic constants.}
72  MySQLSectionNames: array[0..16] of string = (
73  'SELECT', 'UPDATE', 'DELETE', 'INSERT', 'FROM',
74  'WHERE', 'INTO', 'GROUP*BY', 'HAVING', 'ORDER*BY',
75  'FOR*UPDATE', 'LIMIT', 'OFFSET', 'INTO*OUTFILE',
76  'INTO*DUMPFILE', 'PROCEDURE', 'LOCK*IN*SHARE'
77  );
78  MySQLSelectOptions: array[0..7] of string = (
79  'DISTINCT', 'ALL', 'DISTINCTROW', 'STRAIGHT_JOIN', 'SQL_SMALL_RESULT',
80  'SQL_BIG_RESULT', 'SQL_BUFFER_RESULT', 'HIGH_PRIORITY'
81  );
82  MySQLFromJoins: array[0..7] of string = (
83  'NATURAL', 'RIGHT', 'LEFT', 'INNER', 'OUTER', 'JOIN',
84  'STRAIGHT_JOIN', 'CROSS'
85  );
86  MySQLFromClauses: array[0..3] of string = (
87  'ON', 'USING', 'USE', 'IGNORE'
88  );
89 
90 { TZMySQLStatementAnalyser }
91 
92 {**
93  Creates the object and assignes the main properties.
94 }
95 constructor TZMySQLStatementAnalyser.Create;
96 begin
97  SectionNames := ArrayToStrings(MySQLSectionNames);
98  SelectOptions := ArrayToStrings(MySQLSelectOptions);
99  FromJoins := ArrayToStrings(MySQLFromJoins);
100  FromClauses := ArrayToStrings(MySQLFromClauses);
101 end;
102 
103 end.
104