]> git.nbdom.net Git - nb.git/commitdiff
lib/php/db/types/pgsql.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 4 Dec 2017 21:33:19 +0000 (21:33 +0000)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Mon, 4 Dec 2017 21:33:19 +0000 (21:33 +0000)
lib/php/db/types/pgsql.php

index 703df8d9003856c3da565e6fd77d7db88c9b544c..f267337c526292bfd24c503e33a03c5dbfbbd197 100644 (file)
@@ -3,7 +3,7 @@ $DB_TYPES['pgsql'] = array (
 'extra_where' => 'denorm',
 'regexp' => '~',
 # NB 04.12.17: Overwrite db->quote because of bugs with INSERT INTO 
-# NB 04.12.17 'quote_name' => "'",
+# NB 04.12.17 'quote_name' => '"',
 # NB 04.12.17 'quote' => function($str) {
 # NB 04.12.17   global $DB_TYPES;
 # NB 04.12.17   $chr = $DB_TYPES['pgsql']['quote_name'];
@@ -18,38 +18,11 @@ $DB_TYPES['pgsql'] = array (
 
 'localFile' => array (getenv('HOME').'/.pgpass','^[^:]+:[^:]+:<D.NAME>:(?P<user>[^:]+):(?<password>[^:]+)'),
 
-/*
-'databases' => "SELECT d.datname as 'Name',
-       pg_catalog.pg_get_userbyid(d.datdba) as 'Owner',
-       pg_catalog.pg_encoding_d.encoding) as 'Encoding',
-       d.datcollate as 'Collate',
-       d.datctype as 'Ctype',
-       pg_catalog.array_to_string(d.datacl, E'\n') AS 'Access privileges',
-       CASE WHEN pg_catalog.has_database_privilege(d.datname, 'CONNECT')
-            THEN pg_catalog.pg_size_pretty(pg_catalog.pg_database_size(d.datname))
-            ELSE 'No Access'
-       END as 'Size',
-       t.spcname as 'Tablespace',
-       pg_catalog.shobj_description(d.oid, 'pg_database') as 'Description'
-FROM pg_catalog.pg_database d
-  JOIN pg_catalog.pg_tablespace t on d.dattablespace = t.oid
-ORDER BY 1",
-*/
 'databases' => 'SELECT datname as name,pg_catalog.pg_get_userbyid(datdba) as owner,pg_catalog.pg_encoding_encoding) as encoding, datcollate as "collate",datctype as "Ctype" FROM pg_catalog.pg_database',
 
 'sql.drop' => 'DROP <T.TYPE> IF EXISTS "<T.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')",
 '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 = 'public'",
 
-# 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 },
-
 'table.sql.create' => function($sql) {
   $sql = preg_replace('/ESCAPE \'.*?\'/','',$sql);
   $r = array(
@@ -62,7 +35,6 @@ ORDER BY 1",
   return $sql;
 },
 
-  #,(SELECT attname FROM pg_catalog.pg_attribute a WHERE a.attrelid = i.indrelid AND a.attnum = ANY(i.indkey)) as field
 'table.sql.index' => [
   "SELECT
   c.relname as name