Changeset 3968

Show
Ignore:
Timestamp:
03/11/08 03:27:27 (16 months ago)
Author:
jwage
Message:

A few more create/drop db fixes.

Location:
branches/0.10/lib/Doctrine
Files:
2 modified

Legend:

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

    r3967 r3968  
    13891389 
    13901390            // Get the temporary connection to issue the drop database command 
    1391             $connect = $this->getTmpConnection($info); 
     1391            $tmpConnection = $this->getTmpConnection($info); 
    13921392 
    13931393            // Issue create database command 
    1394             $connect->export->createDatabase($info['dbname']); 
    1395  
    1396             // Close the temporary connection used to issue the drop database command 
    1397             $this->getManager()->closeConnection($connect); 
    1398  
    1399             // Close original 
    1400             $this->getManager()->closeConnection($this); 
    1401  
    1402             // Re-open connection with the newly created database 
    1403             $this->getManager()->openConnection(new PDO($dsn, $this->getOption('username'), $this->getOption('password')), $this->getName(), true); 
    1404  
     1394            $tmpConnection->export->createDatabase($info['dbname']); 
     1395        } catch (Exception $e) {} 
     1396 
     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 
     1406        // Close original 
     1407        $this->getManager()->closeConnection($this); 
     1408 
     1409        if (isset($e)) { 
     1410            return $e; 
     1411        } else { 
    14051412            return 'Successfully created database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 
    1406         } catch (Exception $e) { 
    1407             return $e; 
    14081413        } 
    14091414    } 
     
    14271432 
    14281433            // Get the temporary connection to issue the drop database command 
    1429             $connect = $this->getTmpConnection($info); 
     1434            $tmpConnection = $this->getTmpConnection($info); 
    14301435 
    14311436            // Issue drop database command 
    1432             $connect->export->dropDatabase($info['dbname']); 
    1433  
    1434             // Close the temporary connection used to issue the drop database command 
    1435             $this->getManager()->closeConnection($connect); 
    1436  
     1437            $tmpConnection->export->dropDatabase($info['dbname']); 
     1438        } catch (Exception $e) {} 
     1439 
     1440        // Close the temporary connection used to issue the drop database command 
     1441        $this->getManager()->closeConnection($tmpConnection); 
     1442 
     1443        // Re-create Doctrine style dsn 
     1444        $dsn = $info['scheme'] . '://' . $this->getOption('username') . ':' . $this->getOption('password') . '@' . $info['host'] . '/' . $info['dbname']; 
     1445 
     1446        // Re-open connection with the newly created database 
     1447        $this->getManager()->openConnection($dsn, $this->getName(), true); 
     1448 
     1449        if (isset($e)) { 
     1450            return $e; 
     1451        } else { 
    14371452            return 'Successfully dropped database for connection "' . $this->getName() . '" named "' . $info['dbname'] . '"'; 
    1438         } catch (Exception $e) { 
    1439             return $e; 
    14401453        } 
    14411454    } 
  • branches/0.10/lib/Doctrine/Export.php

    r3884 r3968  
    12641264    public function exportTable(Doctrine_Table $table) 
    12651265    { 
    1266         /** 
    1267         TODO: maybe there should be portability option for the following check 
    1268         if ( ! Doctrine::isValidClassname($table->getOption('declaringClass')->getName())) { 
    1269             throw new Doctrine_Export_Exception('Class name not valid.'); 
    1270         } 
    1271         */ 
    1272  
    12731266        try { 
    12741267            $data = $table->getExportableFormat();