我在使用 PDO 将位值保存到我的 PostgreSQL-DB 时遇到了一些麻烦。每当位(布尔)为假时,我都会收到此错误
Warning: PDOStatement::execute(): SQLSTATE[22026]: String data, length mismatch: 7
ERROR: bit string length 0 does not match type bit(1) in /var/www/html/application/models/Database.php on line 75
代码显示起来有点复杂,但这是 DB 类的内容。
UPDATE users SET name=:name,email=:email,address=:address,zip=:zip,joindate=:joindate,phone=:phone,password=:password,activationcode=:activationcode,birthdate=:birthdate,lastdigits=:lastdigits,driverlicense=:driverlicense,e_presentation=:e_presentation,e_showphone=:e_showphone,e_showaddress=:e_showaddress,e_radius=:e_radius,e_showinsearch=:e_showinsearch,w_presentation=:w_presentation,w_showphone=:w_showphone,w_showaddress=:w_showaddress,w_radius=:w_radius,w_showinsearch=:w_showinsearch WHERE id=:id
以及绑定到参数的数据
Array ( [:name] => My Name [:email] => myemail@gmail.com [:address] => My Address [:zip] => 79133 [:joindate] => 2012-09-18 12:39:56.769584 [:phone] => 073 917 13 97 [:password] => c6d18ac44b378ff3cecf09d9ebec31ad301c4394d7e1sdfjksc81cd3fbf47777f8df0ac9f33d14da18d71b76fc9c3e1210cb2efcabf6ed66f779d [:activationcode] => [:birthdate] => 1993-08-05 [:lastdigits] => 5079 [:driverlicense] => 0 [:e_presentation] => Test [:e_showphone] => 1 [:e_showaddress] => 1 [:e_radius] => 10 [:e_showinsearch] => 1 [:w_presentation] => Test [:w_showphone] => 1 [:w_showaddress] => 1 [:w_radius] => 10 [:w_showinsearch] => 1 [:id] => 28 ) 1
快速的谷歌搜索显示其他人也有同样的问题,但没有解决方案。