You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CREATETABLEtest (
id SERIALPRIMARY KEY,
boolfield Booleannot null,
);
Execute queries
$con = Connection::fromPDO($this->PDO);
$db = new Database($con);
$db->insert(['boolfield'=> true])->into('tree2'); // ok
$db->insert(['boolfield'=> false])->into('tree2'); // type err, because PDO::PARAM_STRING used in the $stmt->execute() pdo method by default.
Get the following errors
Database error.SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for type boolean: \"\" [ INSERT INTO \"test\" (\"boolfield\") VALUES ('') ]
The same bug as in Fluentpdo.
How fix it?
Work correctly with PHP types through PDO methods bindValue or bindParam like this:
$stmt->bindValues(1, $value, PDO::PARAM_BOOL);
The text was updated successfully, but these errors were encountered:
roquie
changed the title
Does not support booleans normally
Does not support types normally
Dec 13, 2018
How to reproduce?
0. Use postgresql
The same bug as in Fluentpdo.
How fix it?
Work correctly with PHP types through PDO methods bindValue or bindParam like this:
The text was updated successfully, but these errors were encountered: