Skip to content

Commit 1049dd3

Browse files
author
modbot
committed
Update 2.2.1
Force disable emulated prepared statements.
1 parent 306969c commit 1049dd3

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Database.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public function connect($data=null,$pass=null,$user=null,$host=null,$type=null)
4040
try {
4141
$this->pdo = new PDO($this->type.':host='.$this->host.';dbname='.$this->dbname, $this->user, $this->pass);
4242
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
43+
$this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
4344
} catch(PDOException $e) {
4445
echo 'ERROR: ' . $e->getMessage();
4546
}
@@ -48,6 +49,7 @@ public function connect($data=null,$pass=null,$user=null,$host=null,$type=null)
4849
public function setPdo($obj)
4950
{
5051
$this->pdo = $obj;
52+
$this->pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);
5153
}
5254
public function getPdo()
5355
{
@@ -108,7 +110,6 @@ public function insert_id()
108110
$id = $this->pdo->lastInsertId();
109111
return $id;
110112
}
111-
112113
public function insert($table, $data)
113114
{
114115
$keys = ""; $values = "";
@@ -121,7 +122,6 @@ public function insert($table, $data)
121122
$statement = "INSERT INTO $table ($keys) VALUES ($values)";
122123
$this->query($statement);
123124
}
124-
125125
public function update($table, $data)
126126
{
127127
$values = "";
@@ -131,7 +131,6 @@ public function update($table, $data)
131131
$statement = "UPDATE $table SET $values";
132132
$this->query($statement);
133133
}
134-
135134
public function store($table, $match='id', $data)
136135
{
137136
$query = $this->query("SELECT $match FROM $table WHERE $match = ".$this->quote($data['url']));
@@ -141,7 +140,6 @@ public function store($table, $match='id', $data)
141140
$this->update($table, $data);
142141
}
143142
}
144-
145143
public function walk_recursive($obj, $closure)
146144
{
147145
if ( is_object($obj) )

0 commit comments

Comments
 (0)