00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
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 }