2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Column types and functions supported by MySQL
8 if (! defined('PHPMYADMIN')) {
12 // VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity
13 $cfg['ColumnTypes'] = !empty($cfg['ColumnTypes']) ?
$cfg['ColumnTypes'] : array(
40 'DATE and TIME' => array(
82 $cfg['AttributeTypes'] = !empty($cfg['AttributeTypes']) ?
$cfg['AttributeTypes'] : array(
87 'on update CURRENT_TIMESTAMP',
90 if ($cfg['ShowFunctionFields']) {
91 $cfg['RestrictColumnTypes'] = !empty($cfg['RestrictColumnTypes']) ?
$cfg['RestrictColumnTypes'] : array(
92 'TINYINT' => 'FUNC_NUMBER',
93 'SMALLINT' => 'FUNC_NUMBER',
94 'MEDIUMINT' => 'FUNC_NUMBER',
95 'INT' => 'FUNC_NUMBER',
96 'BIGINT' => 'FUNC_NUMBER',
97 'DECIMAL' => 'FUNC_NUMBER',
98 'FLOAT' => 'FUNC_NUMBER',
99 'DOUBLE' => 'FUNC_NUMBER',
100 'REAL' => 'FUNC_NUMBER',
101 'BIT' => 'FUNC_NUMBER',
102 'BOOLEAN' => 'FUNC_NUMBER',
103 'SERIAL' => 'FUNC_NUMBER',
105 'DATE' => 'FUNC_DATE',
106 'DATETIME' => 'FUNC_DATE',
107 'TIMESTAMP' => 'FUNC_DATE',
108 'TIME' => 'FUNC_DATE',
109 'YEAR' => 'FUNC_DATE',
111 'CHAR' => 'FUNC_CHAR',
112 'VARCHAR' => 'FUNC_CHAR',
113 'TINYTEXT' => 'FUNC_CHAR',
114 'TEXT' => 'FUNC_CHAR',
115 'MEDIUMTEXT' => 'FUNC_CHAR',
116 'LONGTEXT' => 'FUNC_CHAR',
117 'BINARY' => 'FUNC_CHAR',
118 'VARBINARY' => 'FUNC_CHAR',
119 'TINYBLOB' => 'FUNC_CHAR',
120 'MEDIUMBLOB' => 'FUNC_CHAR',
121 'BLOB' => 'FUNC_CHAR',
122 'LONGBLOB' => 'FUNC_CHAR',
126 'GEOMETRY' => 'FUNC_SPATIAL',
127 'POINT' => 'FUNC_SPATIAL',
128 'LINESTRING' => 'FUNC_SPATIAL',
129 'POLYGON' => 'FUNC_SPATIAL',
130 'MULTIPOINT' => 'FUNC_SPATIAL',
131 'MULTILINESTRING' => 'FUNC_SPATIAL',
132 'MULTIPOLYGON' => 'FUNC_SPATIAL',
133 'GEOMETRYCOLLECTION' => 'FUNC_SPATIAL',
137 $restrict_functions = array(
138 'FUNC_CHAR' => array(
172 'FUNC_DATE' => array(
190 'FUNC_NUMBER' => array(
235 'UNCOMPRESSED_LENGTH',
244 'FUNC_SPATIAL' => array(
265 // $restrict_functions holds all known functions, remove these that are unavailable on current server
266 if (PMA_MYSQL_INT_VERSION
< 50500) {
267 $restrict_functions['FUNC_NUMBER'] = array_diff($restrict_functions['FUNC_NUMBER'], array('TO_SECONDS'));
269 if (PMA_MYSQL_INT_VERSION
< 50120) {
270 $restrict_functions['FUNC_NUMBER'] = array_diff($restrict_functions['FUNC_NUMBER'], array('UUID_SHORT'));
273 if (empty($cfg['RestrictFunctions'])) {
274 $cfg['RestrictFunctions'] = $restrict_functions;
277 if (empty($cfg['Functions'])) {
278 // build a list of functions based on $restrict_functions
279 $cfg['Functions'] = array();
280 foreach ($restrict_functions as $cat => $functions) {
281 if ($cat != 'FUNC_SPATIAL') {
282 $cfg['Functions'] = array_merge($cfg['Functions'], $functions);
285 sort($cfg['Functions']);
287 unset($restrict_functions);
291 * This function returns datatypes descriptions.
293 * @return array MySQL datatypes descriptions.
296 function PMA_supportedDataTypesDescriptions()
298 // if possible, for easy translation these strings should be the same as for Drizzle
300 'TINYINT' => __('A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255'),
301 'SMALLINT' => __('A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to 65,535'),
302 'MEDIUMINT' => __('A 3-byte integer, signed range is -8,388,608 to 8,388,607, unsigned range is 0 to 16,777,215'),
303 'INT' => __('A 4-byte integer, signed range is -2,147,483,648 to 2,147,483,647, unsigned range is 0 to 4,294,967,295.'),
304 'BIGINT' => __('An 8-byte integer, signed range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807, unsigned range is 0 to 18,446,744,073,709,551,615'),
305 'DECIMAL' => __('A fixed-point number (M, D) - the maximum number of digits (M) is 65 (default 10), the maximum number of decimals (D) is 30 (default 0)'),
306 'FLOAT' => __('A small floating-point number, allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38'),
307 'DOUBLE' => __('A double-precision floating-point number, allowable values are -1.7976931348623157E+308 to -2.2250738585072014E-308, 0, and 2.2250738585072014E-308 to 1.7976931348623157E+308'),
308 'REAL' => __('Synonym for DOUBLE (exception: in REAL_AS_FLOAT SQL mode it is a synonym for FLOAT)'),
309 'BIT' => __('A bit-field type (M), storing M of bits per value (default is 1, maximum is 64)'),
310 'BOOLEAN' => __('A synonym for TINYINT(1), a value of zero is considered false, nonzero values are considered true'),
311 'SERIAL' => __('An alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE'),
312 'DATE' => sprintf(__("A date, supported range is '%s' to '%s'"), '1000-01-01', '9999-12-31'),
313 'DATETIME' => sprintf(__("A date and time combination, supported range is '%s' to '%s'"), '1000-01-01 00:00:00', '9999-12-31 23:59:59'),
314 'TIMESTAMP' => __("A timestamp, range is '1970-01-01 00:00:01' UTC to '2038-01-09 03:14:07' UTC, stored as the number of seconds since the epoch ('1970-01-01 00:00:00' UTC)"),
315 'TIME' => sprintf(__("A time, range is '%s' to '%s'"), '-838:59:59', '838:59:59'),
316 'YEAR' => __("A year in four-digit (4, default) or two-digit (2) format, the allowable values are 70 (1970) to 69 (2069) or 1901 to 2155 and 0000"),
317 'CHAR' => __('A fixed-length (0-255, default 1) string that is always right-padded with spaces to the specified length when stored'),
318 'VARCHAR' => sprintf(__('A variable-length (%s) string, the effective maximum length is subject to the maximum row size'), '0-65,535'),
319 'TINYTEXT' => __('A TEXT column with a maximum length of 255 (2^8 - 1) characters, stored with a one-byte prefix indicating the length of the value in bytes'),
320 'TEXT' => __('A TEXT column with a maximum length of 65,535 (2^16 - 1) characters, stored with a two-byte prefix indicating the length of the value in bytes'),
321 'MEDIUMTEXT' => __('A TEXT column with a maximum length of 16,777,215 (2^24 - 1) characters, stored with a three-byte prefix indicating the length of the value in bytes'),
322 'LONGTEXT' => __('A TEXT column with a maximum length of 4,294,967,295 or 4GB (2^32 - 1) characters, stored with a four-byte prefix indicating the length of the value in bytes'),
323 'BINARY' => __('Similar to the CHAR type, but stores binary byte strings rather than non-binary character strings'),
324 'VARBINARY' => __('Similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings'),
325 'TINYBLOB' => __('A BLOB column with a maximum length of 255 (2^8 - 1) bytes, stored with a one-byte prefix indicating the length of the value'),
326 'MEDIUMBLOB' => __('A BLOB column with a maximum length of 16,777,215 (2^24 - 1) bytes, stored with a three-byte prefix indicating the length of the value'),
327 'BLOB' => __('A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, stored with a four-byte prefix indicating the length of the value'),
328 'LONGBLOB' => __('A BLOB column with a maximum length of 4,294,967,295 or 4GB (2^32 - 1) bytes, stored with a two-byte prefix indicating the length of the value'),
329 'ENUM' => __("An enumeration, chosen from the list of up to 65,535 values or the special '' error value"),
330 'SET' => __("A single value chosen from a set of up to 64 members"),
331 'GEOMETRY' => __('A type that can store a geometry of any type'),
332 'POINT' => __('A point in 2-dimensional space'),
333 'LINESTRING' => __('A curve with linear interpolation between points'),
334 'POLYGON' => __('A polygon'),
335 'MULTIPOINT' => __('A collection of points'),
336 'MULTILINESTRING' => __('A collection of curves with linear interpolation between points'),
337 'MULTIPOLYGON' => __('A collection of polygons'),
338 'GEOMETRYCOLLECTION' => __('A collection of geometry objects of any type'),
340 } // end PMA_supportedDataTypesDescriptions()