cvs: pear /DBA DBA_Relational.php DBA_Table.php
| From: | Brent Cook | Date: | Wed, 17 Jul 2002 07:54:34 +0000 |
| Subject: | cvs: pear /DBA DBA_Relational.php DBA_Table.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-5147@lists.php.net to get a copy of this message | ||
busterb Wed Jul 17 03:54:34 2002 EDT
Modified files:
/pear/DBA DBA_Relational.php DBA_Table.php
Log:
fixed concurrency problem when creating and inserting on a table
simultaneously
Index: pear/DBA/DBA_Relational.php
diff -u pear/DBA/DBA_Relational.php:1.36 pear/DBA/DBA_Relational.php:1.37
--- pear/DBA/DBA_Relational.php:1.36 Wed Jul 17 03:39:04 2002
+++ pear/DBA/DBA_Relational.php Wed Jul 17 03:54:34 2002
@@ -18,7 +18,7 @@
// | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA|
// +----------------------------------------------------------------------+
//
-// $Id: DBA_Relational.php,v 1.36 2002/07/17 07:39:04 busterb Exp $
+// $Id: DBA_Relational.php,v 1.37 2002/07/17 07:54:34 busterb Exp $
require_once 'PEAR.php';
require_once 'DB/DBA/DBA_Table.php';
@@ -127,17 +127,12 @@
*/
function _openTable($tableName, $mode = 'r')
{
- if (is_string($tableName)) {
- if (!isset($this->_tables[$tableName])) {
- if (!$this->tableExists($tableName)) {
- return $this->raiseError('table "'.$tableName.
- '" does not exist');
- } else {
- $this->_tables[$tableName] =& new DBA_Table($this->_driver);
- }
+ if (!isset($this->_tables[$tableName])) {
+ if (!$this->tableExists($tableName)) {
+ return $this->raiseError('table '.$tableName.' does not
exist');
+ } else {
+ $this->_tables[$tableName] =& new DBA_Table($this->_driver);
}
- } else {
- return $this->raiseError('invalid table name, '.$tableName);
}
if (!$this->_tables[$tableName]->isOpen()) {
@@ -174,17 +169,7 @@
*/
function createTable($tableName, $schema)
{
- // check if this table object exists
- if (!isset($this->_tables[$tableName])) {
- $this->_tables[$tableName] = new DBA_Table($this->_driver);
- } else {
- // the table object exists, so the table must exist
- return $this->raiseError("cannot create table: $tableName,".
- " it already exists");
- }
-
- return $this->_tables[$tableName]->create($this->_home.$tableName,
- $schema);
+ return $this->_manager->create($this->_home.$tableName, $schema);
}
/**
Index: pear/DBA/DBA_Table.php
diff -u pear/DBA/DBA_Table.php:1.47 pear/DBA/DBA_Table.php:1.48
--- pear/DBA/DBA_Table.php:1.47 Wed Jul 17 03:29:01 2002
+++ pear/DBA/DBA_Table.php Wed Jul 17 03:54:34 2002
@@ -18,7 +18,7 @@
// | Foundation, Inc., 59 Temple Place, Suite 330,Boston,MA 02111-1307 USA|
// +----------------------------------------------------------------------+
//
-// $Id: DBA_Table.php,v 1.47 2002/07/17 07:29:01 busterb Exp $
+// $Id: DBA_Table.php,v 1.48 2002/07/17 07:54:34 busterb Exp $
//
require_once 'PEAR.php';
require_once 'DB/DBA/DBA.php';
@@ -203,6 +203,8 @@
if (isset($this->_schema)) {
$schema = $this->_packSchema($this->_schema);
$this->_dba->replace(DBA_SCHEMA_KEY, $schema);
+ } else {
+ echo "No schema ;P\n";
}
}
$this->_maxKey = null;