Friday, April 20, 2007

Guess what...Wordpress does not like InnoDB + autocommit=off either

In my previous entry I wrote how to fix Wordpress so it can avoid a possible too restrictive default SQL_MODE. I guess I should have realized that the following two lines from my my.cnf option file would probably not be liked by Wordpress either:

default-storage-engine=InnoDB #Set the default storage engine (table type) for tables.
init-connect="set autocommit=0" #set autocommit off on connect

So, I went back and hacked wp-includes/wp-db.php again. Now the fix read:

// fix sql_mode
mysql_query("SET SESSION SQL_MODE := ''",$this->dbh);
mysql_query("SET SESSION AUTOCOMMIT=ON",$this->dbh);
// end fix sql_mode

Let's hope this was the last one ....

2 comments:

ymg said...

Roland, Did you file your patches in Wordpress's trac bug system

http://trac.wordpress.org/

As Yoda says, "If in trac, your bug is not. Then a bug it is not. Hrrm!"

rpbouman said...

Hi Yusuf,

actually, I tried to file a bug, but somehow I could not log in...Probably due to me - it was really late at night for me....

I'd like to contribute the patch if you can call it that. However, I think a check should be added to figure out whether the MySQL server actually supports sql_mode. My fix just blindly assumes it does and might not go down well with older MySQL servers.

If you can help me get going with contributing the patches, I'd appreciate your help.

Cheers,

Roland

DuckDB Bag of Tricks: Reading JSON, Data Type Detection, and Query Performance

DuckDB bag of tricks is the banner I use on this blog to post my tips and tricks about DuckDB . This post is about a particular challenge...