1 {*********************************************************}
3 { Zeos Database Objects }
4 { SQL Statements Analysing classes }
6 { Originally written by Sergey Seroukhov }
8 {*********************************************************}
10 {@********************************************************}
11 { Copyright (c) 1999-2012 Zeos Development Group }
13 { License Agreement: }
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. }
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. }
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) }
46 { http://www.sourceforge.net/projects/zeoslib. }
49 { Zeos Development Group. }
50 {********************************************************@}
58 uses Classes, ZGenericSqlAnalyser;
62 {** Implements an MySQL statements analyser. }
63 TZMySQLStatementAnalyser = class (TZGenericStatementAnalyser)
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'
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'
82 MySQLFromJoins: array[0..7] of string = (
83 'NATURAL', 'RIGHT', 'LEFT', 'INNER', 'OUTER', 'JOIN',
84 'STRAIGHT_JOIN', 'CROSS'
86 MySQLFromClauses: array[0..3] of string = (
87 'ON', 'USING', 'USE', 'IGNORE'
90 { TZMySQLStatementAnalyser }
93 Creates the object and assignes the main properties.
95 constructor TZMySQLStatementAnalyser.Create;
97 SectionNames := ArrayToStrings(MySQLSectionNames);
98 SelectOptions := ArrayToStrings(MySQLSelectOptions);
99 FromJoins := ArrayToStrings(MySQLFromJoins);
100 FromClauses := ArrayToStrings(MySQLFromClauses);