diff options
| author | Damien Regad <dregad@mantisbt.org> | 2014-04-30 13:23:48 +0200 |
|---|---|---|
| committer | Damien Regad <dregad@mantisbt.org> | 2014-04-30 14:33:10 +0200 |
| commit | c460e06ff58d858b056c7b4da28a5363139a6e6a (patch) | |
| tree | 6e3c8555a49baa19f6d682cef64a0045aa4e1a1e /drivers/adodb-postgres7.inc.php | |
| parent | d5e52099d61186ff0c9d0d94a0fa3b78ca19c7c2 (diff) | |
| download | adodb-c460e06ff58d858b056c7b4da28a5363139a6e6a.tar.gz adodb-c460e06ff58d858b056c7b4da28a5363139a6e6a.tar.bz2 adodb-c460e06ff58d858b056c7b4da28a5363139a6e6a.zip | |
Whitespace
Diffstat (limited to 'drivers/adodb-postgres7.inc.php')
| -rw-r--r-- | drivers/adodb-postgres7.inc.php | 80 |
1 files changed, 40 insertions, 40 deletions
diff --git a/drivers/adodb-postgres7.inc.php b/drivers/adodb-postgres7.inc.php index 8530dc87..71dddf50 100644 --- a/drivers/adodb-postgres7.inc.php +++ b/drivers/adodb-postgres7.inc.php @@ -113,49 +113,49 @@ class ADODB_postgres7 extends ADODB_postgres64 { I discovered that the MetaForeignKeys method no longer worked for Postgres 8.3. I went ahead and modified it to work for both 8.2 and 8.3. Please feel free to include this change in your next release of adodb. - William Kolodny [William.Kolodny#gt-t.net] + William Kolodny [William.Kolodny#gt-t.net] */ function MetaForeignKeys($table, $owner=false, $upper=false) { - $sql=" - SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field, - fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field - FROM ( - SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf, - split_part(fee.consrc, '('::text, 3) AS rf - FROM ( - SELECT foo.relname AS ltable, foo.ftblname, - pg_get_constraintdef(foo.oid) AS consrc - FROM ( - SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname - FROM pg_constraint c - JOIN pg_class t ON (t.oid = c.conrelid) - JOIN pg_class ft ON (ft.oid = c.confrelid) - JOIN pg_namespace nft ON (nft.oid = ft.relnamespace) - LEFT JOIN pg_description ds ON (ds.objoid = c.oid) - JOIN pg_namespace n ON (n.oid = t.relnamespace) - WHERE c.contype = 'f'::\"char\" - ORDER BY t.relname, n.nspname, c.conname, c.oid - ) foo - ) fee) fum - WHERE fum.ltable='".strtolower($table)."' - ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1) - "; - $rs = $this->Execute($sql); + $sql=" + SELECT fum.ftblname AS lookup_table, split_part(fum.rf, ')'::text, 1) AS lookup_field, + fum.ltable AS dep_table, split_part(fum.lf, ')'::text, 1) AS dep_field + FROM ( + SELECT fee.ltable, fee.ftblname, fee.consrc, split_part(fee.consrc,'('::text, 2) AS lf, + split_part(fee.consrc, '('::text, 3) AS rf + FROM ( + SELECT foo.relname AS ltable, foo.ftblname, + pg_get_constraintdef(foo.oid) AS consrc + FROM ( + SELECT c.oid, c.conname AS name, t.relname, ft.relname AS ftblname + FROM pg_constraint c + JOIN pg_class t ON (t.oid = c.conrelid) + JOIN pg_class ft ON (ft.oid = c.confrelid) + JOIN pg_namespace nft ON (nft.oid = ft.relnamespace) + LEFT JOIN pg_description ds ON (ds.objoid = c.oid) + JOIN pg_namespace n ON (n.oid = t.relnamespace) + WHERE c.contype = 'f'::\"char\" + ORDER BY t.relname, n.nspname, c.conname, c.oid + ) foo + ) fee) fum + WHERE fum.ltable='".strtolower($table)."' + ORDER BY fum.ftblname, fum.ltable, split_part(fum.lf, ')'::text, 1) + "; + $rs = $this->Execute($sql); - if (!$rs || $rs->EOF) return false; + if (!$rs || $rs->EOF) return false; - $a = array(); - while (!$rs->EOF) { - if ($upper) { - $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field'))); - } else { - $a[$rs->Fields('lookup_table')][] = str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field')); - } - $rs->MoveNext(); - } + $a = array(); + while (!$rs->EOF) { + if ($upper) { + $a[strtoupper($rs->Fields('lookup_table'))][] = strtoupper(str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field'))); + } else { + $a[$rs->Fields('lookup_table')][] = str_replace('"','',$rs->Fields('dep_field').'='.$rs->Fields('lookup_field')); + } + $rs->MoveNext(); + } - return $a; + return $a; } @@ -229,7 +229,7 @@ class ADODB_postgres7 extends ADODB_postgres64 { return $rez; } - // this is a set of functions for managing client encoding - very important if the encodings + // this is a set of functions for managing client encoding - very important if the encodings // of your database and your output target (i.e. HTML) don't match //for instance, you may have UNICODE database and server it on-site as WIN1251 etc. // GetCharSet - get the name of the character set the client is using now @@ -262,7 +262,7 @@ class ADODB_postgres7 extends ADODB_postgres64 { } /*-------------------------------------------------------------------------------------- - Class Name: Recordset + Class Name: Recordset --------------------------------------------------------------------------------------*/ class ADORecordSet_postgres7 extends ADORecordSet_postgres64{ @@ -309,7 +309,7 @@ class ADORecordSet_assoc_postgres7 extends ADORecordSet_postgres64{ function _fetch() { if ($this->_currentRow >= $this->_numOfRows && $this->_numOfRows >= 0) - return false; + return false; $this->fields = @pg_fetch_array($this->_queryID,$this->_currentRow,$this->fetchMode); |
