3 * Column types and functions supported by Drizzle
8 $auto_column_types = empty($cfg['ColumnTypes']);
10 // VARCHAR, TINYINT, TEXT and DATE are listed first, based on estimated popularity
11 $cfg['ColumnTypes'] = !empty($cfg['ColumnTypes']) ?
$cfg['ColumnTypes'] : array(
33 'DATE and TIME' => array(
52 if ($auto_column_types && PMA_MYSQL_INT_VERSION
>= 20120130) {
53 $cfg['ColumnTypes']['STRING'][] = '-';
54 $cfg['ColumnTypes']['STRING'][] = 'IPV6';
56 unset($auto_column_types);
58 $cfg['AttributeTypes'] = !empty($cfg['AttributeTypes']) ?
$cfg['AttributeTypes'] : array(
60 'on update CURRENT_TIMESTAMP',
63 if ($cfg['ShowFunctionFields']) {
64 $cfg['RestrictColumnTypes'] = !empty($cfg['RestrictColumnTypes']) ?
$cfg['RestrictColumnTypes'] : array(
65 'INTEGER' => 'FUNC_NUMBER',
66 'BIGINT' => 'FUNC_NUMBER',
67 'DECIMAL' => 'FUNC_NUMBER',
68 'DOUBLE' => 'FUNC_NUMBER',
69 'BOOLEAN' => 'FUNC_NUMBER',
70 'SERIAL' => 'FUNC_NUMBER',
72 'DATE' => 'FUNC_DATE',
73 'DATETIME' => 'FUNC_DATE',
74 'TIMESTAMP' => 'FUNC_DATE',
75 'TIME' => 'FUNC_DATE',
77 'VARCHAR' => 'FUNC_CHAR',
78 'TEXT' => 'FUNC_CHAR',
79 'VARBINARY' => 'FUNC_CHAR',
80 'BLOB' => 'FUNC_CHAR',
81 'UUID' => 'FUNC_UUID',
85 $restrict_functions = array(
113 'FUNC_UUID' => array(
117 'FUNC_DATE' => array(
126 //'TIME', // https://bugs.launchpad.net/drizzle/+bug/804571
134 'FUNC_NUMBER' => array(
176 'UNCOMPRESSED_LENGTH',
178 //'WEEK', // same as TIME
184 $cfg_default_restrict_funcs = empty($cfg['RestrictFunctions']);
185 if ($cfg_default_restrict_funcs) {
186 $cfg['RestrictFunctions'] = $restrict_functions;
189 if (empty($cfg['Functions'])) {
190 // build a list of functions based on $restrict_functions
191 $cfg['Functions'] = array();
192 foreach ($restrict_functions as $cat => $functions) {
193 $cfg['Functions'] = array_merge($cfg['Functions'], $functions);
196 // check for some functions known to be in modules
198 'MYSQL_PASSWORD' => 'FUNC_CHAR',
199 'ROT13' => 'FUNC_CHAR',
202 $sql = "SELECT upper(plugin_name) f
203 FROM data_dictionary.plugins
204 WHERE plugin_name IN ('" . implode("','", array_keys($functions)) . "')
205 AND plugin_type = 'Function'
207 $drizzle_functions = PMA_DBI_fetch_result($sql, 'f', 'f');
208 $cfg['Functions'] = array_merge($cfg['Functions'], $drizzle_functions);
209 if ($cfg_default_restrict_funcs) {
210 foreach ($drizzle_functions as $function) {
211 $category = $functions[$function];
212 $cfg['RestrictFunctions'][$category][] = $function;
214 foreach ($cfg['RestrictFunctions'] as &$v) {
220 sort($cfg['Functions']);
222 unset($restrict_functions);