Re: [patch] makes oci8.php accessible to primary key constraints

From: Date: Tue, 24 Jan 2006 22:52:15 +0000
Subject: Re: [patch] makes oci8.php accessible to primary key constraints
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41080@lists.php.net to get a copy of this message
>I don't see a patch. Perhaps you didn't attach it as text? > Oh, Sorry. The extenstion that I attached is 'diff'. I changed it to 'txt'. Is this OK? -------- Takayuki Eimizu

Index: DB/oci8.php =================================================================== RCS file: /repository/pear/DB/DB/oci8.php,v retrieving revision 1.103 diff -u -r1.103 oci8.php --- DB/oci8.php 11 Apr 2005 15:10:22 -0000 1.103 +++ DB/oci8.php 24 Jan 2006 08:40:09 -0000 @@ -1002,10 +1002,19 @@ * Create a result resource identifier. */ $result = strtoupper($result); - $q_fields = 'SELECT column_name, data_type, data_length, ' - . 'nullable ' - . 'FROM user_tab_columns ' - . "WHERE table_name='$result' ORDER BY column_id"; + $q_fields= 'SELECT t.column_name, t.data_type, t.data_length, ' + . ' t.nullable, c.position ' + . 'FROM user_tab_columns t,' + . ' (SELECT ucc.table_name, ucc.column_name, ucc.position' + . ' FROM user_constraints uc, user_cons_columns ucc' + . ' WHERE uc.owner = ucc.owner AND' + . ' uc.constraint_name = ucc.constraint_name AND' + . ' uc.constraint_type = 'P' AND ' + . ' uc.table_name = ucc.table_name) c ' + . "WHERE t.table_name = '$result' AND " + . ' t.table_name = c.table_name(+) AND' + . ' t.column_name = c.column_name(+) ' + . 'ORDER BY t.column_id'; $this->last_query = $q_fields; @@ -1023,7 +1032,8 @@ 'name' => $case_func(@OCIResult($stmt, 1)), 'type' => @OCIResult($stmt, 2), 'len' => @OCIResult($stmt, 3), - 'flags' => (@OCIResult($stmt, 4) == 'N') ? 'not_null' : '', + 'flags' => ((@OCIResult($stmt, 4) == 'N') ? 'not_null' : '') . + ((@OCIResult($stmt, 5) > 0) ? ' primary' : ''), ); if ($mode & DB_TABLEINFO_ORDER) { $res['order'][$res[$i]['name']] = $i; @@ -1098,6 +1108,8 @@ return 'SELECT table_name FROM user_tables'; case 'synonyms': return 'SELECT synonym_name FROM user_synonyms'; + case 'views': + return 'SELECT view_name FROM user_views'; default: return null; }
« previous php.pear.dev (#41080) next »