On Sun, Apr 19, 2009 at 5:35 PM, Michael Nacos <[email protected]> wrote:
> Hi everyone > > thanks for the quick tips in IRC (DEBUG and DEBUG_ARGS). All the foreach > warnings magically disappeared with an (array) cast, and I have managed to > solve an "Indetermineable data type" issue in prepared statements by > changing all (2) instances of > > $pdo->prepare( $query ) > > to > > $pdo->prepare( $query, array(PDO::ATTR_EMULATE_PREPARES => true) ) > > in *system/classes/databaseconnection.php > * > [is this something you'd be willing to consider? it basically prepares > statements at the pdo side, not the db server side, fixing incompatibilities > when preparing statements for different dbms targets. please have a look at > these links: > > http://drupal.org/node/354139 > > http://www.semicomplete.com/blog/geekery/mysql-prepare-queries-not-cached.html > We set this on connect for MySQL in system/schema/mysql/connection.php (although I don't remember why, since MySQL shouldn't have this kind of problem). We should probably add that for Postgres as well. > > Now, the only thing that remains to be fixed for the admin pages when using > Postgresql seems to be the following error: > > Warning: PDOStatement::execute() [pdostatement.execute]: SQLSTATE[42804]: > Datatype mismatch: 7 ERROR: argument of AND must be type boolean, not type > integer in system/classes/databaseconnection.php line 288 > > system/classes/databaseconnection.php line 288: > PDOStatement->execute(array ( > 0 => 1, > 1 => 2, > 2 => 1, > )) > system/classes/databaseconnection.php line 535: > DatabaseConnection->query(' > * SELECT DISTINCT COUNT(1) > FROM {posts} WHERE ( ({posts}.status = ? AND {posts}.content_type = ? > AND {posts}.user_id = ?) ) AND ( > (1) > ) LIMIT 5*', array ( > 0 => 1, > 1 => 2, > 2 => 1, > )) > system/classes/db.php line 293: > DatabaseConnection->get_value(' > SELECT DISTINCT COUNT(1) > FROM {posts} WHERE ( ({posts}.status = ? AND {posts}.content_type = ? > AND {posts}.user_id = ?) ) AND ( > (1) > ) LIMIT 5', array ( > 0 => 1, > 1 => 2, > 2 => 1, > )) > system/classes/posts.php line 573: > DB::get_value(' > SELECT DISTINCT COUNT(1) > FROM {posts} WHERE ( ({posts}.status = ? AND {posts}.content_type = ? > AND {posts}.user_id = ?) ) AND ( > (1) > ) LIMIT 5', array ( > 0 => 1, > 1 => 2, > 2 => 1, > ), 'Post') > system/classes/adminhandler.php line 397: > Posts::get(array ( > 'count' => 1, > 'content_type' => 2, > 'status' => 1, > 'user_id' => 1, > )) > system/classes/adminhandler.php line 125: > AdminHandler->get_dashboard() > system/classes/actionhandler.php line 68: > AdminHandler->act_admin() > system/classes/controller.php line 171: > ActionHandler->act('admin') > index.php line 240: > Controller::dispatch_request() > > > ints need to be cast to boolean if you intend to use them this way... What > does that *(1)* do there, anyway? > I'll have another look tomorrow. Is the problem with COUNT(1), or AND (1)? I'm assuming the latter. Is it supposed to be AND (1=1)? I know several places we do that when we're putting together WHERE clauses in pieces so the array containing pieces always has at least one element... All of this is surprising. Neither problem seems to have anything to do with ACL and would seem to have been an issue previously as well. Those are the only issues you've run into with trunk on Postgres? Are you sure the schema got created correctly? Have you tried an upgrade from 0.5 to 0.6/trunk? --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/habari-dev -~----------~----~----~----~------~----~------~--~---
