2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * SQL Parser Matching Data
6 * Copyright 2002 Robin Johnson <robbat2@users.sourceforge.net>
7 * http://www.orbis-terrarum.net/?l=people.robbat2
9 * This data is used by the SQL Parser to recognize keywords
11 * It has been extracted from the lex.h file in the MySQL BK tree
12 * (around 4.0.2) as well as the MySQL documentation.
14 * Note: before adding a value in the arrays, ensure that you respect
15 * proper sorting, especially with underscores. And don't forget to
16 * update the _cnt variable at the end of each array.
17 * (It's slower to have PHP do the count).
19 * It's easier to use only uppercase for proper sorting. In case of
20 * doubt, use the DEBUG code after this function's definition.
24 if (! defined('PHPMYADMIN')) {
29 * @global array MySQL function names
31 $PMA_SQPdata_function_name = array (
38 'AREA', // Area() polygon-property-functions.html
39 'ASBINARY', // AsBinary()
46 'BDMPOLYFROMTEXT', // BdMPolyFromText()
47 'BDMPOLYFROMWKB', // BdMPolyFromWKB()
48 'BDPOLYFROMTEXT', // BdPolyFromText()
49 'BDPOLYFROMWKB', // BdPolyFromWKB()
56 'BIT_XOR', // group-by-functions.html
57 'BOUNDARY', // Boundary() general-geometry-property-functions.html
62 'CENTROID', // Centroid() multipolygon-property-functions.html
63 'CHAR', // string-functions.html
65 'CHARSET', // information-functions.html
68 'COERCIBILITY', // information-functions.html
69 'COLLATION', // information-functions.html
70 'COMPRESS', // string-functions.html
74 'CONTAINS', // Contains()
78 'CONVEXHULL', // ConvexHull()
82 'CRC32', // mathematical-functions.html
83 'CROSSES', // Crosses()
91 'DATE', // date-and-time-functions.html
92 'DATEDIFF', // date-and-time-functions.html
103 'DEFAULT', // miscellaneous-functions.html
107 'DIFFERENCE', // Difference()
108 'DIMENSION', // Dimension() general-geometry-property-functions.html
109 'DISJOINT', // Disjoint()
110 'DISTANCE', // Distance()
114 'ENDPOINT', // EndPoint() linestring-property-functions.html
115 'ENVELOPE', // Envelope() general-geometry-property-functions.html
116 'EQUALS', // Equals()
119 'EXTERIORRING', // ExteriorRing() polygon-property-functions.html
121 'EXTRACTVALUE', // ExtractValue() xml-functions.html
129 'GEOMCOLLFROMTEXT', // GeomCollFromText()
130 'GEOMCOLLFROMWKB', // GeomCollFromWKB()
131 'GEOMETRYCOLLECTION', // GeometryCollection()
132 'GEOMETRYCOLLECTIONFROMTEXT', // GeometryCollectionFromText()
133 'GEOMETRYCOLLECTIONFROMWKB', // GeometryCollectionFromWKB()
134 'GEOMETRYFROMTEXT', // GeometryFromText()
135 'GEOMETRYFROMWKB', // GeometryFromWKB()
136 'GEOMETRYN', // GeometryN() geometrycollection-property-functions.html
137 'GEOMETRYTYPE', // GeometryType() general-geometry-property-functions.html
138 'GEOMFROMTEXT', // GeomFromText()
139 'GEOMFROMWKB', // GeomFromWKB()
142 'GLENGTH', // GLength() linestring-property-functions.html
145 'GROUP_UNIQUE_USERS',
148 'IF', //control-flow-functions.html
152 'INSERT', // string-functions.html
154 'INTERIORRINGN', // InteriorRingN() polygon-property-functions.html
155 'INTERSECTION', // Intersection()
156 'INTERSECTS', // Intersects()
158 'ISCLOSED', // IsClosed() multilinestring-property-functions.html
159 'ISEMPTY', // IsEmpty() general-geometry-property-functions.html
161 'ISRING', // IsRing() linestring-property-functions.html
162 'ISSIMPLE', // IsSimple() general-geometry-property-functions.html
164 'IS_USED_LOCK', // miscellaneous-functions.html
171 'LINEFROMTEXT', // LineFromText()
172 'LINEFROMWKB', // LineFromWKB()
173 'LINESTRING', // LineString()
174 'LINESTRINGFROMTEXT', // LineStringFromText()
175 'LINESTRINGFROMWKB', // LineStringFromWKB()
192 'MBRCONTAINS', // MBRContains()
193 'MBRDISJOINT', // MBRDisjoint()
194 'MBREQUAL', // MBREqual()
195 'MBRINTERSECTS', // MBRIntersects()
196 'MBROVERLAPS', // MBROverlaps()
197 'MBRTOUCHES', // MBRTouches()
198 'MBRWITHIN', // MBRWithin()
204 'MLINEFROMTEXT', // MLineFromText()
205 'MLINEFROMWKB', // MLineFromWKB()
210 'MPOINTFROMTEXT', // MPointFromText()
211 'MPOINTFROMWKB', // MPointFromWKB()
212 'MPOLYFROMTEXT', // MPolyFromText()
213 'MPOLYFROMWKB', // MPolyFromWKB()
214 'MULTILINESTRING', // MultiLineString()
215 'MULTILINESTRINGFROMTEXT', // MultiLineStringFromText()
216 'MULTILINESTRINGFROMWKB', // MultiLineStringFromWKB()
217 'MULTIPOINT', // MultiPoint()
218 'MULTIPOINTFROMTEXT', // MultiPointFromText()
219 'MULTIPOINTFROMWKB', // MultiPointFromWKB()
220 'MULTIPOLYGON', // MultiPolygon()
221 'MULTIPOLYGONFROMTEXT', // MultiPolygonFromText()
222 'MULTIPOLYGONFROMWKB', // MultiPolygonFromWKB()
223 'NAME_CONST', // NAME_CONST()
226 'NUMGEOMETRIES', // NumGeometries() geometrycollection-property-functions.html
227 'NUMINTERIORRINGS', // NumInteriorRings() polygon-property-functions.html
228 'NUMPOINTS', // NumPoints() linestring-property-functions.html
233 'OVERLAPS', // Overlaps()
239 'POINTFROMTEXT', // PointFromText()
240 'POINTFROMWKB', // PointFromWKB()
241 'POINTN', // PointN() inestring-property-functions.html
242 'POINTONSURFACE', // PointOnSurface() multipolygon-property-functions.html
243 'POLYFROMTEXT', // PolyFromText()
244 'POLYFROMWKB', // PolyFromWKB()
245 'POLYGON', // Polygon()
246 'POLYGONFROMTEXT', // PolygonFromText()
247 'POLYGONFROMWKB', // PolygonFromWKB()
255 'RELATED', // Related()
258 'REPLACE', // string-functions.html
262 'ROW_COUNT', // information-functions.html
265 'SCHEMA', // information-functions.html
273 'SLEEP', // miscellaneous-functions.html
277 'SRID', // general-geometry-property-functions.html
278 'STARTPOINT', // StartPoint() linestring-property-functions.html
281 'STDDEV_POP', // group-by-functions.html
282 'STDDEV_SAMP', // group-by-functions.html
291 'SYMDIFFERENCE', // SymDifference()
302 'TOUCHES', // Touches()
305 'TRUNCATE', // mathematical-functions.html
307 'UNCOMPRESS', // string-functions.html
308 'UNCOMPRESSED_LENGTH', // string-functions.html
309 'UNHEX', // string-functions.html
312 'UPDATEXML', // UpdateXML() xml-functions.html
318 'UUID', // miscellaneous-functions.html
319 'VARIANCE', // group-by-functions.html
320 'VAR_POP', // group-by-functions.html
321 'VAR_SAMP', // group-by-functions.html
326 'WITHIN', // Within()
327 'X', // point-property-functions.html
328 'Y', // point-property-functions.html
333 * $PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
335 * @global integer MySQL attributes count
337 $PMA_SQPdata_function_name_cnt = 299;
341 $test_PMA_SQPdata_function_name = $PMA_SQPdata_function_name;
342 sort($PMA_SQPdata_function_name);
343 if ($PMA_SQPdata_function_name != $test_PMA_SQPdata_function_name) {
344 echo 'sort properly like this<pre>';
345 print_r($PMA_SQPdata_function_name);
351 * @global array MySQL attributes
353 $PMA_SQPdata_column_attrib = array (
358 'BERKELEYDB', // Engine alias BDB
360 'BLACKHOLE', // Engine
364 'FEDERATED', // Engine
366 'INNOBASE', // Engine alias InnoDB
367 'INNODB', // Engine InnoDB
369 'MEMORY', // Engine alias HEAP, but preferred
371 'MRG_ISAM', // Engine
372 'MRG_MYISAM', // Engine alias MERGE
373 'MYISAM', // Engine MyISAM
375 'NDB', // Engine alias NDBCLUSTER
376 'NDBCLUSTER', // Engine
385 * $PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
387 * @global integer MySQL attributes count
389 $PMA_SQPdata_column_attrib_cnt = 29;
392 * words that are reserved by MySQL and may not be used as identifiers without quotes
394 * @see http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
396 * @global array MySQL reserved words
398 $PMA_SQPdata_reserved_word = array (
490 'GEMINI_SPIN_RETRIES',
536 'MASTER_CONNECT_RETRY',
544 'MAX_CONNECTIONS_PER_HOUR',
545 'MAX_QUERIES_PER_HOUR',
547 'MAX_UPDATES_PER_HOUR',
548 'MAX_USER_CONNECTIONS',
561 // 'NO' is not allowed in SQL-99 but is allowed in MySQL
623 'SOUNDS', // string-functions.html
630 'SQL_CALC_FOUND_ROWS',
634 'SQL_LOW_PRIORITY_UPDATES',
637 'SQL_QUOTE_SHOW_CREATE',
640 'SQL_SLAVE_SKIP_COUNTER',
682 * $PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
684 * @global integer MySQL reserved words count
686 $PMA_SQPdata_reserved_word_cnt = 279;
688 * The previous array must be sorted so that the binary search work.
689 * Sometimes a word is not added in the correct order, so
690 * this debugging code shows the problem. The same should be
691 * done for all arrays.
694 $original = $PMA_SQPdata_reserved_word;
695 sort($PMA_SQPdata_reserved_word);
696 $difference = array_diff_assoc($original, $PMA_SQPdata_reserved_word);
698 print_r($difference);
701 print_r($PMA_SQPdata_reserved_word);
705 * words forbidden to be used as column or table name wihtout quotes
706 * as seen in http://dev.mysql.com/doc/mysql/en/reserved-words.html
708 * @global array MySQL forbidden words
710 $PMA_SQPdata_forbidden_word = array (
863 'GEOMETRYCOLLECTION',
940 'MASTER_CONNECT_RETRY',
955 'MAX_CONNECTIONS_PER_HOUR',
956 'MAX_QUERIES_PER_HOUR',
958 'MAX_UPDATES_PER_HOUR',
959 'MAX_USER_CONNECTIONS',
969 'MINUTE_MICROSECOND',
993 'NO_WRITE_TO_BINLOG',
1035 'READ_WRITE', // 5.1
1074 'SECOND_MICROSECOND',
1101 'SQL_BUFFER_RESULT',
1103 'SQL_CALC_FOUND_ROWS',
1108 'SQL_TSI_FRAC_SECOND',
1196 * count($PMA_SQPdata_forbidden_word);
1198 * @global integer MySQL forbidden words count
1200 $PMA_SQPdata_forbidden_word_cnt = 483;
1203 * the MySQL column/data types
1205 * @see http://dev.mysql.com/doc/refman/5.1/en/data-types.html
1206 * @see http://dev.mysql.com/doc/refman/5.1/en/mysql-spatial-datatypes.html
1208 * @global array MySQL column types
1210 $PMA_SQPdata_column_type = array (
1216 'BOOLEAN', // numeric-type-overview.html
1228 'GEOMETRY', // spatial
1229 'GEOMETRYCOLLECTION', // spatial
1237 'LINESTRING', // spatial
1245 'MULTILINESTRING', // spatial
1246 'MULTIPOINT', // spatial
1247 'MULTIPOLYGON', // spatial
1251 'POLYGON', // spatial
1253 'SERIAL', // alsias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
1267 * $PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
1269 * @global integer MySQL column types count
1271 $PMA_SQPdata_column_type_cnt = 54;
1275 foreach ($GLOBALS as $n => $a) {
1276 echo is_array($a) ? $n . ': ' . count($a) . '<br />' : '';