[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 require_once 'creole/IdGenerator.php'; 4 5 /** 6 * Oracle (OCI8) IdGenerator implimenation. 7 * 8 * @author Hans Lellelid <hans@xmpl.org> 9 * @version $Revision: 1.5 $ 10 * @package creole.drivers.oracle 11 */ 12 class OCI8IdGenerator implements IdGenerator { 13 14 /** Connection object that instantiated this class */ 15 private $conn; 16 17 /** 18 * Creates a new IdGenerator class, saves passed connection for use 19 * later by getId() method. 20 * @param Connection $conn 21 */ 22 public function __construct(Connection $conn) 23 { 24 $this->conn = $conn; 25 } 26 27 /** 28 * @see IdGenerator::isBeforeInsert() 29 */ 30 public function isBeforeInsert() 31 { 32 return true; 33 } 34 35 /** 36 * @see IdGenerator::isAfterInsert() 37 */ 38 public function isAfterInsert() 39 { 40 return false; 41 } 42 43 /** 44 * @see IdGenerator::getIdMethod() 45 */ 46 public function getIdMethod() 47 { 48 return self::SEQUENCE; 49 } 50 51 /** 52 * @see IdGenerator::getId() 53 */ 54 public function getId($name = null) 55 { 56 if ($name === null) { 57 throw new SQLException("You must specify the sequence name when calling getId() method."); 58 } 59 $rs = $this->conn->executeQuery("select " . $name . ".nextval from dual", ResultSet::FETCHMODE_NUM); 60 $rs->next(); 61 return $rs->getInt(1); 62 } 63 64 } 65
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Fri Mar 16 22:42:14 2007 | par Balluche grâce à PHPXref 0.7 |