cvs: pear /MDB2/MDB2/Driver/Manager ibase.php

From: Date: Fri, 20 Jan 2006 11:39:43 +0000
Subject: cvs: pear /MDB2/MDB2/Driver/Manager ibase.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-37664@lists.php.net to get a copy of this message
quipo Fri Jan 20 11:39:43 2006 UTC Modified files: /pear/MDB2/MDB2/Driver/Manager ibase.php Log: - check if a constraint name is given in createConstraint() - added private _silentCommit() method to avoid uncommitted queries preventing further queries to succeed (@see bug #6494) http://cvs.php.net/viewcvs.cgi/pear/MDB2/MDB2/Driver/Manager/ibase.php?r1=1.76&r2=1.77&diff_format=u Index: pear/MDB2/MDB2/Driver/Manager/ibase.php diff -u pear/MDB2/MDB2/Driver/Manager/ibase.php:1.76 pear/MDB2/MDB2/Driver/Manager/ibase.php:1.77 --- pear/MDB2/MDB2/Driver/Manager/ibase.php:1.76 Fri Jan 20 11:38:58 2006 +++ pear/MDB2/MDB2/Driver/Manager/ibase.php Fri Jan 20 11:39:43 2006 @@ -42,7 +42,7 @@ // | Author: Lorenzo Alberton <l.alberton@quipo.it> | // +----------------------------------------------------------------------+ // -// $Id: ibase.php,v 1.76 2006/01/20 11:38:58 quipo Exp $ +// $Id: ibase.php,v 1.77 2006/01/20 11:39:43 quipo Exp $ require_once 'MDB2/Driver/Manager/Common.php'; @@ -99,6 +99,24 @@ } // }}} + // {{{ _silentCommit() + + /** + * conditional COMMIT query to make changes permanent, when auto + * @access private + */ + function _silentCommit() + { + $db =& $this->getDBInstance(); + if (PEAR::isError($db)) { + return $db; + } + if (!$db->in_transaction) { + @$db->exec('COMMIT'); + } + } + + // }}} // {{{ _makeAutoincrement() /** @@ -146,7 +164,9 @@ IF (NEW.' . $name . ' IS NULL OR NEW.' . $name . ' = 0) THEN NEW.' . $name . ' = GEN_ID('.$sequence_name.', 1); END'; - return $db->exec($trigger_sql); + $result = $db->exec($trigger_sql); + $this->_silentCommit(); + return $result; } // }}} @@ -220,6 +240,7 @@ if (PEAR::isError($result)) { return $result; } + $this->_silentCommit(); foreach ($fields as $field_name => $field) { if (array_key_exists('autoincrement', $field) && $field['autoincrement']) { //create PK constraint @@ -298,7 +319,9 @@ if (PEAR::isError($result)) { return $result; } - return parent::dropTable($name); + $result = parent::dropTable($name); + $this->_silentCommit(); + return $result; } // }}} @@ -472,7 +495,9 @@ } $name = $db->quoteIdentifier($name, true); - return $db->exec("ALTER TABLE $name $query"); + $result = $db->exec("ALTER TABLE $name $query"); + $this->_silentCommit(); + return $result; } // }}} @@ -637,7 +662,9 @@ $fields[] = $db->quoteIdentifier($field, true); } $query .= ' ('.implode(', ', $fields) . ')'; - return $db->exec($query); + $result = $db->exec($query); + $this->_silentCommit(); + return $result; } // }}} @@ -712,7 +739,9 @@ return $db; } $table = $db->quoteIdentifier($table, true); - $name = $db->quoteIdentifier($db->getIndexName($name), true); + if (!empty($name)) { + $name = $db->quoteIdentifier($db->getIndexName($name), true); + } $query = "ALTER TABLE $table ADD"; if (array_key_exists('primary', $definition) && $definition['primary']) { if (!empty($name)) { @@ -730,7 +759,9 @@ $fields[] = $db->quoteIdentifier($field, true); } $query .= ' ('. implode(', ', $fields) . ')'; - return $db->exec($query); + $result = $db->exec($query); + $this->_silentCommit(); + return $result; } // }}}

« previous php.pear.cvs (#37664) next »