srchub

srchub Commit Details


Date:2015-10-08 22:24:58 (9 years 2 months ago)
Author:Natalie Adams
Branch:master
Commit:e130ec13e2c5cfd1ae574b0f504baf37539c2f0e
Parents: f6d8604dc91a8490c206ee93f31cc0b02fcf5859
Message:Issue 107: Upgrade MySQL pluf library to use MySQLi

Changes:

File differences

pluf/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
......
200200
201201
202202
203
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).'\'';
}
/**
}

Archive Download the corresponding diff file

Branches

Number of commits:
Page rendered in 0.05648s using 20 queries.