Changeset 3975 for branches/0.10/lib/Doctrine/Connection.php
- Timestamp:
- 03/12/08 22:16:21 (2 years ago)
- Files:
-
- 1 modified
-
branches/0.10/lib/Doctrine/Connection.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/0.10/lib/Doctrine/Connection.php
r3969 r3975 1378 1378 } 1379 1379 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 */ 1380 1387 public function createDatabase() 1381 1388 { … … 1395 1402 } catch (Exception $e) {} 1396 1403 1397 // Close the temporary connection used to issue the drop database command1398 $this->getManager()->closeConnection($tmpConnection);1399 1400 // Re-create Doctrine style dsn1401 $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname'];1402 1403 // Re-open connection with the newly created database1404 $this->getManager()->openConnection($dsn, $this->getName(), true);1405 1406 1404 if (isset($e)) { 1407 1405 return $e; 1408 1406 } 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 1409 1416 return 'Successfully created database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 1410 1417 } … … 1414 1421 * dropDatabase 1415 1422 * 1416 * Method for dropping the database for the connection instance1417 * 1418 * @return mixed Will return an instance of the exception thrown if the drop database fails, otherwise it returns a string detailing the success1423 * Issue drop database command for this instance of Doctrine_Connection 1424 * 1425 * @return mixed Returns Doctrine_Exception or success string 1419 1426 */ 1420 1427 public function dropDatabase() … … 1435 1442 } catch (Exception $e) {} 1436 1443 1437 // Close the temporary connection used to issue the drop database command1438 $this->getManager()->closeConnection($tmpConnection);1439 1440 // Re-create Doctrine style dsn1441 $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname'];1442 1443 // Re-open connection with the newly created database1444 $this->getManager()->openConnection($dsn, $this->getName(), true);1445 1446 1444 if (isset($e)) { 1447 1445 return $e; 1448 1446 } 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 1449 1456 return 'Successfully dropped database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 1450 1457 } … … 1453 1460 /** 1454 1461 * 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 1455 1468 * 1456 1469 * @param string $info