cvs: pear /MDB manager.php

From: Date: Mon, 26 Aug 2002 13:35:12 +0000
Subject: cvs: pear /MDB manager.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-5980@lists.php.net to get a copy of this message
lsmith Mon Aug 26 09:35:12 2002 EDT Modified files: /pear/MDB manager.php Log: fixed bugs in the handling of LOBs during database initialization xml reverse engineering: all database, table, field, index und sequence names are now forced to be lower case Index: pear/MDB/manager.php diff -u pear/MDB/manager.php:1.46 pear/MDB/manager.php:1.47 --- pear/MDB/manager.php:1.46 Sat Aug 24 18:40:36 2002 +++ pear/MDB/manager.php Mon Aug 26 09:35:12 2002 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@dybnet.de> | // +----------------------------------------------------------------------+ // -// $Id: manager.php,v 1.46 2002/08/24 22:40:36 lsmith Exp $ +// $Id: manager.php,v 1.47 2002/08/26 13:35:12 lsmith Exp $ // require_once 'PEAR.php'; @@ -92,6 +92,7 @@ 'ibase' => array() ) ); + // }}} // {{{ raiseError() @@ -370,29 +371,31 @@ break; case 'clob': $lob_definition = array( - 'Database' => $this, + 'Database' => $this->database, 'Error' => '', 'Data' => $field ); - $lob = count($lobs); - if (MDB::isError($result = $this->database->reateLOB($lob_definition, $lobs[$lob]))) + if (MDB::isError($result = $this->database->reateLob($lob_definition))) { break; } - $result = $this->database->setParamCLOB($prepared_query, + $lob = count($lobs); + $lobs[$lob] = $result; + $result = $this->database->setParamClob($prepared_query, $field_number, $lobs[$lob], $field_name); break; case 'blob': $lob_definition = array( - 'Database' => $this, + 'Database' => $this->database, 'Error' => '', 'Data' => $field ); - $lob = count($lobs); - if (MDB::isError($result = $this->database->createLOB($lob_definition, $lobs[$lob]))) { + if (MDB::isError($result = $this->database->createLob($lob_definition))) { break; } - $result = $this->database->setParamBLOB($prepared_query, + $lob = count($lobs); + $lobs[$lob] = $result; + $result = $this->database->setParamBlob($prepared_query, $field_number, $lobs[$lob], $field_name); break; case 'boolean': @@ -413,7 +416,7 @@ break; case 'float': $result = $this->database->setParamFloat($prepared_query, - $field_number,doubleval($field)); + $field_number, doubleval($field)); break; case 'decimal': $result = $this->database->setParamDecimal($prepared_query, @@ -481,6 +484,7 @@ .$result->getMessage().' ('.$result->getUserinfo(),'))', 'MDB_Error', TRUE); } + return $result; } return (DB_OK); } @@ -623,6 +627,7 @@ if (MDB::isError($result)) { if($result->getCode() === DB_ERROR_ALREADY_EXISTS) { $this->warnings[] = 'Database allready exists: '.$this->database_definition['name']; + /* if ($overwrite) { $this->database->debug('Overwritting Database'); $result = $this->database->dropDatabase($this->database_definition['name']); @@ -633,11 +638,12 @@ if (MDB::isError($result)) { return $result; } - } else { + */ + // } else { $result = DB_OK; - } + // } } else { - $this->database->debug('Create database error '); + $this->database->debug('Create database error.'); return $result; } } @@ -1620,7 +1626,7 @@ return ('it was not specified a valid database name'); } $this->database_definition = array( - 'name' => $database, + 'name' => strtolower($database), 'create' => 1, 'TABLES' => array() ); @@ -1637,8 +1643,8 @@ $this->database_definition['TABLES'][$table_name] = array('FIELDS' => array()); for($field = 0; $field < count($fields); $field++) { - $field_name = $fields[$field]; - $definition = $this->database->getTableFieldDefinition($table_name, $field_name); + $field_name = strtolower($fields[$field]); + $definition = $this->database->getTableFieldDefinition($table_name, $fields[$field]); if (MDB::isError($definition)) { return ($definition); } @@ -1711,7 +1717,7 @@ if (MDB::isError($definition)) { return($definition); } - $this->database_definition['TABLES'][$table_name]['INDEXES'][$index_name] = $definition; + $this->database_definition['TABLES'][$table_name]['INDEXES'] = $definition; } } $sequences = $this->database->listSequences(); @@ -1727,7 +1733,7 @@ if (MDB::isError($definition)) { return($definition); } - $this->database_definition['SEQUENCES'][$sequence_name] = $definition; + $this->database_definition['SEQUENCES'] = $definition; } return(DB_OK); }

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