@@ 102-121 (lines=20) @@ | ||
99 | * |
|
100 | * @return All schemas, sorted alphabetically |
|
101 | */ |
|
102 | public function getSchemas() |
|
103 | { |
|
104 | $conf = $this->conf; |
|
105 | ||
106 | if (!$conf['show_system']) { |
|
107 | $where = "WHERE nspname NOT LIKE 'pg@_%' ESCAPE '@' AND nspname != 'information_schema'"; |
|
108 | } else { |
|
109 | $where = "WHERE nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; |
|
110 | } |
|
111 | ||
112 | $sql = " |
|
113 | SELECT pn.nspname, pu.usename AS nspowner, |
|
114 | pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment |
|
115 | FROM pg_catalog.pg_namespace pn |
|
116 | LEFT JOIN pg_catalog.pg_user pu ON (pn.nspowner = pu.usesysid) |
|
117 | {$where} |
|
118 | ORDER BY nspname"; |
|
119 | ||
120 | return $this->selectSet($sql); |
|
121 | } |
|
122 | ||
123 | /** |
|
124 | * Return all information relating to a schema |
@@ 1009-1028 (lines=20) @@ | ||
1006 | * |
|
1007 | * @return All schemas, sorted alphabetically |
|
1008 | */ |
|
1009 | public function getSchemas() |
|
1010 | { |
|
1011 | $conf = $this->conf; |
|
1012 | ||
1013 | if (!$conf['show_system']) { |
|
1014 | $where = "WHERE nspname NOT LIKE 'pg@_%' ESCAPE '@' AND nspname != 'information_schema'"; |
|
1015 | } else { |
|
1016 | $where = "WHERE nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; |
|
1017 | } |
|
1018 | ||
1019 | $sql = " |
|
1020 | SELECT pn.nspname, pu.rolname AS nspowner, |
|
1021 | pg_catalog.obj_description(pn.oid, 'pg_namespace') AS nspcomment |
|
1022 | FROM pg_catalog.pg_namespace pn |
|
1023 | LEFT JOIN pg_catalog.pg_roles pu ON (pn.nspowner = pu.oid) |
|
1024 | {$where} |
|
1025 | ORDER BY nspname"; |
|
1026 | ||
1027 | return $this->selectSet($sql); |
|
1028 | } |
|
1029 | ||
1030 | /** |
|
1031 | * Sets the current working schema. Will also set Class variable. |
|
@@ 5964-6002 (lines=39) @@ | ||
5961 | * |
|
5962 | * @return All casts |
|
5963 | */ |
|
5964 | public function getCasts() |
|
5965 | { |
|
5966 | $conf = $this->conf; |
|
5967 | ||
5968 | if ($conf['show_system']) { |
|
5969 | $where = ''; |
|
5970 | } else { |
|
5971 | $where = ' |
|
5972 | AND n1.nspname NOT LIKE $$pg\_%$$ |
|
5973 | AND n2.nspname NOT LIKE $$pg\_%$$ |
|
5974 | AND n3.nspname NOT LIKE $$pg\_%$$ |
|
5975 | '; |
|
5976 | } |
|
5977 | ||
5978 | $sql = " |
|
5979 | SELECT |
|
5980 | c.castsource::pg_catalog.regtype AS castsource, |
|
5981 | c.casttarget::pg_catalog.regtype AS casttarget, |
|
5982 | CASE WHEN c.castfunc=0 THEN NULL |
|
5983 | ELSE c.castfunc::pg_catalog.regprocedure END AS castfunc, |
|
5984 | c.castcontext, |
|
5985 | obj_description(c.oid, 'pg_cast') as castcomment |
|
5986 | FROM |
|
5987 | (pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p ON c.castfunc=p.oid JOIN pg_catalog.pg_namespace n3 ON p.pronamespace=n3.oid), |
|
5988 | pg_catalog.pg_type t1, |
|
5989 | pg_catalog.pg_type t2, |
|
5990 | pg_catalog.pg_namespace n1, |
|
5991 | pg_catalog.pg_namespace n2 |
|
5992 | WHERE |
|
5993 | c.castsource=t1.oid |
|
5994 | AND c.casttarget=t2.oid |
|
5995 | AND t1.typnamespace=n1.oid |
|
5996 | AND t2.typnamespace=n2.oid |
|
5997 | {$where} |
|
5998 | ORDER BY 1, 2 |
|
5999 | "; |
|
6000 | ||
6001 | return $this->selectSet($sql); |
|
6002 | } |
|
6003 | ||
6004 | /** |
|
6005 | * Returns a list of all conversions in the database |
|
@@ 7168-7189 (lines=22) @@ | ||
7165 | * @param bool|True $all True to get all languages, regardless of show_system |
|
7166 | * @return \PHPPgAdmin\Database\A recordset |
|
7167 | */ |
|
7168 | public function getLanguages($all = false) |
|
7169 | { |
|
7170 | $conf = $this->conf; |
|
7171 | ||
7172 | if ($conf['show_system'] || $all) { |
|
7173 | $where = ''; |
|
7174 | } else { |
|
7175 | $where = 'WHERE lanispl'; |
|
7176 | } |
|
7177 | ||
7178 | $sql = " |
|
7179 | SELECT |
|
7180 | lanname, lanpltrusted, |
|
7181 | lanplcallfoid::pg_catalog.regproc AS lanplcallf |
|
7182 | FROM |
|
7183 | pg_catalog.pg_language |
|
7184 | {$where} |
|
7185 | ORDER BY lanname |
|
7186 | "; |
|
7187 | ||
7188 | return $this->selectSet($sql); |
|
7189 | } |
|
7190 | ||
7191 | /** |
|
7192 | * Creates a new aggregate in the database |
|
@@ 8695-8720 (lines=26) @@ | ||
8692 | * @return A recordset |
|
8693 | */ |
|
8694 | ||
8695 | public function getLocks() |
|
8696 | { |
|
8697 | $conf = $this->conf; |
|
8698 | ||
8699 | if (!$conf['show_system']) { |
|
8700 | $where = 'AND pn.nspname NOT LIKE $$pg\_%$$'; |
|
8701 | } else { |
|
8702 | $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; |
|
8703 | } |
|
8704 | ||
8705 | $sql = " |
|
8706 | SELECT |
|
8707 | pn.nspname, pc.relname AS tablename, pl.pid, pl.mode, pl.granted, pl.virtualtransaction, |
|
8708 | (select transactionid from pg_catalog.pg_locks l2 where l2.locktype='transactionid' |
|
8709 | and l2.mode='ExclusiveLock' and l2.virtualtransaction=pl.virtualtransaction) as transaction |
|
8710 | FROM |
|
8711 | pg_catalog.pg_locks pl, |
|
8712 | pg_catalog.pg_class pc, |
|
8713 | pg_catalog.pg_namespace pn |
|
8714 | WHERE |
|
8715 | pl.relation = pc.oid AND pc.relnamespace=pn.oid |
|
8716 | {$where} |
|
8717 | ORDER BY pid,nspname,tablename"; |
|
8718 | ||
8719 | return $this->selectSet($sql); |
|
8720 | } |
|
8721 | ||
8722 | /** |
|
8723 | * Sends a cancel or kill command to a process |
@@ 250-266 (lines=17) @@ | ||
247 | * |
|
248 | * @return A recordset |
|
249 | */ |
|
250 | public function getLocks() |
|
251 | { |
|
252 | $conf = $this->conf; |
|
253 | ||
254 | if (!$conf['show_system']) { |
|
255 | $where = "AND pn.nspname NOT LIKE 'pg\\\\_%'"; |
|
256 | } else { |
|
257 | $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; |
|
258 | } |
|
259 | ||
260 | $sql = "SELECT pn.nspname, pc.relname AS tablename, pl.transaction, pl.pid, pl.mode, pl.granted |
|
261 | FROM pg_catalog.pg_locks pl, pg_catalog.pg_class pc, pg_catalog.pg_namespace pn |
|
262 | WHERE pl.relation = pc.oid AND pc.relnamespace=pn.oid {$where} |
|
263 | ORDER BY nspname,tablename"; |
|
264 | ||
265 | return $this->selectSet($sql); |
|
266 | } |
|
267 | ||
268 | /** |
|
269 | * Returns the current database encoding |
|
@@ 576-614 (lines=39) @@ | ||
573 | * |
|
574 | * @return All casts |
|
575 | */ |
|
576 | public function getCasts() |
|
577 | { |
|
578 | $conf = $this->conf; |
|
579 | ||
580 | if ($conf['show_system']) { |
|
581 | $where = ''; |
|
582 | } else { |
|
583 | $where = " |
|
584 | AND n1.nspname NOT LIKE 'pg\\\\_%' |
|
585 | AND n2.nspname NOT LIKE 'pg\\\\_%' |
|
586 | AND n3.nspname NOT LIKE 'pg\\\\_%' |
|
587 | "; |
|
588 | } |
|
589 | ||
590 | $sql = " |
|
591 | SELECT |
|
592 | c.castsource::pg_catalog.regtype AS castsource, |
|
593 | c.casttarget::pg_catalog.regtype AS casttarget, |
|
594 | CASE WHEN c.castfunc=0 THEN NULL |
|
595 | ELSE c.castfunc::pg_catalog.regprocedure END AS castfunc, |
|
596 | c.castcontext, |
|
597 | obj_description(c.oid, 'pg_cast') as castcomment |
|
598 | FROM |
|
599 | (pg_catalog.pg_cast c LEFT JOIN pg_catalog.pg_proc p ON c.castfunc=p.oid JOIN pg_catalog.pg_namespace n3 ON p.pronamespace=n3.oid), |
|
600 | pg_catalog.pg_type t1, |
|
601 | pg_catalog.pg_type t2, |
|
602 | pg_catalog.pg_namespace n1, |
|
603 | pg_catalog.pg_namespace n2 |
|
604 | WHERE |
|
605 | c.castsource=t1.oid |
|
606 | AND c.casttarget=t2.oid |
|
607 | AND t1.typnamespace=n1.oid |
|
608 | AND t2.typnamespace=n2.oid |
|
609 | {$where} |
|
610 | ORDER BY 1, 2 |
|
611 | "; |
|
612 | ||
613 | return $this->selectSet($sql); |
|
614 | } |
|
615 | ||
616 | public function hasAlterColumnType() |
|
617 | { |
@@ 50-66 (lines=17) @@ | ||
47 | * |
|
48 | * @return A recordset |
|
49 | */ |
|
50 | public function getLocks() |
|
51 | { |
|
52 | $conf = $this->conf; |
|
53 | ||
54 | if (!$conf['show_system']) { |
|
55 | $where = 'AND pn.nspname NOT LIKE $$pg\_%$$'; |
|
56 | } else { |
|
57 | $where = "AND nspname !~ '^pg_t(emp_[0-9]+|oast)$'"; |
|
58 | } |
|
59 | ||
60 | $sql = "SELECT pn.nspname, pc.relname AS tablename, pl.transaction, pl.pid, pl.mode, pl.granted |
|
61 | FROM pg_catalog.pg_locks pl, pg_catalog.pg_class pc, pg_catalog.pg_namespace pn |
|
62 | WHERE pl.relation = pc.oid AND pc.relnamespace=pn.oid {$where} |
|
63 | ORDER BY nspname,tablename"; |
|
64 | ||
65 | return $this->selectSet($sql); |
|
66 | } |
|
67 | ||
68 | // Sequence functions |
|
69 |