cvs: pear /MDB/MDB/Modules/Manager oci8.php

From: Date: Fri, 17 Jan 2003 13:20:21 +0000
Subject: cvs: pear /MDB/MDB/Modules/Manager oci8.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-8333@lists.php.net to get a copy of this message
lsmith Fri Jan 17 08:20:21 2003 EDT Modified files: /pear/MDB/MDB/Modules/Manager oci8.php Log: eleminated a bunch of parse errors Index: pear/MDB/MDB/Modules/Manager/oci8.php diff -u pear/MDB/MDB/Modules/Manager/oci8.php:1.2 pear/MDB/MDB/Modules/Manager/oci8.php:1.3 --- pear/MDB/MDB/Modules/Manager/oci8.php:1.2 Thu Jan 16 11:55:17 2003 +++ pear/MDB/MDB/Modules/Manager/oci8.php Fri Jan 17 08:20:21 2003 @@ -42,7 +42,7 @@ // | Author: Lukas Smith <smith@backendmedia.com> | // +----------------------------------------------------------------------+ -// $Id: oci8.php,v 1.2 2003/01/16 16:55:17 lsmith Exp $ +// $Id: oci8.php,v 1.3 2003/01/17 13:20:21 lsmith Exp $ if (!defined('MDB_MANAGER_OCI8_INCLUDED')) { define('MDB_MANAGER_OCI8_INCLUDED', 1); @@ -70,25 +70,31 @@ */ function createDatabase(&$db, $name) { - if (!isset($db->getOption($option = "DBAUser")) || !isset($db->getOption($option = "DBAPassword"))) { + $user = $db->getOption("DBAUser"); + if (MDB::isError($user)) { return($db->raiseError(MDB_ERROR_INSUFFICIENT_DATA, '', '', 'Create database', - "it was not specified the Oracle $option option")); + "it was not specified the Oracle DBAUser option")); } - if ($db->connect($db->getOption("DBAUser"), $db->getOption("DBAPassword"), 0)) { + $password = $db->getOption("DBAPassword"); + if (MDB::isError($password)) { + return($db->raiseError(MDB_ERROR_INSUFFICIENT_DATA, '', '', 'Create database', + "it was not specified the Oracle DBAPassword option")); + } + if (MDB::isError($db->connect($user, $password, 0))) { $tablespace = $db->getOption("DefaultTablespace"); if(MDB::isError($tablespace)) { $tablespace = ''; } else { $tablespace = ' DEFAULT TABLESPACE '.$tablespace; } - if ($db->_doQuery('CREATE USER '.$db->user.' IDENTIFIED BY '.$db->password.$tablespace) { + if ($db->_doQuery('CREATE USER '.$db->user.' IDENTIFIED BY '.$db->password.$tablespace)) { if (MDB::isError($result = $db->_doQuery('GRANT CREATE SESSION, CREATE TABLE,UNLIMITED TABLESPACE,CREATE SEQUENCE TO '.$db->user))) { if (MDB::isError($result2 = $db->_doQuery('DROP USER '.$db->user.' CASCADE'))) { return($db->raiseError(MDB_Error, '','', 'Create database', - "could not setup the database user (".$result->getUserinfo().") and then could drop its records (".$result2->getUserinfo().")"; + "could not setup the database user (".$result->getUserinfo().") and then could drop its records (".$result2->getUserinfo().")")); } return($db->raiseError(MDB_Error, '','', 'Create database', - "could not setup the database user (".$result->getUserinfo().")"; + "could not setup the database user (".$result->getUserinfo().")")); } else { return MDB_OK; } @@ -110,11 +116,17 @@ */ function dropDatabase(&$db, $name) { - if (!isset($db->getOption($option = "DBAUser")) || !isset($db->getOption($option = "DBAPassword"))) { + $user = $db->getOption("DBAUser"); + if (MDB::isError($user)) { + return($db->raiseError(MDB_ERROR_INSUFFICIENT_DATA, '', '', 'Create database', + "it was not specified the Oracle DBAUser option")); + } + $password = $db->getOption("DBAPassword"); + if (MDB::isError($password)) { return($db->raiseError(MDB_ERROR_INSUFFICIENT_DATA, '', '', 'Create database', - "it was not specified the Oracle $option option")); + "it was not specified the Oracle DBAPassword option")); } - if (MDB::isError($result = $db->connect($db->getOption("DBAUser"), $db->getOption("DBAPassword"), 0)) { + if (MDB::isError($db->connect($user, $password, 0))) { return $result; } return($db->_doQuery("DROP USER " . $db->user . " CASCADE"));

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