Compare commits

..

No commits in common. "7f8780d32824df199fad5bafbedc84f1fd7da345" and "fab70aec6a11cbf1c2c0449fa1f81882cabdb93f" have entirely different histories.

View File

@ -29,7 +29,7 @@ class PdoObject extends PDO {
return $statement; return $statement;
} }
} }
catch (\Throwable $e) { catch (\PDOException $e) {
throw new \PdoException($e->getMessage() . " `$sql` with data:" . json_encode($parameters)); throw new \PdoException($e->getMessage() . " `$sql` with data:" . json_encode($parameters));
} }
} }
@ -50,7 +50,7 @@ class PdoObject extends PDO {
return $this->execute($statement, $parameters, true); return $this->execute($statement, $parameters, true);
} }
} }
catch (\Throwable $e) { catch (\PDOException $e) {
throw new \PdoException($e->getMessage() . " `$sql` with data:" . json_encode($parameters)); throw new \PdoException($e->getMessage() . " `$sql` with data:" . json_encode($parameters));
} }
@ -82,27 +82,7 @@ class PdoObject extends PDO {
$this->beginTransaction(); $this->beginTransaction();
} }
foreach($parameters as $key => $value) { $this->executionStatus = empty($parameters) ? $statement->execute() : $statement->execute($parameters);
switch(strtolower(gettype($value))) {
case "boolean":
$statement->bindValue($key, $value, Pdo::PARAM_BOOL);
break;
case "integer":
$statement->bindValue($key, $value, Pdo::PARAM_INT);
break;
case "null":
$statement->bindValue($key, $value, Pdo::PARAM_NULL);
break;
case "string":
default:
$statement->bindValue($key, (string) $value, Pdo::PARAM_STR);
}
}
$this->executionStatus = $statement->execute();
if ( $this->executionStatus ) { if ( $this->executionStatus ) {
$this->lastInsertId = $this->lastInsertId(); $this->lastInsertId = $this->lastInsertId();