ZF-2927: Zend_Db_Adapter_Oracle - Support describe on view
Description
It should be possible to use Zend_Db_Table on views. But the describeTable function joins with the ALL_TABLES which extracts all views. This applies to Zend_Db_Adapter_Pdo_Oci as well.
Comments
Posted by Wil Sinclair (wil) on 2008-03-25T20:43:51.000+0000
Please categorize/fix as needed.
Posted by Helgi Hrafn Halldórsson (harabanar) on 2008-04-01T14:48:49.000+0000
do I understand this correctly .. do you want me to send you a fix ? I have extended the Zend_Db_Adapter_Oracle and fiex the describe function :D
Posted by Helgi Hrafn Halldórsson (harabanar) on 2008-04-01T14:59:56.000+0000
.. at least where is what we have done to make it work :D
Index: Zend/Db/Adapter/Oracle.php =================================================================== --- Zend/Db/Adapter/Oracle.php (revision 9107) +++ Zend/Db/Adapter/Oracle.php (working copy) @@ -287,18 +287,31 @@ */ public function describeTable($tableName, $schemaName = null) { - $sql = "SELECT TC.TABLE_NAME, TB.OWNER, TC.COLUMN_NAME, TC.DATA_TYPE, - TC.DATA_DEFAULT, TC.NULLABLE, TC.COLUMN_ID, TC.DATA_LENGTH, - TC.DATA_SCALE, TC.DATA_PRECISION, C.CONSTRAINT_TYPE, CC.POSITION - FROM ALL_TAB_COLUMNS TC - LEFT JOIN (ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C - ON (CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P')) - ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME - JOIN ALL_TABLES TB ON (TB.TABLE_NAME = TC.TABLE_NAME AND TB.OWNER = TC.OWNER) + $sql = " + SELECT + TC.TABLE_NAME, + TC.OWNER, + TC.COLUMN_NAME, + TC.DATA_TYPE, + TC.DATA_DEFAULT, + TC.NULLABLE, + TC.COLUMN_ID, + TC.DATA_LENGTH, + TC.DATA_SCALE, + TC.DATA_PRECISION, + C.CONSTRAINT_TYPE, + CC.POSITION + FROM + ALL_TAB_COLUMNS TC + LEFT JOIN ( + ALL_CONS_COLUMNS CC JOIN ALL_CONSTRAINTS C ON ( + CC.CONSTRAINT_NAME = C.CONSTRAINT_NAME AND CC.TABLE_NAME = C.TABLE_NAME AND C.CONSTRAINT_TYPE = 'P' + ) + ) ON TC.TABLE_NAME = CC.TABLE_NAME AND TC.COLUMN_NAME = CC.COLUMN_NAME WHERE " . $this->quoteInto('UPPER(TC.TABLE_NAME) = UPPER(?)', $tableName); if ($schemaName) { - $sql .= $this->quoteInto(' AND UPPER(TB.OWNER) = UPPER(?)', $schemaName); + $sql .= $this->quoteInto(' AND UPPER(TC.OWNER) = UPPER(?)', $schemaName); } $sql .= ' ORDER BY TC.COLUMN_ID';Posted by Helgi Hrafn Halldórsson (harabanar) on 2008-06-03T02:12:45.000+0000
any progress ? :D
Posted by Wil Sinclair (wil) on 2008-12-04T13:17:30.000+0000
Reassigning to Ralph since he's the new maintainer of Zend_Db
Posted by Mickael Perraud (mikaelkael) on 2008-12-07T01:07:22.000+0000
Fixed in SVN13083
Posted by Mickael Perraud (mikaelkael) on 2008-12-15T13:46:36.000+0000
Merged to 1.7-branch