Translated using Weblate (Slovenian)
[phpmyadmin.git] / libraries / Types.class.php
blobb565e0b59fd672928ad8d1b0f85e16ead03cf64d
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * SQL data types definition
6 * @package PhpMyAdmin
7 */
8 if (! defined('PHPMYADMIN')) {
9 exit;
12 /**
13 * Generic class holding type definitions.
15 * @package PhpMyAdmin
17 class PMA_Types
19 /**
20 * Returns list of unary operators.
22 * @return string[]
24 public function getUnaryOperators()
26 return array(
27 'IS NULL',
28 'IS NOT NULL',
29 "= ''",
30 "!= ''",
34 /**
35 * Check whether operator is unary.
37 * @param string $op operator name
39 * @return boolean
41 public function isUnaryOperator($op)
43 return in_array($op, $this->getUnaryOperators());
46 /**
47 * Returns list of operators checking for NULL.
49 * @return string[]
51 public function getNullOperators()
53 return array(
54 'IS NULL',
55 'IS NOT NULL',
59 /**
60 * ENUM search operators
62 * @return string[]
64 public function getEnumOperators()
66 return array(
67 '=',
68 '!=',
72 /**
73 * TEXT search operators
75 * @return string[]
77 public function getTextOperators()
79 return array(
80 'LIKE',
81 'LIKE %...%',
82 'NOT LIKE',
83 '=',
84 '!=',
85 'REGEXP',
86 'REGEXP ^...$',
87 'NOT REGEXP',
88 "= ''",
89 "!= ''",
90 'IN (...)',
91 'NOT IN (...)',
92 'BETWEEN',
93 'NOT BETWEEN',
97 /**
98 * Number search operators
100 * @return string[]
102 public function getNumberOperators()
104 return array(
105 '=',
106 '>',
107 '>=',
108 '<',
109 '<=',
110 '!=',
111 'LIKE',
112 'LIKE %...%',
113 'NOT LIKE',
114 'IN (...)',
115 'NOT IN (...)',
116 'BETWEEN',
117 'NOT BETWEEN',
122 * Returns operators for given type
124 * @param string $type Type of field
125 * @param boolean $null Whether field can be NULL
127 * @return string[]
129 public function getTypeOperators($type, $null)
131 $ret = array();
132 $class = $this->getTypeClass($type);
134 if (strncasecmp($type, 'enum', 4) == 0) {
135 $ret = array_merge($ret, $this->getEnumOperators());
136 } elseif ($class == 'CHAR') {
137 $ret = array_merge($ret, $this->getTextOperators());
138 } else {
139 $ret = array_merge($ret, $this->getNumberOperators());
142 if ($null) {
143 $ret = array_merge($ret, $this->getNullOperators());
146 return $ret;
150 * Returns operators for given type as html options
152 * @param string $type Type of field
153 * @param boolean $null Whether field can be NULL
154 * @param string $selectedOperator Option to be selected
156 * @return string Generated Html
158 public function getTypeOperatorsHtml($type, $null, $selectedOperator = null)
160 $html = '';
162 foreach ($this->getTypeOperators($type, $null) as $fc) {
163 if (isset($selectedOperator) && $selectedOperator == $fc) {
164 $selected = ' selected="selected"';
165 } else {
166 $selected = '';
168 $html .= '<option value="' . htmlspecialchars($fc) . '"'
169 . $selected . '>'
170 . htmlspecialchars($fc) . '</option>';
173 return $html;
177 * Returns the data type description.
179 * @param string $type The data type to get a description.
181 * @return string
184 public function getTypeDescription($type)
186 return '';
190 * Returns class of a type, used for functions available for type
191 * or default values.
193 * @param string $type The data type to get a class.
195 * @return string
198 public function getTypeClass($type)
200 return '';
204 * Returns array of functions available for a class.
206 * @param string $class The class to get function list.
208 * @return string[]
211 public function getFunctionsClass($class)
213 return array();
217 * Returns array of functions available for a type.
219 * @param string $type The data type to get function list.
221 * @return string[]
224 public function getFunctions($type)
226 $class = $this->getTypeClass($type);
227 return $this->getFunctionsClass($class);
231 * Returns array of all functions available.
233 * @return string[]
236 public function getAllFunctions()
238 $ret = array_merge(
239 $this->getFunctionsClass('CHAR'),
240 $this->getFunctionsClass('NUMBER'),
241 $this->getFunctionsClass('DATE'),
242 $this->getFunctionsClass('UUID')
244 sort($ret);
245 return $ret;
249 * Returns array of all attributes available.
251 * @return string[]
254 public function getAttributes()
256 return array();
260 * Returns array of all column types available.
262 * @return string[]
265 public function getColumns()
267 // most used types
268 return array(
269 'INT',
270 'VARCHAR',
271 'TEXT',
272 'DATE',
277 * Returns an array of integer types
279 * @return string[] integer types
281 public function getIntegerTypes()
283 return array();
287 * Returns the min and max values of a given integer type
289 * @param string $type integer type
290 * @param boolean $signed whether signed
292 * @return string[] min and max values
294 public function getIntegerRange($type, $signed = true)
296 return array('', '');
301 * Class holding type definitions for MySQL.
303 * @package PhpMyAdmin
305 class PMA_Types_MySQL extends PMA_Types
308 * Returns the data type description.
310 * @param string $type The data type to get a description.
312 * @return string
315 public function getTypeDescription($type)
317 $type = /*overload*/mb_strtoupper($type);
318 switch ($type) {
319 case 'TINYINT':
320 return __('A 1-byte integer, signed range is -128 to 127, unsigned range is 0 to 255');
321 case 'SMALLINT':
322 return __('A 2-byte integer, signed range is -32,768 to 32,767, unsigned range is 0 to 65,535');
323 case 'MEDIUMINT':
324 return __('A 3-byte integer, signed range is -8,388,608 to 8,388,607, unsigned range is 0 to 16,777,215');
325 case 'INT':
326 return __('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');
327 case 'BIGINT':
328 return __('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');
329 case 'DECIMAL':
330 return __('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)');
331 case 'FLOAT':
332 return __('A small floating-point number, allowable values are -3.402823466E+38 to -1.175494351E-38, 0, and 1.175494351E-38 to 3.402823466E+38');
333 case 'DOUBLE':
334 return __('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');
335 case 'REAL':
336 return __('Synonym for DOUBLE (exception: in REAL_AS_FLOAT SQL mode it is a synonym for FLOAT)');
337 case 'BIT':
338 return __('A bit-field type (M), storing M of bits per value (default is 1, maximum is 64)');
339 case 'BOOLEAN':
340 return __('A synonym for TINYINT(1), a value of zero is considered false, nonzero values are considered true');
341 case 'SERIAL':
342 return __('An alias for BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE');
343 case 'DATE':
344 return sprintf(__('A date, supported range is %1$s to %2$s'), '1000-01-01', '9999-12-31');
345 case 'DATETIME':
346 return sprintf(__('A date and time combination, supported range is %1$s to %2$s'), '1000-01-01 00:00:00', '9999-12-31 23:59:59');
347 case 'TIMESTAMP':
348 return __('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)');
349 case 'TIME':
350 return sprintf(__('A time, range is %1$s to %2$s'), '-838:59:59', '838:59:59');
351 case 'YEAR':
352 return __("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");
353 case 'CHAR':
354 return __('A fixed-length (0-255, default 1) string that is always right-padded with spaces to the specified length when stored');
355 case 'VARCHAR':
356 return sprintf(__('A variable-length (%s) string, the effective maximum length is subject to the maximum row size'), '0-65,535');
357 case 'TINYTEXT':
358 return __('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');
359 case 'TEXT':
360 return __('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');
361 case 'MEDIUMTEXT':
362 return __('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');
363 case 'LONGTEXT':
364 return __('A TEXT column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) characters, stored with a four-byte prefix indicating the length of the value in bytes');
365 case 'BINARY':
366 return __('Similar to the CHAR type, but stores binary byte strings rather than non-binary character strings');
367 case 'VARBINARY':
368 return __('Similar to the VARCHAR type, but stores binary byte strings rather than non-binary character strings');
369 case 'TINYBLOB':
370 return __('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');
371 case 'MEDIUMBLOB':
372 return __('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');
373 case 'BLOB':
374 return __('A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, stored with a two-byte prefix indicating the length of the value');
375 case 'LONGBLOB':
376 return __('A BLOB column with a maximum length of 4,294,967,295 or 4GiB (2^32 - 1) bytes, stored with a four-byte prefix indicating the length of the value');
377 case 'ENUM':
378 return __("An enumeration, chosen from the list of up to 65,535 values or the special '' error value");
379 case 'SET':
380 return __("A single value chosen from a set of up to 64 members");
381 case 'GEOMETRY':
382 return __('A type that can store a geometry of any type');
383 case 'POINT':
384 return __('A point in 2-dimensional space');
385 case 'LINESTRING':
386 return __('A curve with linear interpolation between points');
387 case 'POLYGON':
388 return __('A polygon');
389 case 'MULTIPOINT':
390 return __('A collection of points');
391 case 'MULTILINESTRING':
392 return __('A collection of curves with linear interpolation between points');
393 case 'MULTIPOLYGON':
394 return __('A collection of polygons');
395 case 'GEOMETRYCOLLECTION':
396 return __('A collection of geometry objects of any type');
398 return '';
402 * Returns class of a type, used for functions available for type
403 * or default values.
405 * @param string $type The data type to get a class.
407 * @return string
410 public function getTypeClass($type)
412 $type = /*overload*/mb_strtoupper($type);
413 switch ($type) {
414 case 'TINYINT':
415 case 'SMALLINT':
416 case 'MEDIUMINT':
417 case 'INT':
418 case 'BIGINT':
419 case 'DECIMAL':
420 case 'FLOAT':
421 case 'DOUBLE':
422 case 'REAL':
423 case 'BIT':
424 case 'BOOLEAN':
425 case 'SERIAL':
426 return 'NUMBER';
428 case 'DATE':
429 case 'DATETIME':
430 case 'TIMESTAMP':
431 case 'TIME':
432 case 'YEAR':
433 return 'DATE';
435 case 'CHAR':
436 case 'VARCHAR':
437 case 'TINYTEXT':
438 case 'TEXT':
439 case 'MEDIUMTEXT':
440 case 'LONGTEXT':
441 case 'BINARY':
442 case 'VARBINARY':
443 case 'TINYBLOB':
444 case 'MEDIUMBLOB':
445 case 'BLOB':
446 case 'LONGBLOB':
447 case 'ENUM':
448 case 'SET':
449 return 'CHAR';
451 case 'GEOMETRY':
452 case 'POINT':
453 case 'LINESTRING':
454 case 'POLYGON':
455 case 'MULTIPOINT':
456 case 'MULTILINESTRING':
457 case 'MULTIPOLYGON':
458 case 'GEOMETRYCOLLECTION':
459 return 'SPATIAL';
462 return '';
466 * Returns array of functions available for a class.
468 * @param string $class The class to get function list.
470 * @return string[]
473 public function getFunctionsClass($class)
475 switch ($class) {
476 case 'CHAR':
477 $ret = array(
478 'AES_DECRYPT',
479 'AES_ENCRYPT',
480 'BIN',
481 'CHAR',
482 'COMPRESS',
483 'CURRENT_USER',
484 'DATABASE',
485 'DAYNAME',
486 'DES_DECRYPT',
487 'DES_ENCRYPT',
488 'ENCRYPT',
489 'HEX',
490 'INET6_NTOA',
491 'INET_NTOA',
492 'LOAD_FILE',
493 'LOWER',
494 'LTRIM',
495 'MD5',
496 'MONTHNAME',
497 'OLD_PASSWORD',
498 'PASSWORD',
499 'QUOTE',
500 'REVERSE',
501 'RTRIM',
502 'SHA1',
503 'SOUNDEX',
504 'SPACE',
505 'TRIM',
506 'UNCOMPRESS',
507 'UNHEX',
508 'UPPER',
509 'USER',
510 'UUID',
511 'VERSION',
514 if ((PMA_MARIADB && PMA_MYSQL_INT_VERSION < 100012)
515 || PMA_MYSQL_INT_VERSION < 50603
517 $ret = array_diff($ret, array('INET6_NTOA'));
519 return $ret;
521 case 'DATE':
522 return array(
523 'CURRENT_DATE',
524 'CURRENT_TIME',
525 'DATE',
526 'FROM_DAYS',
527 'FROM_UNIXTIME',
528 'LAST_DAY',
529 'NOW',
530 'SEC_TO_TIME',
531 'SYSDATE',
532 'TIME',
533 'TIMESTAMP',
534 'UTC_DATE',
535 'UTC_TIME',
536 'UTC_TIMESTAMP',
537 'YEAR',
540 case 'NUMBER':
541 $ret = array(
542 'ABS',
543 'ACOS',
544 'ASCII',
545 'ASIN',
546 'ATAN',
547 'BIT_LENGTH',
548 'BIT_COUNT',
549 'CEILING',
550 'CHAR_LENGTH',
551 'CONNECTION_ID',
552 'COS',
553 'COT',
554 'CRC32',
555 'DAYOFMONTH',
556 'DAYOFWEEK',
557 'DAYOFYEAR',
558 'DEGREES',
559 'EXP',
560 'FLOOR',
561 'HOUR',
562 'INET6_ATON',
563 'INET_ATON',
564 'LENGTH',
565 'LN',
566 'LOG',
567 'LOG2',
568 'LOG10',
569 'MICROSECOND',
570 'MINUTE',
571 'MONTH',
572 'OCT',
573 'ORD',
574 'PI',
575 'QUARTER',
576 'RADIANS',
577 'RAND',
578 'ROUND',
579 'SECOND',
580 'SIGN',
581 'SIN',
582 'SQRT',
583 'TAN',
584 'TO_DAYS',
585 'TO_SECONDS',
586 'TIME_TO_SEC',
587 'UNCOMPRESSED_LENGTH',
588 'UNIX_TIMESTAMP',
589 'UUID_SHORT',
590 'WEEK',
591 'WEEKDAY',
592 'WEEKOFYEAR',
593 'YEARWEEK',
595 if ((PMA_MARIADB && PMA_MYSQL_INT_VERSION < 100012)
596 || PMA_MYSQL_INT_VERSION < 50603
598 $ret = array_diff($ret, array('INET6_ATON'));
600 return $ret;
602 case 'SPATIAL':
603 return array(
604 'GeomFromText',
605 'GeomFromWKB',
607 'GeomCollFromText',
608 'LineFromText',
609 'MLineFromText',
610 'PointFromText',
611 'MPointFromText',
612 'PolyFromText',
613 'MPolyFromText',
615 'GeomCollFromWKB',
616 'LineFromWKB',
617 'MLineFromWKB',
618 'PointFromWKB',
619 'MPointFromWKB',
620 'PolyFromWKB',
621 'MPolyFromWKB',
624 return array();
628 * Returns array of all attributes available.
630 * @return string[]
633 public function getAttributes()
635 return array(
637 'BINARY',
638 'UNSIGNED',
639 'UNSIGNED ZEROFILL',
640 'on update CURRENT_TIMESTAMP',
645 * Returns array of all column types available.
647 * VARCHAR, TINYINT, TEXT and DATE are listed first, based on
648 * estimated popularity.
650 * @return string[]
653 public function getColumns()
655 $ret = parent::getColumns();
656 // numeric
657 $ret[_pgettext('numeric types', 'Numeric')] = array(
658 'TINYINT',
659 'SMALLINT',
660 'MEDIUMINT',
661 'INT',
662 'BIGINT',
663 '-',
664 'DECIMAL',
665 'FLOAT',
666 'DOUBLE',
667 'REAL',
668 '-',
669 'BIT',
670 'BOOLEAN',
671 'SERIAL',
674 // Date/Time
675 $ret[_pgettext('date and time types', 'Date and time')] = array(
676 'DATE',
677 'DATETIME',
678 'TIMESTAMP',
679 'TIME',
680 'YEAR',
683 // Text
684 $ret[_pgettext('string types', 'String')] = array(
685 'CHAR',
686 'VARCHAR',
687 '-',
688 'TINYTEXT',
689 'TEXT',
690 'MEDIUMTEXT',
691 'LONGTEXT',
692 '-',
693 'BINARY',
694 'VARBINARY',
695 '-',
696 'TINYBLOB',
697 'MEDIUMBLOB',
698 'BLOB',
699 'LONGBLOB',
700 '-',
701 'ENUM',
702 'SET',
705 $ret[_pgettext('spatial types', 'Spatial')] = array(
706 'GEOMETRY',
707 'POINT',
708 'LINESTRING',
709 'POLYGON',
710 'MULTIPOINT',
711 'MULTILINESTRING',
712 'MULTIPOLYGON',
713 'GEOMETRYCOLLECTION',
716 return $ret;
720 * Returns an array of integer types
722 * @return string[] integer types
724 public function getIntegerTypes()
726 return array('tinyint', 'smallint', 'mediumint', 'int', 'bigint');
730 * Returns the min and max values of a given integer type
732 * @param string $type integer type
733 * @param boolean $signed whether signed
735 * @return string[] min and max values
737 public function getIntegerRange($type, $signed = true)
739 static $min_max_data = array(
740 'unsigned' => array(
741 'tinyint' => array('0', '255'),
742 'smallint' => array('0', '65535'),
743 'mediumint' => array('0', '16777215'),
744 'int' => array('0', '4294967295'),
745 'bigint' => array('0', '18446744073709551615')
747 'signed' => array(
748 'tinyint' => array('-128', '127'),
749 'smallint' => array('-32768', '32767'),
750 'mediumint' => array('-8388608', '8388607'),
751 'int' => array('-2147483648', '2147483647'),
752 'bigint' => array('-9223372036854775808', '9223372036854775807')
755 $relevantArray = $signed
756 ? $min_max_data['signed']
757 : $min_max_data['unsigned'];
758 return isset($relevantArray[$type]) ? $relevantArray[$type] : array('', '');
763 * Class holding type definitions for Drizzle.
765 * @package PhpMyAdmin
767 class PMA_Types_Drizzle extends PMA_Types
770 * Returns the data type description.
772 * @param string $type The data type to get a description.
774 * @return string
777 public function getTypeDescription($type)
779 $type = /*overload*/mb_strtoupper($type);
780 switch ($type) {
781 case 'INTEGER':
782 return __('A 4-byte integer, range is -2,147,483,648 to 2,147,483,647');
783 case 'BIGINT':
784 return __('An 8-byte integer, range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807');
785 case 'DECIMAL':
786 return __('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)');
787 case 'DOUBLE':
788 return __("A system's default double-precision floating-point number");
789 case 'BOOLEAN':
790 return __('True or false');
791 case 'SERIAL':
792 return __('An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE');
793 case 'UUID':
794 return __('Stores a Universally Unique Identifier (UUID)');
795 case 'DATE':
796 return sprintf(__('A date, supported range is %1$s to %2$s'), '0001-01-01', '9999-12-31');
797 case 'DATETIME':
798 return sprintf(__('A date and time combination, supported range is %1$s to %2$s'), '0001-01-01 00:00:0', '9999-12-31 23:59:59');
799 case 'TIMESTAMP':
800 return __("A timestamp, range is '0001-01-01 00:00:00' UTC to '9999-12-31 23:59:59' UTC; TIMESTAMP(6) can store microseconds");
801 case 'TIME':
802 return sprintf(__('A time, range is %1$s to %2$s'), '00:00:00', '23:59:59');
803 case 'VARCHAR':
804 return sprintf(__('A variable-length (%s) string, the effective maximum length is subject to the maximum row size'), '0-16,383');
805 case 'TEXT':
806 return __('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');
807 case 'VARBINARY':
808 return __('A variable-length (0-65,535) string, uses binary collation for all comparisons');
809 case 'BLOB':
810 return __('A BLOB column with a maximum length of 65,535 (2^16 - 1) bytes, stored with a two-byte prefix indicating the length of the value');
811 case 'ENUM':
812 return __("An enumeration, chosen from the list of defined values");
814 return '';
818 * Returns class of a type, used for functions available for type
819 * or default values.
821 * @param string $type The data type to get a class.
823 * @return string
826 public function getTypeClass($type)
828 $type = /*overload*/mb_strtoupper($type);
829 switch ($type) {
830 case 'INTEGER':
831 case 'BIGINT':
832 case 'DECIMAL':
833 case 'DOUBLE':
834 case 'BOOLEAN':
835 case 'SERIAL':
836 return 'NUMBER';
838 case 'DATE':
839 case 'DATETIME':
840 case 'TIMESTAMP':
841 case 'TIME':
842 return 'DATE';
844 case 'VARCHAR':
845 case 'TEXT':
846 case 'VARBINARY':
847 case 'BLOB':
848 case 'ENUM':
849 return 'CHAR';
851 case 'UUID':
852 return 'UUID';
854 return '';
858 * Returns array of functions available for a class.
860 * @param string $class The class to get function list.
862 * @return string[]
865 public function getFunctionsClass($class)
867 switch ($class) {
868 case 'CHAR':
869 $ret = array(
870 'BIN',
871 'CHAR',
872 'COMPRESS',
873 'CURRENT_USER',
874 'DATABASE',
875 'DAYNAME',
876 'HEX',
877 'LOAD_FILE',
878 'LOWER',
879 'LTRIM',
880 'MD5',
881 'MONTHNAME',
882 'QUOTE',
883 'REVERSE',
884 'RTRIM',
885 'SCHEMA',
886 'SPACE',
887 'TRIM',
888 'UNCOMPRESS',
889 'UNHEX',
890 'UPPER',
891 'USER',
892 'UUID',
893 'VERSION',
896 // check for some functions known to be in modules
897 $functions = array(
898 'MYSQL_PASSWORD',
899 'ROT13',
902 // add new functions
903 $sql = "SELECT upper(plugin_name) f
904 FROM data_dictionary.plugins
905 WHERE plugin_name IN ('" . implode("','", $functions) . "')
906 AND plugin_type = 'Function'
907 AND is_active";
908 $drizzle_functions = $GLOBALS['dbi']->fetchResult($sql, 'f', 'f');
909 if (count($drizzle_functions) > 0) {
910 $ret = array_merge($ret, $drizzle_functions);
911 sort($ret);
914 return $ret;
916 case 'UUID':
917 return array(
918 'UUID',
921 case 'DATE':
922 return array(
923 'CURRENT_DATE',
924 'CURRENT_TIME',
925 'DATE',
926 'FROM_DAYS',
927 'FROM_UNIXTIME',
928 'LAST_DAY',
929 'NOW',
930 'SYSDATE',
931 //'TIME', // https://bugs.launchpad.net/drizzle/+bug/804571
932 'TIMESTAMP',
933 'UTC_DATE',
934 'UTC_TIME',
935 'UTC_TIMESTAMP',
936 'YEAR',
939 case 'NUMBER':
940 return array(
941 'ABS',
942 'ACOS',
943 'ASCII',
944 'ASIN',
945 'ATAN',
946 'BIT_COUNT',
947 'CEILING',
948 'CHAR_LENGTH',
949 'CONNECTION_ID',
950 'COS',
951 'COT',
952 'CRC32',
953 'DAYOFMONTH',
954 'DAYOFWEEK',
955 'DAYOFYEAR',
956 'DEGREES',
957 'EXP',
958 'FLOOR',
959 'HOUR',
960 'LENGTH',
961 'LN',
962 'LOG',
963 'LOG2',
964 'LOG10',
965 'MICROSECOND',
966 'MINUTE',
967 'MONTH',
968 'OCT',
969 'ORD',
970 'PI',
971 'QUARTER',
972 'RADIANS',
973 'RAND',
974 'ROUND',
975 'SECOND',
976 'SIGN',
977 'SIN',
978 'SQRT',
979 'TAN',
980 'TO_DAYS',
981 'TIME_TO_SEC',
982 'UNCOMPRESSED_LENGTH',
983 'UNIX_TIMESTAMP',
984 //'WEEK', // same as TIME
985 'WEEKDAY',
986 'WEEKOFYEAR',
987 'YEARWEEK',
990 return array();
994 * Returns array of all attributes available.
996 * @return string[]
999 public function getAttributes()
1001 return array(
1003 'on update CURRENT_TIMESTAMP',
1008 * Returns array of all column types available.
1010 * @return string[]
1013 public function getColumns()
1015 $types_num = array(
1016 'INTEGER',
1017 'BIGINT',
1018 '-',
1019 'DECIMAL',
1020 'DOUBLE',
1021 '-',
1022 'BOOLEAN',
1023 'SERIAL',
1024 'UUID',
1026 $types_date = array(
1027 'DATE',
1028 'DATETIME',
1029 'TIMESTAMP',
1030 'TIME',
1032 $types_string = array(
1033 'VARCHAR',
1034 'TEXT',
1035 '-',
1036 'VARBINARY',
1037 'BLOB',
1038 '-',
1039 'ENUM',
1041 if (PMA_MYSQL_INT_VERSION >= 70132) {
1042 $types_string[] = '-';
1043 $types_string[] = 'IPV6';
1046 $ret = parent::getColumns();
1047 // numeric
1048 $ret[_pgettext('numeric types', 'Numeric')] = $types_num;
1050 // Date/Time
1051 $ret[_pgettext('date and time types', 'Date and time')] = $types_date;
1053 // Text
1054 $ret[_pgettext('string types', 'String')] = $types_string;
1056 return $ret;
1060 * Returns an array of integer types
1062 * @return string[] integer types
1064 public function getIntegerTypes()
1066 return array('integer', 'bigint');
1070 * Returns the min and max values of a given integer type
1072 * @param string $type integer type
1073 * @param boolean $signed whether signed (ignored for Drizzle)
1075 * @return string[] min and max values
1077 public function getIntegerRange($type, $signed = true)
1079 static $min_max_data = array(
1080 'integer' => array('-2147483648', '2147483647'),
1081 'bigint' => array('-9223372036854775808', '9223372036854775807')
1083 return isset($min_max_data[$type]) ? $min_max_data[$type] : array('', '');