SQLiteIdGenerator.php

Go to the documentation of this file.
00001 <?php 00002 00003 require_once 'creole/IdGenerator.php'; 00004 00013 class SQLiteIdGenerator extends IdGenerator 00014 { 00016 var $conn; 00017 00023 function SQLite(/*Connection*/ &$conn) 00024 { 00025 if (! is_a($conn, 'Connection')) { 00026 trigger_error( 00027 "SQLiteIdGenerator::SQLiteIdGenerator(): parameter 1 not of type 'Connection' !", 00028 E_USER_ERROR 00029 ); 00030 } 00031 00032 $this->conn =& $conn; 00033 } 00034 00039 function isBeforeInsert() 00040 { 00041 return false; 00042 } 00043 00048 function isAfterInsert() 00049 { 00050 return true; 00051 } 00052 00057 function getIdMethod() 00058 { 00059 return IdGenerator::AUTOINCREMENT(); 00060 } 00061 00066 function getId($unused = null) 00067 { 00068 return sqlite_last_insert_rowid($this->conn->getResource()); 00069 } 00070 00071 } 00072

This file is part of the Creole[php4] library.


Copyright © 2004 Hans Lellelid  
Creole[php4] CVS