00001 {*********************************************************}
00002 { }
00003 { Zeos Database Objects }
00004 { SQL Statements Analysing classes }
00005 { }
00006 { Originally written by Sergey Seroukhov }
00007 { }
00008 {*********************************************************}
00009
00010 {@********************************************************}
00011 { Copyright (c) 1999-2006 Zeos Development Group }
00012 { }
00013 { License Agreement: }
00014 { }
00015 { This library is distributed in the hope that it will be }
00016 { useful, but WITHOUT ANY WARRANTY; without even the }
00017 { implied warranty of MERCHANTABILITY or FITNESS FOR }
00018 { A PARTICULAR PURPOSE. See the GNU Lesser General }
00019 { Public License for more details. }
00020 { }
00021 { The source code of the ZEOS Libraries and packages are }
00022 { distributed under the Library GNU General Public }
00023 { License (see the file COPYING / COPYING.ZEOS) }
00024 { with the following modification: }
00025 { As a special exception, the copyright holders of this }
00026 { library give you permission to link this library with }
00027 { independent modules to produce an executable, }
00028 { regardless of the license terms of these independent }
00029 { modules, and to copy and distribute the resulting }
00030 { executable under terms of your choice, provided that }
00031 { you also meet, for each linked independent module, }
00032 { the terms and conditions of the license of that module. }
00033 { An independent module is a module which is not derived }
00034 { from or based on this library. If you modify this }
00035 { library, you may extend this exception to your version }
00036 { of the library, but you are not obligated to do so. }
00037 { If you do not wish to do so, delete this exception }
00038 { statement from your version. }
00039 { }
00040 { }
00041 { The project web site is located on: }
00042 { http:
00043 { http:
00044 { svn:
00045 { }
00046 { http:
00047 { http:
00048 { }
00049 { }
00050 { }
00051 { Zeos Development Group. }
00052 {********************************************************@}
00053
00054 unit ZMySqlAnalyser;
00055
00056 interface
00057
00058 {$I ZParseSql.inc}
00059
00060 uses Classes, ZGenericSqlAnalyser;
00061
00062 type
00063
00064 {** Implements an MySQL statements analyser. }
00065 TZMySQLStatementAnalyser = class (TZGenericStatementAnalyser)
00066 public
00067 constructor Create;
00068 end;
00069
00070 implementation
00071
00072 const
00073 {** The generic constants.}
00074 MySQLSectionNames: array[0..16] of string = (
00075 'SELECT', 'UPDATE', 'DELETE', 'INSERT', 'FROM',
00076 'WHERE', 'INTO', 'GROUP*BY', 'HAVING', 'ORDER*BY',
00077 'FOR*UPDATE', 'LIMIT', 'OFFSET', 'INTO*OUTFILE',
00078 'INTO*DUMPFILE', 'PROCEDURE', 'LOCK*IN*SHARE'
00079 );
00080 MySQLSelectOptions: array[0..7] of string = (
00081 'DISTINCT', 'ALL', 'DISTINCTROW', 'STRAIGHT_JOIN', 'SQL_SMALL_RESULT',
00082 'SQL_BIG_RESULT', 'SQL_BUFFER_RESULT', 'HIGH_PRIORITY'
00083 );
00084 MySQLFromJoins: array[0..7] of string = (
00085 'NATURAL', 'RIGHT', 'LEFT', 'INNER', 'OUTER', 'JOIN',
00086 'STRAIGHT_JOIN', 'CROSS'
00087 );
00088 MySQLFromClauses: array[0..3] of string = (
00089 'ON', 'USING', 'USE', 'IGNORE'
00090 );
00091
00092 { TZMySQLStatementAnalyser }
00093
00094 {**
00095 Creates the object and assignes the main properties.
00096 }
00097 constructor TZMySQLStatementAnalyser.Create;
00098 begin
00099 SectionNames := ArrayToStrings(MySQLSectionNames);
00100 SelectOptions := ArrayToStrings(MySQLSelectOptions);
00101 FromJoins := ArrayToStrings(MySQLFromJoins);
00102 FromClauses := ArrayToStrings(MySQLFromClauses);
00103 end;
00104
00105 end.
00106