Pluf::loadFunction('Pluf_DB_defaultTypecast');␊ |
$this->type_cast = Pluf_DB_defaultTypecast();␊ |
$this->debug('* MYSQL CONNECT');␊ |
$this->con_id = mysql_connect($server, $user, $pwd);␊ |
$this->con_id = mysqli_connect($server, $user, $pwd);␊ |
$this->debug = $debug;␊ |
$this->pfx = $pfx;␊ |
if (!$this->con_id) {␊ |
|
␊ |
function database($dbname)␊ |
{␊ |
$db = mysql_select_db($dbname);␊ |
$db = mysqli_select_db($this->con_id, $dbname);␊ |
$this->debug('* USE DATABASE '.$dbname);␊ |
if (!$db) {␊ |
throw new Exception($this->getError());␊ |
|
*/␊ |
function getServerInfo()␊ |
{␊ |
return mysql_get_server_info($this->con_id);␊ |
return mysqli_get_server_info($this->con_id);␊ |
}␊ |
␊ |
/**␊ |
|
function close()␊ |
{␊ |
if ($this->con_id) {␊ |
mysql_close($this->con_id);␊ |
mysqli_close($this->con_id);␊ |
return true;␊ |
} else {␊ |
return false;␊ |
|
function select($query)␊ |
{␊ |
$this->debug($query);␊ |
$cur = mysql_query($query, $this->con_id);␊ |
$cur = mysqli_query($this->con_id, $query);␊ |
if ($cur) {␊ |
$res = array();␊ |
while ($row = mysql_fetch_assoc($cur)) {␊ |
while ($row = mysqli_fetch_assoc($cur)) {␊ |
$res[] = $row;␊ |
}␊ |
mysql_free_result($cur);␊ |
mysqli_free_result($cur);␊ |
return $res;␊ |
} else {␊ |
throw new Exception($this->getError());␊ |
|
function execute($query)␊ |
{␊ |
$this->debug($query);␊ |
$cur = mysql_query($query, $this->con_id);␊ |
$cur = mysqli_query($this->con_id, $query);␊ |
if (!$cur) {␊ |
throw new Exception($this->getError());␊ |
} else {␊ |
|
function getLastID()␊ |
{␊ |
$this->debug('* GET LAST ID');␊ |
return (int) mysql_insert_id($this->con_id);␊ |
return (int) mysqli_insert_id($this->con_id);␊ |
}␊ |
␊ |
/**␊ |
|
{␊ |
␊ |
if ($this->con_id) {␊ |
return mysql_errno($this->con_id).' - '␊ |
.mysql_error($this->con_id).' - '.$this->lastquery;␊ |
return mysqli_errno($this->con_id).' - '␊ |
.mysqli_error($this->con_id).' - '.$this->lastquery;␊ |
} else {␊ |
return mysql_errno().' - '␊ |
.mysql_error().' - '.$this->lastquery;␊ |
return mysqli_errno($this->con_id).' - '␊ |
.mysqli_error($this->con_id).' - '.$this->lastquery;␊ |
}␊ |
}␊ |
␊ |
function esc($str)␊ |
{␊ |
return '\''.mysql_real_escape_string($str, $this->con_id).'\'';␊ |
return '\''.mysqli_real_escape_string($this->con_id, $str).'\'';␊ |
}␊ |
␊ |
/**␊ |
|
␊ |
}␊ |
␊ |
␊ |