| @@ 243-271 (lines=29) @@ | ||
| 240 | * @return \PommProject\Foundation\ConvertedResultIterator  | 
                                |
| 241 | * @deprecated  | 
                                |
| 242 | */  | 
                                |
| 243 | public function getSchemaRelations($schema_oid, Where $where = null)  | 
                                |
| 244 |     { | 
                                |
| 245 |         $condition = Where::create('relnamespace = $*', [$schema_oid]) | 
                                |
| 246 |             ->andWhere(Where::createWhereIn('relkind', ['r', 'v', 'm', 'f'])) | 
                                |
| 247 | ->andWhere($where)  | 
                                |
| 248 | ;  | 
                                |
| 249 | ||
| 250 | $sql = <<<SQL  | 
                                |
| 251 | select  | 
                                |
| 252 | cl.relname as "name",  | 
                                |
| 253 | case  | 
                                |
| 254 | when cl.relkind = 'r' then 'table'  | 
                                |
| 255 | when cl.relkind = 'v' then 'view'  | 
                                |
| 256 | when cl.relkind = 'm' then 'materialized view'  | 
                                |
| 257 | when cl.relkind = 'f' then 'foreign table'  | 
                                |
| 258 | else 'other'  | 
                                |
| 259 | end as "type",  | 
                                |
| 260 | cl.oid as "oid",  | 
                                |
| 261 | des.description as "comment"  | 
                                |
| 262 | from  | 
                                |
| 263 | pg_catalog.pg_class cl  | 
                                |
| 264 | left join pg_catalog.pg_description des on  | 
                                |
| 265 | cl.oid = des.objoid and des.objsubid = 0  | 
                                |
| 266 | where {condition} | 
                                |
| 267 | order by name asc  | 
                                |
| 268 | SQL;  | 
                                |
| 269 | ||
| 270 | return $this->executeSql($sql, $condition);  | 
                                |
| 271 | }  | 
                                |
| 272 | ||
| 273 | /**  | 
                                |
| 274 | * getTableComment  | 
                                |
| @@ 62-93 (lines=32) @@ | ||
| 59 | * @param Where $where  | 
                                |
| 60 | * @return ConvertedResultIterator  | 
                                |
| 61 | */  | 
                                |
| 62 | public function getRelations(Where $where = null)  | 
                                |
| 63 |     { | 
                                |
| 64 |         $condition = Where::createWhereIn('relkind', ['r', 'v', 'm', 'f']) | 
                                |
| 65 | ->andWhere($where)  | 
                                |
| 66 | ;  | 
                                |
| 67 | ||
| 68 | $sql = <<<SQL  | 
                                |
| 69 | select  | 
                                |
| 70 | cl.relname as "name",  | 
                                |
| 71 | case  | 
                                |
| 72 | when cl.relkind = 'r' then 'table'  | 
                                |
| 73 | when cl.relkind = 'v' then 'view'  | 
                                |
| 74 | when cl.relkind = 'm' then 'materialized view'  | 
                                |
| 75 | when cl.relkind = 'f' then 'foreign table'  | 
                                |
| 76 | else 'other'  | 
                                |
| 77 | end as "type",  | 
                                |
| 78 | n.nspname as "schema",  | 
                                |
| 79 | cl.oid as "oid",  | 
                                |
| 80 | o.rolname as "owner",  | 
                                |
| 81 | des.description as "comment"  | 
                                |
| 82 | from  | 
                                |
| 83 | pg_catalog.pg_class cl  | 
                                |
| 84 | left join pg_catalog.pg_description des on  | 
                                |
| 85 | cl.oid = des.objoid and des.objsubid = 0  | 
                                |
| 86 | join pg_catalog.pg_roles o on cl.relowner = o.oid  | 
                                |
| 87 | join pg_catalog.pg_namespace n on cl.relnamespace = n.oid  | 
                                |
| 88 | where {condition} | 
                                |
| 89 | order by name asc  | 
                                |
| 90 | SQL;  | 
                                |
| 91 | ||
| 92 | return $this->executeSql($sql, $condition);  | 
                                |
| 93 | }  | 
                                |
| 94 | ||
| 95 | /**  | 
                                |
| 96 | * getRelationsInSchema  | 
                                |