ConnectionCommon.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: ConnectionCommon.php,v 1.2 2004/03/29 18:46:46 micha Exp $ 00004 * 00005 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00006 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00007 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00008 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00009 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00010 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00011 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00012 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00013 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00014 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00015 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00016 * 00017 * This software consists of voluntary contributions made by many individuals 00018 * and is licensed under the LGPL. For more information please see 00019 * <http://creole.phpdb.org>. 00020 */ 00021 00022 // 00023 // STATUS: 00024 // - ported: y 00025 // - exceptions: y 00026 // - compiled: y 00027 // - tested: n 00028 // 00029 00030 require_once 'creole/Connection.php'; 00031 00042 class ConnectionCommon extends Connection 00043 { 00044 00045 // Constants that define transaction isolation levels. 00046 // [We don't have any code using these yet, so there's no need 00047 // to initialize these values at this point.] 00048 // const TRANSACTION_NONE = 0; 00049 // const TRANSACTION_READ_UNCOMMITTED = 1; 00050 // const TRANSACTION_READ_COMMITTED = 2; 00051 // const TRANSACTION_REPEATABLE_READ = 3; 00052 // const TRANSACTION_SERIALIZABLE = 4; 00053 00058 var $transactionOpcount = 0; 00059 00063 var $autocommit = true; 00064 00069 var $dblink; 00070 00075 var $dsn; 00076 00081 var $flags = 0; 00082 00110 function __sleep() 00111 { 00112 return array('dsn', 'flags'); 00113 } 00114 00121 function __wakeup() 00122 { 00123 $this->connect($this->dsn, $this->flags); 00124 } 00125 00129 function getResource() 00130 { 00131 return $this->dblink; 00132 } 00133 00137 function getDSN() 00138 { 00139 return $this->dsn; 00140 } 00141 00145 function getFlags() 00146 { 00147 return $this->flags; 00148 } 00149 00156 function prepareCall(&$sql) 00157 { 00158 return new SQLException(CREOLE_ERROR_UNSUPPORTED, "Current driver does not support stored procedures using CallableStatement."); 00159 } 00160 00174 function applyLimit(&$sql, $offset, $limit) 00175 { 00176 $sql .= " LIMIT ".$limit." OFFSET ".$offset; 00177 } 00178 00184 function getAutoCommit() 00185 { 00186 return $this->autocommit; 00187 } 00188 00200 function setAutoCommit($bit) 00201 { 00202 $this->autocommit = (boolean) $bit; 00203 if ($this->transactionOpcount > 0) { 00204 trigger_error( 00205 "Changing autocommit in mid-transaction; committing " 00206 . $this->transactionOpcount . " uncommitted statements.", 00207 E_USER_WARNING 00208 ); 00209 return false; 00210 } 00211 00212 if ($bit && $this->transactionOpcount > 0) { 00213 return $this->commit(); 00214 } 00215 00216 return true; 00217 } 00218 00219 }

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


Copyright © 2004 Hans Lellelid  
Creole[php4] CVS