Page 1 of 1

begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 5:51 pm
by onli
The bayes-plugin calls serendipity_db_begin_transaction() when creating the database. When using PDO:sqlite, this leads to an error:

Code: Select all

PHP Fatal error:  Call to a member function beginTransaction() on a non-object in /var/www/include/db/pdo-sqlite.inc.php on line 52
That is this ine:

Code: Select all

function serendipity_db_begin_transaction(){
    $serendipity['dbConn']->beginTransaction();
}
I don't see how $serendipity['dbConn'] could not be initialised at this point. How to fix this?

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 5:58 pm
by Timbalu
how about a global $serendipity; ? :wink:

function serendipity_db_end_transaction($commit){

needs that too!

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 6:30 pm
by onli
That's not my code.
If that is the bug, mysql would have the same bug and the plugin never should've worked.

Edit: Or not. Mysql uses dbquery for calling that command, where global $serendipity is set.

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 6:33 pm
by Timbalu
Indeed!
I think no one did use this ever, thats why nobody complained! :wink:

Give it a try. I bet its the missing global!

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 6:42 pm
by Timbalu
oh yes, sure, not mysql.

It looks generally like a copy & paste error in most of these db files
A quick overview greps postgres, sqlite, pdo-postgres, pdo-sqlite, sqlite3 to be affected!

Edit:
only pdo-postgres and pdo-sqlite

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 6:56 pm
by onli
True, ading global $serendipity fixes the bug.

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 7:03 pm
by Timbalu
Do you want to add this to trunk and 1.6.1, or shall we leave this to Garvin?

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 7:06 pm
by onli
I already commited it to trunk, but i'd prefer not to touch 1.6. Feel free to ;)

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 7:09 pm
by Timbalu
I do not actually know how, thats why I don't like to touch the 1.6 branch too, ...
maybe Grischa can write some more info to the wiki...?! :wink:

Re: begin-transaction in pdo:sqlite

Posted: Sun Feb 05, 2012 7:12 pm
by Timbalu
@Garvin
If this update may spit out the 1.6.1 revision, we should think of backporting at least the token thing too. (And "maybe" 2k11 needs to wait for a soon released Boilerplate 3.0, with updated modernizer etc)