2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Column types and functions supported by Drizzle
8 if (! defined('PHPMYADMIN')) {
12 $auto_column_types = empty($cfg['ColumnTypes']);
14 // VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity
15 $cfg['ColumnTypes'] = !empty($cfg['ColumnTypes']) ?
$cfg['ColumnTypes'] : array(
37 'DATE and TIME' => array(
56 if ($auto_column_types && PMA_MYSQL_INT_VERSION
>= 20120130) {
57 $cfg['ColumnTypes']['STRING'][] = '-';
58 $cfg['ColumnTypes']['STRING'][] = 'IPV6';
60 unset($auto_column_types);
62 $cfg['AttributeTypes'] = !empty($cfg['AttributeTypes']) ?
$cfg['AttributeTypes'] : array(
64 'on update CURRENT_TIMESTAMP',
67 if ($cfg['ShowFunctionFields']) {
68 $cfg['RestrictColumnTypes'] = !empty($cfg['RestrictColumnTypes']) ?
$cfg['RestrictColumnTypes'] : array(
69 'INTEGER' => 'FUNC_NUMBER',
70 'BIGINT' => 'FUNC_NUMBER',
71 'DECIMAL' => 'FUNC_NUMBER',
72 'DOUBLE' => 'FUNC_NUMBER',
73 'BOOLEAN' => 'FUNC_NUMBER',
74 'SERIAL' => 'FUNC_NUMBER',
76 'DATE' => 'FUNC_DATE',
77 'DATETIME' => 'FUNC_DATE',
78 'TIMESTAMP' => 'FUNC_DATE',
79 'TIME' => 'FUNC_DATE',
81 'VARCHAR' => 'FUNC_CHAR',
82 'TEXT' => 'FUNC_CHAR',
83 'VARBINARY' => 'FUNC_CHAR',
84 'BLOB' => 'FUNC_CHAR',
85 'UUID' => 'FUNC_UUID',
89 $restrict_functions = array(
117 'FUNC_UUID' => array(
121 'FUNC_DATE' => array(
130 //'TIME', // https://bugs.launchpad.net/drizzle/+bug/804571
138 'FUNC_NUMBER' => array(
180 'UNCOMPRESSED_LENGTH',
182 //'WEEK', // same as TIME
188 $cfg_default_restrict_funcs = empty($cfg['RestrictFunctions']);
189 if ($cfg_default_restrict_funcs) {
190 $cfg['RestrictFunctions'] = $restrict_functions;
193 if (empty($cfg['Functions'])) {
194 // build a list of functions based on $restrict_functions
195 $cfg['Functions'] = array();
196 foreach ($restrict_functions as $cat => $functions) {
197 $cfg['Functions'] = array_merge($cfg['Functions'], $functions);
200 // check for some functions known to be in modules
202 'MYSQL_PASSWORD' => 'FUNC_CHAR',
203 'ROT13' => 'FUNC_CHAR',
206 $sql = "SELECT upper(plugin_name) f
207 FROM data_dictionary.plugins
208 WHERE plugin_name IN ('" . implode("','", array_keys($functions)) . "')
209 AND plugin_type = 'Function'
211 $drizzle_functions = PMA_DBI_fetch_result($sql, 'f', 'f');
212 $cfg['Functions'] = array_merge($cfg['Functions'], $drizzle_functions);
213 if ($cfg_default_restrict_funcs) {
214 foreach ($drizzle_functions as $function) {
215 $category = $functions[$function];
216 $cfg['RestrictFunctions'][$category][] = $function;
218 foreach ($cfg['RestrictFunctions'] as &$v) {
224 sort($cfg['Functions']);
226 unset($restrict_functions);
230 * This function returns datatypes descriptions.
232 * @return array Drizzle datatypes descriptions.
235 function PMA_supportedDataTypesDescriptions()
237 // if possible, for easy translation these strings should be the same as for MySQL
239 'INTEGER' => __('A 4-byte integer, range is -2,147,483,648 to 2,147,483,647'),
240 'BIGINT' => __('An 8-byte integer, range is -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807'),
241 '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)'),
242 'DOUBLE' => __("A system's default double-precision floating-point number"),
243 'BOOLEAN' => __('True or false'),
244 // Drizzle doesn't have UNSIGNED types
245 'SERIAL' => __('An alias for BIGINT NOT NULL AUTO_INCREMENT UNIQUE'),
246 'UUID' => __('Stores a Universally Unique Identifier (UUID)'),
247 'DATE' => sprintf(__("A date, supported range is '%s' to '%s'"), '0001-01-01', '9999-12-31'),
248 'DATETIME' => sprintf(__("A date and time combination, supported range is '%s' to '%s'"), '0001-01-01 00:00:0', '9999-12-31 23:59:59'),
249 'TIMESTAMP' => __("A timestamp, range is '0001-01-01 00:00:00' UTC to '9999-12-31 23:59:59' UTC; TIMESTAMP(6) can store microseconds"),
250 'TIME' => sprintf(__("A time, range is '%s' to '%s'"), '00:00:00', '23:59:59'),
251 'VARCHAR' => sprintf(__('A variable-length (%s) string, the effective maximum length is subject to the maximum row size'), '0-16,383'),
252 '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'),
253 'VARBINARY' => __('A variable-length (0-65,535) string, uses binary collation for all comparisons'),
254 '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'),
255 // there is no limit on ENUM length
256 'ENUM' => __("An enumeration, chosen from the list of defined values"),
258 } // end PMA_supportedDataTypesDescriptions()