martes, 5 de enero de 2010

A little bug fix for ADOdb (php) for MySQL

Hi!

I'm using ADOdb to connect to more than one MySQL db at the same time but then i noticed that queries where being done on the last DB connection that was established. After researching for a while, i ended up modifying MySQL driver of ADOdb. It's a rather simple trick, so be free to use it as needed:

On adodb-mysql.inc.php, go to the definition of _query($sql, $inputarr=false) and change it to:

@mysql_select_db($this->database, $this->_connectionID);
return mysql_query($sql,$this->_connectionID);

That should do. By the way, I've only tested it connecting to a single mysql server (with two different DBs, obviously) but I think it should work with multiple DB servers as well. Also, It works like a charm when doing ->Execute() so it could be necessary to add that mysql_select in other places so that it worked with other functions that deal with the DB, but Execute() is enough for what I need so....

I did this patch on flisys, and I'll upload it in the following days.

1 comentario:

  1. Este comentario ha sido eliminado por un administrador del blog.

    ResponderEliminar