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.
25 if (! defined('PHPMYADMIN')) {
30 * @global array MySQL function names
32 $PMA_SQPdata_function_name = array (
39 'AREA', // Area() polygon-property-functions.html
40 'ASBINARY', // AsBinary()
47 'BDMPOLYFROMTEXT', // BdMPolyFromText()
48 'BDMPOLYFROMWKB', // BdMPolyFromWKB()
49 'BDPOLYFROMTEXT', // BdPolyFromText()
50 'BDPOLYFROMWKB', // BdPolyFromWKB()
57 'BIT_XOR', // group-by-functions.html
58 'BOUNDARY', // Boundary() general-geometry-property-functions.html
63 'CENTROID', // Centroid() multipolygon-property-functions.html
64 'CHAR', // string-functions.html
66 'CHARSET', // information-functions.html
69 'COERCIBILITY', // information-functions.html
70 'COLLATION', // information-functions.html
71 'COMPRESS', // string-functions.html
75 'CONTAINS', // Contains()
79 'CONVEXHULL', // ConvexHull()
83 'CRC32', // mathematical-functions.html
84 'CROSSES', // Crosses()
92 'DATE', // date-and-time-functions.html
93 'DATEDIFF', // date-and-time-functions.html
104 'DEFAULT', // miscellaneous-functions.html
108 'DIFFERENCE', // Difference()
109 'DIMENSION', // Dimension() general-geometry-property-functions.html
110 'DISJOINT', // Disjoint()
111 'DISTANCE', // Distance()
115 'ENDPOINT', // EndPoint() linestring-property-functions.html
116 'ENVELOPE', // Envelope() general-geometry-property-functions.html
117 'EQUALS', // Equals()
120 'EXTERIORRING', // ExteriorRing() polygon-property-functions.html
122 'EXTRACTVALUE', // ExtractValue() xml-functions.html
130 'GEOMCOLLFROMTEXT', // GeomCollFromText()
131 'GEOMCOLLFROMWKB', // GeomCollFromWKB()
132 'GEOMETRYCOLLECTION', // GeometryCollection()
133 'GEOMETRYCOLLECTIONFROMTEXT', // GeometryCollectionFromText()
134 'GEOMETRYCOLLECTIONFROMWKB', // GeometryCollectionFromWKB()
135 'GEOMETRYFROMTEXT', // GeometryFromText()
136 'GEOMETRYFROMWKB', // GeometryFromWKB()
137 'GEOMETRYN', // GeometryN() geometrycollection-property-functions.html
138 'GEOMETRYTYPE', // GeometryType() general-geometry-property-functions.html
139 'GEOMFROMTEXT', // GeomFromText()
140 'GEOMFROMWKB', // GeomFromWKB()
143 'GLENGTH', // GLength() linestring-property-functions.html
146 'GROUP_UNIQUE_USERS',
149 'IF', //control-flow-functions.html
153 'INSERT', // string-functions.html
155 'INTERIORRINGN', // InteriorRingN() polygon-property-functions.html
156 'INTERSECTION', // Intersection()
157 'INTERSECTS', // Intersects()
159 'ISCLOSED', // IsClosed() multilinestring-property-functions.html
160 'ISEMPTY', // IsEmpty() general-geometry-property-functions.html
162 'ISRING', // IsRing() linestring-property-functions.html
163 'ISSIMPLE', // IsSimple() general-geometry-property-functions.html
165 'IS_USED_LOCK', // miscellaneous-functions.html
172 'LINEFROMTEXT', // LineFromText()
173 'LINEFROMWKB', // LineFromWKB()
174 'LINESTRING', // LineString()
175 'LINESTRINGFROMTEXT', // LineStringFromText()
176 'LINESTRINGFROMWKB', // LineStringFromWKB()
193 'MBRCONTAINS', // MBRContains()
194 'MBRDISJOINT', // MBRDisjoint()
195 'MBREQUAL', // MBREqual()
196 'MBRINTERSECTS', // MBRIntersects()
197 'MBROVERLAPS', // MBROverlaps()
198 'MBRTOUCHES', // MBRTouches()
199 'MBRWITHIN', // MBRWithin()
205 'MLINEFROMTEXT', // MLineFromText()
206 'MLINEFROMWKB', // MLineFromWKB()
211 'MPOINTFROMTEXT', // MPointFromText()
212 'MPOINTFROMWKB', // MPointFromWKB()
213 'MPOLYFROMTEXT', // MPolyFromText()
214 'MPOLYFROMWKB', // MPolyFromWKB()
215 'MULTILINESTRING', // MultiLineString()
216 'MULTILINESTRINGFROMTEXT', // MultiLineStringFromText()
217 'MULTILINESTRINGFROMWKB', // MultiLineStringFromWKB()
218 'MULTIPOINT', // MultiPoint()
219 'MULTIPOINTFROMTEXT', // MultiPointFromText()
220 'MULTIPOINTFROMWKB', // MultiPointFromWKB()
221 'MULTIPOLYGON', // MultiPolygon()
222 'MULTIPOLYGONFROMTEXT', // MultiPolygonFromText()
223 'MULTIPOLYGONFROMWKB', // MultiPolygonFromWKB()
224 'NAME_CONST', // NAME_CONST()
227 'NUMGEOMETRIES', // NumGeometries() geometrycollection-property-functions.html
228 'NUMINTERIORRINGS', // NumInteriorRings() polygon-property-functions.html
229 'NUMPOINTS', // NumPoints() linestring-property-functions.html
234 'OVERLAPS', // Overlaps()
240 'POINTFROMTEXT', // PointFromText()
241 'POINTFROMWKB', // PointFromWKB()
242 'POINTN', // PointN() inestring-property-functions.html
243 'POINTONSURFACE', // PointOnSurface() multipolygon-property-functions.html
244 'POLYFROMTEXT', // PolyFromText()
245 'POLYFROMWKB', // PolyFromWKB()
246 'POLYGON', // Polygon()
247 'POLYGONFROMTEXT', // PolygonFromText()
248 'POLYGONFROMWKB', // PolygonFromWKB()
256 'RELATED', // Related()
259 'REPLACE', // string-functions.html
263 'ROW_COUNT', // information-functions.html
266 'SCHEMA', // information-functions.html
274 'SLEEP', // miscellaneous-functions.html
278 'SRID', // general-geometry-property-functions.html
279 'STARTPOINT', // StartPoint() linestring-property-functions.html
282 'STDDEV_POP', // group-by-functions.html
283 'STDDEV_SAMP', // group-by-functions.html
292 'SYMDIFFERENCE', // SymDifference()
303 'TOUCHES', // Touches()
306 'TRUNCATE', // mathematical-functions.html
308 'UNCOMPRESS', // string-functions.html
309 'UNCOMPRESSED_LENGTH', // string-functions.html
310 'UNHEX', // string-functions.html
313 'UPDATEXML', // UpdateXML() xml-functions.html
319 'UUID', // miscellaneous-functions.html
320 'VARIANCE', // group-by-functions.html
321 'VAR_POP', // group-by-functions.html
322 'VAR_SAMP', // group-by-functions.html
327 'WITHIN', // Within()
328 'X', // point-property-functions.html
329 'Y', // point-property-functions.html
334 * $PMA_SQPdata_function_name_cnt = count($PMA_SQPdata_function_name);
336 * @global integer MySQL attributes count
338 $PMA_SQPdata_function_name_cnt = 299;
342 $test_PMA_SQPdata_function_name = $PMA_SQPdata_function_name;
343 sort($PMA_SQPdata_function_name);
344 if ($PMA_SQPdata_function_name != $test_PMA_SQPdata_function_name) {
345 echo 'sort properly like this<pre>';
346 print_r($PMA_SQPdata_function_name);
352 * @global array MySQL attributes
354 $PMA_SQPdata_column_attrib = array (
359 'BERKELEYDB', // Engine alias BDB
361 'BLACKHOLE', // Engine
365 'FEDERATED', // Engine
367 'INNOBASE', // Engine alias InnoDB
368 'INNODB', // Engine InnoDB
371 'MEMORY', // Engine alias HEAP, but preferred
373 'MRG_ISAM', // Engine
374 'MRG_MYISAM', // Engine alias MERGE
375 'MYISAM', // Engine MyISAM
377 'NDB', // Engine alias NDBCLUSTER
378 'NDBCLUSTER', // Engine
387 * $PMA_SQPdata_column_attrib_cnt = count($PMA_SQPdata_column_attrib);
389 * @global integer MySQL attributes count
391 $PMA_SQPdata_column_attrib_cnt = 30;
394 * words that are reserved by MySQL and may not be used as identifiers without quotes
396 * @see http://dev.mysql.com/doc/refman/5.1/en/reserved-words.html
398 * @global array MySQL reserved words
400 $PMA_SQPdata_reserved_word = array (
494 'GEMINI_SPIN_RETRIES',
542 'MASTER_CONNECT_RETRY',
550 'MAX_CONNECTIONS_PER_HOUR',
551 'MAX_QUERIES_PER_HOUR',
553 'MAX_UPDATES_PER_HOUR',
554 'MAX_USER_CONNECTIONS',
567 // 'NO' is not allowed in SQL-99 but is allowed in MySQL
582 'PAGE', // 5.1-maria ?
633 'SOUNDS', // string-functions.html
641 'SQL_CALC_FOUND_ROWS',
645 'SQL_LOW_PRIORITY_UPDATES',
648 'SQL_QUOTE_SHOW_CREATE',
651 'SQL_SLAVE_SKIP_COUNTER',
670 'TRANSACTIONAL', // 5.1 ?
694 * $PMA_SQPdata_reserved_word_cnt = count($PMA_SQPdata_reserved_word);
696 * @global integer MySQL reserved words count
698 $PMA_SQPdata_reserved_word_cnt = 289;
700 * The previous array must be sorted so that the binary search work.
701 * Sometimes a word is not added in the correct order, so
702 * this debugging code shows the problem. The same should be
703 * done for all arrays.
706 $original = $PMA_SQPdata_reserved_word;
707 sort($PMA_SQPdata_reserved_word);
708 $difference = array_diff_assoc($original, $PMA_SQPdata_reserved_word);
710 print_r($difference);
713 print_r($PMA_SQPdata_reserved_word);
718 * words forbidden to be used as column or table name wihtout quotes
719 * as seen in http://dev.mysql.com/doc/mysql/en/reserved-words.html
721 * @global array MySQL forbidden words
723 $PMA_SQPdata_forbidden_word = array (
876 'GEOMETRYCOLLECTION',
953 'MASTER_CONNECT_RETRY',
968 'MAX_CONNECTIONS_PER_HOUR',
969 'MAX_QUERIES_PER_HOUR',
971 'MAX_UPDATES_PER_HOUR',
972 'MAX_USER_CONNECTIONS',
982 'MINUTE_MICROSECOND',
1006 'NO_WRITE_TO_BINLOG',
1048 'READ_WRITE', // 5.1
1087 'SECOND_MICROSECOND',
1114 'SQL_BUFFER_RESULT',
1116 'SQL_CALC_FOUND_ROWS',
1121 'SQL_TSI_FRAC_SECOND',
1209 * count($PMA_SQPdata_forbidden_word);
1211 * @global integer MySQL forbidden words count
1213 $PMA_SQPdata_forbidden_word_cnt = 483;
1216 * the MySQL column/data types
1218 * @see http://dev.mysql.com/doc/refman/5.1/en/data-types.html
1219 * @see http://dev.mysql.com/doc/refman/5.1/en/mysql-spatial-datatypes.html
1221 * @global array MySQL column types
1223 $PMA_SQPdata_column_type = array (
1229 'BOOLEAN', // numeric-type-overview.html
1241 'GEOMETRY', // spatial
1242 'GEOMETRYCOLLECTION', // spatial
1250 'LINESTRING', // spatial
1258 'MULTILINESTRING', // spatial
1259 'MULTIPOINT', // spatial
1260 'MULTIPOLYGON', // spatial
1264 'POLYGON', // spatial
1266 'SERIAL', // alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY
1280 * $PMA_SQPdata_column_type_cnt = count($PMA_SQPdata_column_type);
1282 * @global integer MySQL column types count
1284 $PMA_SQPdata_column_type_cnt = 54;
1288 foreach ($GLOBALS as $n => $a) {
1289 echo is_array($a) ? $n . ': ' . count($a) . '<br />' : '';