Translated using Weblate (Finnish)
[phpmyadmin.git] / libraries / Types.class.php
blob0729a1322b7e5f89758f89069f2124a27f34fc68
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 return 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 'INET_NTOA',
491 'LOAD_FILE',
492 'LOWER',
493 'LTRIM',
494 'MD5',
495 'MONTHNAME',
496 'OLD_PASSWORD',
497 'PASSWORD',
498 'QUOTE',
499 'REVERSE',
500 'RTRIM',
501 'SHA1',
502 'SOUNDEX',
503 'SPACE',
504 'TRIM',
505 'UNCOMPRESS',
506 'UNHEX',
507 'UPPER',
508 'USER',
509 'UUID',
510 'VERSION',
513 case 'DATE':
514 return array(
515 'CURRENT_DATE',
516 'CURRENT_TIME',
517 'DATE',
518 'FROM_DAYS',
519 'FROM_UNIXTIME',
520 'LAST_DAY',
521 'NOW',
522 'SEC_TO_TIME',
523 'SYSDATE',
524 'TIME',
525 'TIMESTAMP',
526 'UTC_DATE',
527 'UTC_TIME',
528 'UTC_TIMESTAMP',
529 'YEAR',
532 case 'NUMBER':
533 $ret = array(
534 'ABS',
535 'ACOS',
536 'ASCII',
537 'ASIN',
538 'ATAN',
539 'BIT_LENGTH',
540 'BIT_COUNT',
541 'CEILING',
542 'CHAR_LENGTH',
543 'CONNECTION_ID',
544 'COS',
545 'COT',
546 'CRC32',
547 'DAYOFMONTH',
548 'DAYOFWEEK',
549 'DAYOFYEAR',
550 'DEGREES',
551 'EXP',
552 'FLOOR',
553 'HOUR',
554 'INET_ATON',
555 'LENGTH',
556 'LN',
557 'LOG',
558 'LOG2',
559 'LOG10',
560 'MICROSECOND',
561 'MINUTE',
562 'MONTH',
563 'OCT',
564 'ORD',
565 'PI',
566 'QUARTER',
567 'RADIANS',
568 'RAND',
569 'ROUND',
570 'SECOND',
571 'SIGN',
572 'SIN',
573 'SQRT',
574 'TAN',
575 'TO_DAYS',
576 'TO_SECONDS',
577 'TIME_TO_SEC',
578 'UNCOMPRESSED_LENGTH',
579 'UNIX_TIMESTAMP',
580 'UUID_SHORT',
581 'WEEK',
582 'WEEKDAY',
583 'WEEKOFYEAR',
584 'YEARWEEK',
586 return $ret;
588 case 'SPATIAL':
589 return array(
590 'GeomFromText',
591 'GeomFromWKB',
593 'GeomCollFromText',
594 'LineFromText',
595 'MLineFromText',
596 'PointFromText',
597 'MPointFromText',
598 'PolyFromText',
599 'MPolyFromText',
601 'GeomCollFromWKB',
602 'LineFromWKB',
603 'MLineFromWKB',
604 'PointFromWKB',
605 'MPointFromWKB',
606 'PolyFromWKB',
607 'MPolyFromWKB',
610 return array();
614 * Returns array of all attributes available.
616 * @return string[]
619 public function getAttributes()
621 return array(
623 'BINARY',
624 'UNSIGNED',
625 'UNSIGNED ZEROFILL',
626 'on update CURRENT_TIMESTAMP',
631 * Returns array of all column types available.
633 * VARCHAR, TINYINT, TEXT and DATE are listed first, based on
634 * estimated popularity.
636 * @return string[]
639 public function getColumns()
641 $ret = parent::getColumns();
642 // numeric
643 $ret[_pgettext('numeric types', 'Numeric')] = array(
644 'TINYINT',
645 'SMALLINT',
646 'MEDIUMINT',
647 'INT',
648 'BIGINT',
649 '-',
650 'DECIMAL',
651 'FLOAT',
652 'DOUBLE',
653 'REAL',
654 '-',
655 'BIT',
656 'BOOLEAN',
657 'SERIAL',
660 // Date/Time
661 $ret[_pgettext('date and time types', 'Date and time')] = array(
662 'DATE',
663 'DATETIME',
664 'TIMESTAMP',
665 'TIME',
666 'YEAR',
669 // Text
670 $ret[_pgettext('string types', 'String')] = array(
671 'CHAR',
672 'VARCHAR',
673 '-',
674 'TINYTEXT',
675 'TEXT',
676 'MEDIUMTEXT',
677 'LONGTEXT',
678 '-',
679 'BINARY',
680 'VARBINARY',
681 '-',
682 'TINYBLOB',
683 'MEDIUMBLOB',
684 'BLOB',
685 'LONGBLOB',
686 '-',
687 'ENUM',
688 'SET',
691 $ret[_pgettext('spatial types', 'Spatial')] = array(
692 'GEOMETRY',
693 'POINT',
694 'LINESTRING',
695 'POLYGON',
696 'MULTIPOINT',
697 'MULTILINESTRING',
698 'MULTIPOLYGON',
699 'GEOMETRYCOLLECTION',
702 return $ret;
706 * Returns an array of integer types
708 * @return string[] integer types
710 public function getIntegerTypes()
712 return array('tinyint', 'smallint', 'mediumint', 'int', 'bigint');
716 * Returns the min and max values of a given integer type
718 * @param string $type integer type
719 * @param boolean $signed whether signed
721 * @return string[] min and max values
723 public function getIntegerRange($type, $signed = true)
725 static $min_max_data = array(
726 'unsigned' => array(
727 'tinyint' => array('0', '255'),
728 'smallint' => array('0', '65535'),
729 'mediumint' => array('0', '16777215'),
730 'int' => array('0', '4294967295'),
731 'bigint' => array('0', '18446744073709551615')
733 'signed' => array(
734 'tinyint' => array('-128', '127'),
735 'smallint' => array('-32768', '32767'),
736 'mediumint' => array('-8388608', '8388607'),
737 'int' => array('-2147483648', '2147483647'),
738 'bigint' => array('-9223372036854775808', '9223372036854775807')
741 $relevantArray = $signed
742 ? $min_max_data['signed']
743 : $min_max_data['unsigned'];
744 return isset($relevantArray[$type]) ? $relevantArray[$type] : array('', '');
749 * Class holding type definitions for Drizzle.
751 * @package PhpMyAdmin
753 class PMA_Types_Drizzle extends PMA_Types
756 * Returns the data type description.
758 * @param string $type The data type to get a description.
760 * @return string
763 public function getTypeDescription($type)
765 $type = /*overload*/mb_strtoupper($type);
766 switch ($type) {
767 case 'INTEGER':
768 return __('A 4-byte integer, range is -2,147,483,648 to 2,147,483,647');
769 case 'BIGINT':
770 return __('An 8-byte integer, range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807');
771 case 'DECIMAL':
772 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)');
773 case 'DOUBLE':
774 return __("A system's default double-precision floating-point number");
775 case 'BOOLEAN':
776 return __('True or false');
777 case 'SERIAL':
778 return __('An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE');
779 case 'UUID':
780 return __('Stores a Universally Unique Identifier (UUID)');
781 case 'DATE':
782 return sprintf(__('A date, supported range is %1$s to %2$s'), '0001-01-01', '9999-12-31');
783 case 'DATETIME':
784 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');
785 case 'TIMESTAMP':
786 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");
787 case 'TIME':
788 return sprintf(__('A time, range is %1$s to %2$s'), '00:00:00', '23:59:59');
789 case 'VARCHAR':
790 return sprintf(__('A variable-length (%s) string, the effective maximum length is subject to the maximum row size'), '0-16,383');
791 case 'TEXT':
792 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');
793 case 'VARBINARY':
794 return __('A variable-length (0-65,535) string, uses binary collation for all comparisons');
795 case 'BLOB':
796 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');
797 case 'ENUM':
798 return __("An enumeration, chosen from the list of defined values");
800 return '';
804 * Returns class of a type, used for functions available for type
805 * or default values.
807 * @param string $type The data type to get a class.
809 * @return string
812 public function getTypeClass($type)
814 $type = /*overload*/mb_strtoupper($type);
815 switch ($type) {
816 case 'INTEGER':
817 case 'BIGINT':
818 case 'DECIMAL':
819 case 'DOUBLE':
820 case 'BOOLEAN':
821 case 'SERIAL':
822 return 'NUMBER';
824 case 'DATE':
825 case 'DATETIME':
826 case 'TIMESTAMP':
827 case 'TIME':
828 return 'DATE';
830 case 'VARCHAR':
831 case 'TEXT':
832 case 'VARBINARY':
833 case 'BLOB':
834 case 'ENUM':
835 return 'CHAR';
837 case 'UUID':
838 return 'UUID';
840 return '';
844 * Returns array of functions available for a class.
846 * @param string $class The class to get function list.
848 * @return string[]
851 public function getFunctionsClass($class)
853 switch ($class) {
854 case 'CHAR':
855 $ret = array(
856 'BIN',
857 'CHAR',
858 'COMPRESS',
859 'CURRENT_USER',
860 'DATABASE',
861 'DAYNAME',
862 'HEX',
863 'LOAD_FILE',
864 'LOWER',
865 'LTRIM',
866 'MD5',
867 'MONTHNAME',
868 'QUOTE',
869 'REVERSE',
870 'RTRIM',
871 'SCHEMA',
872 'SPACE',
873 'TRIM',
874 'UNCOMPRESS',
875 'UNHEX',
876 'UPPER',
877 'USER',
878 'UUID',
879 'VERSION',
882 // check for some functions known to be in modules
883 $functions = array(
884 'MYSQL_PASSWORD',
885 'ROT13',
888 // add new functions
889 $sql = "SELECT upper(plugin_name) f
890 FROM data_dictionary.plugins
891 WHERE plugin_name IN ('" . implode("','", $functions) . "')
892 AND plugin_type = 'Function'
893 AND is_active";
894 $drizzle_functions = $GLOBALS['dbi']->fetchResult($sql, 'f', 'f');
895 if (count($drizzle_functions) > 0) {
896 $ret = array_merge($ret, $drizzle_functions);
897 sort($ret);
900 return $ret;
902 case 'UUID':
903 return array(
904 'UUID',
907 case 'DATE':
908 return array(
909 'CURRENT_DATE',
910 'CURRENT_TIME',
911 'DATE',
912 'FROM_DAYS',
913 'FROM_UNIXTIME',
914 'LAST_DAY',
915 'NOW',
916 'SYSDATE',
917 //'TIME', // https://bugs.launchpad.net/drizzle/+bug/804571
918 'TIMESTAMP',
919 'UTC_DATE',
920 'UTC_TIME',
921 'UTC_TIMESTAMP',
922 'YEAR',
925 case 'NUMBER':
926 return array(
927 'ABS',
928 'ACOS',
929 'ASCII',
930 'ASIN',
931 'ATAN',
932 'BIT_COUNT',
933 'CEILING',
934 'CHAR_LENGTH',
935 'CONNECTION_ID',
936 'COS',
937 'COT',
938 'CRC32',
939 'DAYOFMONTH',
940 'DAYOFWEEK',
941 'DAYOFYEAR',
942 'DEGREES',
943 'EXP',
944 'FLOOR',
945 'HOUR',
946 'LENGTH',
947 'LN',
948 'LOG',
949 'LOG2',
950 'LOG10',
951 'MICROSECOND',
952 'MINUTE',
953 'MONTH',
954 'OCT',
955 'ORD',
956 'PI',
957 'QUARTER',
958 'RADIANS',
959 'RAND',
960 'ROUND',
961 'SECOND',
962 'SIGN',
963 'SIN',
964 'SQRT',
965 'TAN',
966 'TO_DAYS',
967 'TIME_TO_SEC',
968 'UNCOMPRESSED_LENGTH',
969 'UNIX_TIMESTAMP',
970 //'WEEK', // same as TIME
971 'WEEKDAY',
972 'WEEKOFYEAR',
973 'YEARWEEK',
976 return array();
980 * Returns array of all attributes available.
982 * @return string[]
985 public function getAttributes()
987 return array(
989 'on update CURRENT_TIMESTAMP',
994 * Returns array of all column types available.
996 * @return string[]
999 public function getColumns()
1001 $types_num = array(
1002 'INTEGER',
1003 'BIGINT',
1004 '-',
1005 'DECIMAL',
1006 'DOUBLE',
1007 '-',
1008 'BOOLEAN',
1009 'SERIAL',
1010 'UUID',
1012 $types_date = array(
1013 'DATE',
1014 'DATETIME',
1015 'TIMESTAMP',
1016 'TIME',
1018 $types_string = array(
1019 'VARCHAR',
1020 'TEXT',
1021 '-',
1022 'VARBINARY',
1023 'BLOB',
1024 '-',
1025 'ENUM',
1027 if (PMA_MYSQL_INT_VERSION >= 20120130) {
1028 $types_string[] = '-';
1029 $types_string[] = 'IPV6';
1032 $ret = parent::getColumns();
1033 // numeric
1034 $ret[_pgettext('numeric types', 'Numeric')] = $types_num;
1036 // Date/Time
1037 $ret[_pgettext('date and time types', 'Date and time')] = $types_date;
1039 // Text
1040 $ret[_pgettext('string types', 'String')] = $types_string;
1042 return $ret;
1046 * Returns an array of integer types
1048 * @return string[] integer types
1050 public function getIntegerTypes()
1052 return array('integer', 'bigint');
1056 * Returns the min and max values of a given integer type
1058 * @param string $type integer type
1059 * @param boolean $signed whether signed (ignored for Drizzle)
1061 * @return string[] min and max values
1063 public function getIntegerRange($type, $signed = true)
1065 static $min_max_data = array(
1066 'integer' => array('-2147483648', '2147483647'),
1067 'bigint' => array('-9223372036854775808', '9223372036854775807')
1069 return isset($min_max_data[$type]) ? $min_max_data[$type] : array('', '');