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

Bug #12083 createTable() does not return MDB2_OK
Submitted: 2007-09-19 13:17 UTC
From: till Assigned: quipo
Status: Closed Package: MDB2_Driver_mysql (version 1.4.1)
PHP Version: 4.4.4 OS: FreeBSD
Roadmaps: (Not assigned)    

 [2007-09-19 13:17 UTC] till (Till Klampaeckel)
Description: ------------ I am using the manager to create a (temporary) table, it works but neither returns an error, nor MDB2_OK. Just "0" (int). According to the docs, it should return MDB2_OK though. I tested this a few times and both temporary tables and regular tables are created. Just the return value is "off". Test script: --------------- <?php // assume we have $db resource and all vars ready $manager = $db->loadModule('manager'); $status = $manager->createTable($name, $fields, $options); ?> Expected result: ---------------- $status should contain MDB2_OK (or an error ;-)) Actual result: -------------- $status contains "0"


 [2007-09-19 20:28 UTC] quipo (Lorenzo Alberton)
Indeed, createTable() calls exec() which in turn returns the number of affected rows. I have to think a bit if this can be considered as a documentation problem or if we really have to change the code.
 [2007-09-19 20:35 UTC] till (Till Klampaeckel)
Well, I vote for MDB2_OK. ;-) Since exec() will always return 0. I don't think a CREATE TABLE statement will ever return a number of rows.
 [2007-09-23 18:48 UTC] quipo (Lorenzo Alberton)
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the 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.