|
@@ -94,13 +94,18 @@
|
|
}
|
|
}
|
|
public function exec(string $statement){
|
|
public function exec(string $statement){
|
|
$query = $this->prepare($statement);
|
|
$query = $this->prepare($statement);
|
|
- $count = 0;
|
|
|
|
$query->execute();
|
|
$query->execute();
|
|
|
|
+ $count = 0;
|
|
while($query->fetch() !== false){
|
|
while($query->fetch() !== false){
|
|
$count++;
|
|
$count++;
|
|
}
|
|
}
|
|
- if($count == 0){
|
|
|
|
- $count = $query->rowCount();
|
|
|
|
|
|
+ if($count === 0){
|
|
|
|
+ $query2 = $this->query("select ROW_COUNT()");
|
|
|
|
+ $count = $query2->fetchColumn();
|
|
|
|
+ $query2->closeCursor();
|
|
|
|
+ if($count === 0){
|
|
|
|
+ $count = $query->rowCount();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
$query->closeCursor();
|
|
$query->closeCursor();
|
|
return $count;
|
|
return $count;
|
|
@@ -139,7 +144,13 @@
|
|
return $this->pdo->getAttribute(...$args);
|
|
return $this->pdo->getAttribute(...$args);
|
|
}
|
|
}
|
|
public function lastInsertId(...$args){
|
|
public function lastInsertId(...$args){
|
|
- return $this->pdo->lastInsertId(...$args);
|
|
|
|
|
|
+ $id = $this->pdo->lastInsertId(...$args);
|
|
|
|
+ if($id === 0){
|
|
|
|
+ $query = $this->pdo->query("select LAST_INSERT_ID()");
|
|
|
|
+ $id = $query->fetchColumn();
|
|
|
|
+ $query->closeCursor();
|
|
|
|
+ }
|
|
|
|
+ return $id;
|
|
}
|
|
}
|
|
public function getError(){
|
|
public function getError(){
|
|
$error = $this->pdo->errorInfo();
|
|
$error = $this->pdo->errorInfo();
|