SQLException.php

Go to the documentation of this file.
00001 <?php 00002 /* 00003 * $Id: SQLException.php,v 1.10 2004/03/20 04:16:49 hlellelid 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 00029 class SQLException extends Exception { 00030 00032 protected $userInfo; 00033 00035 protected $nativeError; 00036 00043 public function __construct($msg, $native = null, $userinfo = null) 00044 { 00045 parent::__construct($msg); 00046 if ($native !== null) { 00047 $this->setNativeError($native); 00048 } 00049 if ($userinfo !== null) { 00050 $this->setUserInfo($userinfo); 00051 } 00052 } 00053 00060 public function setUserInfo($info) 00061 { 00062 $this->userInfo = $info; 00063 $this->message .= " [User Info: " .$this->userInfo . "]"; 00064 } 00065 00071 public function getUserInfo() 00072 { 00073 return $this->userInfo; 00074 } 00075 00082 public function setNativeError($msg) 00083 { 00084 $this->nativeError = $msg; 00085 $this->message .= " [Native Error: " .$this->nativeError . "]"; 00086 } 00087 00093 public function getNativeError() 00094 { 00095 return $this->nativeError; 00096 } 00097 00101 public function toString() 00102 { 00103 return $this->getMessage(); 00104 } 00105 }

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


Copyright © 2004 Hans Lellelid  
Creole[php5] CVS