Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.11.5

Bug #8628 tableInfo with MDB2
Submitted: 2006-09-04 09:02 UTC
From: sei at dmc dot de Assigned: alan_k
Status: Closed Package: DB_DataObject (version 1.8.4)
PHP Version: 4.4.3 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2006-09-04 09:02 UTC] sei at dmc dot de (Sascha)
Description: ------------ There is a problem in the Generator.php In the function "fillTableSchema" there is a call to "tableInfo". With MDB2 this is a function of the Module "Reverse". In the function "_createTableList" the Modules are correctly loaded for MDB2 but only the "Manager"-Module is correctly used with "$__DB->manager->listTables()" With PHP5 the direct call is possible due to the __call function of MDB2 but with PHP4 this won´t work. Could you please fix the call of "tableInfo" and don´t forget the Fieldmapping of "length" -> "len"

Comments

 [2006-09-04 09:35 UTC] alan_k (Alan Knowles)
any chance of a patch.?
 [2006-09-24 10:15 UTC] armen at opensourceclub dot ir (Armen Baghumian)
Hi, yes there is a patch written by lsmit, I just changed it a little.It works for me. lsmit, thanks for patch :) http://rafb.net/paste/results/Y4hO5679.html
 [2006-09-24 14:36 UTC] alan_k (Alan Knowles)
For reference. Index: Generator.php =================================================================== RCS file: /repository/pear/DB_DataObject/DataObject/Generator.php,v retrieving revision 1.120 diff -r1.120 Generator.php 256,257c256,259 < $defs = $__DB->tableInfo($table); < if ($is_MDB2) { --- > if (!$is_MDB2) { > $defs = $__DB->tableInfo($table); > } else { > $defs = $__DB->reverse->tableInfo($table); 262c264 < --- > 529c531 < --- > 1047,1048c1049,1075 < < $defs = $__DB->tableInfo($table); --- > > $options = &PEAR::getStaticProperty('DB_DataObject','options'); > $db_driver = empty($options['db_driver']) ? 'DB' : $options['db_driver']; > $is_MDB2 = ($db_driver != 'DB') ? true : false; > > if (!$is_MDB2) { > // try getting a list of schema tables first. (postgres) > $__DB->expectError(DB_ERROR_UNSUPPORTED); > $this->tables = $__DB->getListOf('schema.tables'); > $__DB->popExpect(); > } else { > /** > * set portability and some modules to fetch the informations > */ > $__DB->setOption('portability', MDB2_PORTABILITY_ALL ^ MDB2_PORTABILITY_FIX_CASE); > $__DB->loadModule('Manager'); > $__DB->loadModule('Reverse'); > } > > if (!$is_MDB2) { > $defs = $__DB->tableInfo($table); > } else { > $defs = $__DB->reverse->tableInfo($table); > foreach ($defs as $k => $v) { > $defs[$k]['len'] = &$defs[$k]['length']; > } > }
 [2006-09-25 08:16 UTC] alan_k (Alan Knowles)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better. commited - thanks