[ Index ] |
|
Code source de Symfony 1.0.0 |
1 <?php 2 3 require_once 'creole/IdGenerator.php'; 4 5 /** 6 * MSSQL IdGenerator implimenation. 7 * 8 * @author Hans Lellelid <hans@xmpl.org> 9 * @version $Revision: 1.6 $ 10 * @package creole.drivers.mssql 11 */ 12 class MSSQLIdGenerator 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 false; 33 } 34 35 /** 36 * @see IdGenerator::isAfterInsert() 37 */ 38 public function isAfterInsert() 39 { 40 return true; 41 } 42 43 /** 44 * @see IdGenerator::getIdMethod() 45 */ 46 public function getIdMethod() 47 { 48 return self::AUTOINCREMENT; 49 } 50 51 /** 52 * @see IdGenerator::getId() 53 */ 54 public function getId($unused = null) 55 { 56 $rs = $this->conn->executeQuery("SELECT SCOPE_IDENTITY()", ResultSet::FETCHMODE_NUM); 57 $rs->next(); 58 return $rs->getInt(1); 59 } 60 61 } 62
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 |