$CONF['ui'] = array(
'_import' => array('_ui'),
);
+$CONF['ui-pgsql'] = array(
+ 'host' => 'ui.semantico.net',
+ 'type' => 'pgsql',
+ 'name' => 'ui',
+ 'pdo' => '',
+ '_import' => array('_ui','_semadm'),
+);
$CONF['ui-mysql'] = array(
'host' => 'ui.semantico.net',
'type' => 'mysql',
$sql = rtrim($t->create(),';');
$sql = str_replace(';CREATE',";\nCREATE",$sql);
- $t->sql_create = 'DROP '.strtoupper($t->type).' IF EXISTS '.$t->sql_name().';'.NB_EOL
+
+ if ($drop = $this->type('sql.drop')) {
+ $drop = str_replace('<NAME>',$t->name,$drop);
+ $drop = str_replace('<TYPE>',strtoupper($t->type),$drop);
+ } else {
+ $drop = 'DROP '.strtoupper($t->type).' IF EXISTS '.$t->sql_name();
+ }
+ $t->sql_create = $drop.';'.NB_EOL
.$sql.';'.NB_EOL
;
*/
'databases' => 'SELECT datname as name,pg_catalog.pg_get_userbyid(datdba) as owner,pg_catalog.pg_encoding_to_char(encoding) as encoding, datcollate as "collate",datctype as "Ctype" FROM pg_catalog.pg_database',
+'sql.drop' => 'DROP <TYPE> IF EXISTS "<NAME>" CASCADE',
'tables' => "SELECT table_name as name,LOWER(CASE table_type WHEN 'BASE TABLE' THEN 'TABLE' ELSE table_type END) as type,table_type FROM information_schema.tables WHERE table_type in('BASE TABLE','VIEW') AND table_schema NOT IN ('pg_catalog', 'information_schema')",
-'create' => function(&$field) {
+# NB 02.08.16 'create' => function(&$field) {
+# NB 02.08.16 $r = array(
+# NB 02.08.16 '/datetime/i' => 'timestamp',
+# NB 02.08.16 '/float/i' => 'numeric',
+# NB 02.08.16 '/ COLLATE NOCASE/i' => '',
+# NB 02.08.16 );
+# NB 02.08.16 $field->type = preg_replace(array_keys($r),array_values($r),$field->type);
+# NB 02.08.16 },
+
+'sql.replace' => function($sql) {
+ $sql = preg_replace('/ESCAPE \'.*?\'/','',$sql);
$r = array(
'/datetime/i' => 'timestamp',
+ '/float\(/i' => 'numeric(',
+ '/\w*int\(/i' => 'numeric(',
'/ COLLATE NOCASE/i' => '',
);
- $field->type = preg_replace(array_keys($r),array_values($r),$field->type);
-},
-
-'sql.replace' => function($sql) {
- $sql = preg_replace('/ESCAPE \'.*?\'/','',$sql);
+ $sql= preg_replace(array_keys($r),array_values($r),$sql);
return $sql;
},