pluf2

pluf2 Commit Details


Date:2015-07-05 10:31:42 (9 years 5 months ago)
Author:Natalie Adams
Branch:master
Commit:cd2fa3748aa4ed1619dfdb98cc59b6d45e30d396
Parents: b1fed2e6d592d18527cfff6e78a5e14058708173
Message:Updating MySQL backend to use MySQLi library

Changes:

File differences

src/Pluf/DB/MySQL.php
3939
4040
4141
42
42
4343
4444
4545
......
5151
5252
5353
54
54
5555
5656
5757
......
6666
6767
6868
69
69
7070
7171
7272
......
9090
9191
9292
93
93
9494
9595
9696
......
100100
101101
102102
103
103
104104
105105
106
106
107107
108108
109
109
110110
111111
112112
......
116116
117117
118118
119
119
120120
121121
122122
......
127127
128128
129129
130
130
131131
132132
133133
......
139139
140140
141141
142
143
142
143
144144
145
146
145
146
147147
148148
149149
150150
151151
152
152
153153
154154
155155
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().' - '
.mysqli_error().' - '.$this->lastquery;
}
}
function esc($str)
{
return '\''.mysql_real_escape_string($str, $this->con_id).'\'';
return '\''.mysqli_real_escape_string($this->con_id, $str).'\'';
}
/**

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05448s using 14 queries.