PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB » Bug #148

Database tables not created

Details

Submitted2003-10-24 02:11 UTC
FromAndrew dot Wright at csiro dot au
Assignedlsmith
StatusClosed
PackageMDB
PHP Version4.3.1
OSMandrake Linux 9.1/Solaris 2.6
Roadmaps(Not assigned)

Comments

[2003-10-24 02:11 UTC] Andrew dot Wright at csiro dot au

Description:
------------
MDB_manager::updateDatabase() returns true with no errors or warnings and saves the old scheme file, but no database tables are created. I have tried this on different schemes and scripts that have worked as expected for a MDB version prior to 1.1.4RC3 (probably 1.1.3).

The "no table/object creation" has been observed in Oracle 8.1.7, MySQL 4.0.11a-gamma, and PostgreSQL 7.3.2. Note that <create>1</create> has been used for the latter two db systems.

Reproduce code:
---------------
// Error checking snipped
function imsDBManager($dbtype, $dbusername, $dbpassword,$dbhost,$dbname) {
$dsn = $dbtype."://".$dbusername.":".$dbpassword."@".$dbhost."/".$dbname;
$manager = new MDB_manager;
$success = $manager->connect($dsn);
return $manager;
}
function imsInstallDatabase()
{
$schema = "dbscheme.xml";
$old_schema_ext = ".previous";
$db = imsDBManager();
$update = $db->updateDatabase($schema, $schema.$old_schema_ext);
return $update
}

Expected result:
----------------
$db->updateDatabase($schema, $schema.$old_schema_ext); (imsInstallDatabase()) returns true. The tables and objects specified in dbscheme.xml created.

Actual result:
--------------
Returns true, but tables not created.

[2003-11-13 13:36 UTC] the dot woman at bikkel dot org

FYI

I'm using version 1.1.3 and tried the updateDatabase of the MDB_manager too. It is working fine for MySQL (3.23.48, shame on me) but i had the same as Andrew Wright with PostgreSQL 7.3.2. No database, no error, no warning, nothing.

greetings, tijger

oh, and i wanted to say "i like this abstraction layer".

[2004-05-13 10:38 UTC] smith at backendmedia dot com

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

[2004-06-29 15:10 UTC] michael at mompopmedia dot com

when creating a new DB with a xml schema, MDB2_Tools_Manager::updateDatabase returns true even when the opperation failed. Specifically, if there is an error on an executed "ALTER TABLE" for indexes, the _createTable method incorrectly returns true.

The error is located in this snippet (446 to 454)

if (MDB2::isError($result)) {
$result = $this->db->manager->dropTable($table_name);
if (MDB2::isError($result)) {
$result = $this->raiseError(MDB2_ERROR_MANAGER, null, null,
'could not drop the table ('.$result->getMessage().
' ('.$result->getUserinfo().'))');
}
return $result;
}

upon failure on the ALTER TABLE query, createTable returns true that the created table was successfully dropped. It should be returning an error notifying that the table was dropped because fo the ALTER TABLE failure.