Show
Ignore:
Timestamp:
03/12/08 22:16:21 (2 years ago)
Author:
jwage
Message:

fixed #691 fixes #750

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/0.10/lib/Doctrine/Connection.php

    r3969 r3975  
    13781378    } 
    13791379 
     1380    /** 
     1381     * createDatabase 
     1382     * 
     1383     * Issue create database command for this instance of Doctrine_Connection 
     1384     * 
     1385     * @return mixed Returns Doctrine_Exception or success string 
     1386     */ 
    13801387    public function createDatabase() 
    13811388    { 
     
    13951402        } catch (Exception $e) {} 
    13961403 
    1397         // Close the temporary connection used to issue the drop database command 
    1398         $this->getManager()->closeConnection($tmpConnection); 
    1399  
    1400         // Re-create Doctrine style dsn 
    1401         $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname']; 
    1402  
    1403         // Re-open connection with the newly created database 
    1404         $this->getManager()->openConnection($dsn, $this->getName(), true); 
    1405  
    14061404        if (isset($e)) { 
    14071405            return $e; 
    14081406        } else { 
     1407            // Close the temporary connection used to issue the drop database command 
     1408            $this->getManager()->closeConnection($tmpConnection); 
     1409 
     1410            // Re-create Doctrine style dsn 
     1411            $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname']; 
     1412 
     1413            // Re-open connection with the newly created database 
     1414            $this->getManager()->openConnection($dsn, $this->getName(), true); 
     1415 
    14091416            return 'Successfully created database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 
    14101417        } 
     
    14141421     * dropDatabase 
    14151422     * 
    1416      * Method for dropping the database for the connection instance 
    1417      * 
    1418      * @return mixed Will return an instance of the exception thrown if the drop database fails, otherwise it returns a string detailing the success 
     1423     * Issue drop database command for this instance of Doctrine_Connection 
     1424     * 
     1425     * @return mixed Returns Doctrine_Exception or success string 
    14191426     */ 
    14201427    public function dropDatabase() 
     
    14351442        } catch (Exception $e) {} 
    14361443 
    1437         // Close the temporary connection used to issue the drop database command 
    1438         $this->getManager()->closeConnection($tmpConnection); 
    1439  
    1440         // Re-create Doctrine style dsn 
    1441         $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname']; 
    1442  
    1443         // Re-open connection with the newly created database 
    1444         $this->getManager()->openConnection($dsn, $this->getName(), true); 
    1445  
    14461444        if (isset($e)) { 
    14471445            return $e; 
    14481446        } else { 
     1447            // Close the temporary connection used to issue the drop database command 
     1448            $this->getManager()->closeConnection($tmpConnection); 
     1449 
     1450            // Re-create Doctrine style dsn 
     1451            $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname']; 
     1452 
     1453            // Re-open connection with the newly created database 
     1454            $this->getManager()->openConnection($dsn, $this->getName(), true); 
     1455 
    14491456            return 'Successfully dropped database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 
    14501457        } 
     
    14531460    /** 
    14541461     * getTmpConnection 
     1462     * 
     1463     * Create a temporary connection to the database with the user credentials. 
     1464     * This is so the user can make a connection to a db server. Some dbms allow 
     1465     * connections with no database, but some do not. In that case we have a table 
     1466     * which is always guaranteed to exist. Mysql: 'mysql', PostgreSQL: 'postgres', etc. 
     1467     * This value is set in the Doctrine_Export_{DRIVER} classes if required 
    14551468     * 
    14561469     * @param string $info