Runtime classes - Doctrine_Session.php 720 Bytes
Newer Older
doctrine's avatar
doctrine committed
1
<?php
2
$sess = $manager->openConnection(Doctrine_DB::getConnection("schema://username:password@hostname/database"));
doctrine's avatar
doctrine committed
3

4
// get connection state:
doctrine's avatar
doctrine committed
5
switch($sess):
6
    case Doctrine_Connection::STATE_BUSY:
doctrine's avatar
doctrine committed
7 8
        // multiple open transactions
    break;
9
    case Doctrine_Connection::STATE_ACTIVE:
doctrine's avatar
doctrine committed
10 11
        // one open transaction
    break;
12
    case Doctrine_Connection::STATE_CLOSED:
doctrine's avatar
doctrine committed
13 14
        // closed state
    break;
15
    case Doctrine_Connection::STATE_OPEN:
doctrine's avatar
doctrine committed
16 17 18 19 20 21 22 23
        // open state and zero open transactions
    break;
endswitch;

// getting database handler

$dbh = $sess->getDBH();

24
// flushing the connection
doctrine's avatar
doctrine committed
25 26 27
$sess->flush();


28
// print lots of useful info about connection:
doctrine's avatar
doctrine committed
29 30
print $sess;
?>