Wednesday, March 12, 2008


So, I just fixed a behavior in PEAR::DB. In isManip, a regular expression is called on every query that goes through the PEAR::DB layer. That sucks btw, but the purpose of function is to tell the classes that inherit from DB that the query passed is a query that affects data.

The code is as follows

function isManip($query)
if (preg_match('/^\s*"?(' . $manips . ')\s+/i', $query)) {
return true;
return false;

Then in mysql.php there is this

function affectedRows()
if ($this->_last_query_manip) {
return @mysql_affected_rows($this->connection);
} else {
return 0;

Which is not ideal IMHO. I changed mysql.php to just return the results of mysql_affected_rows which is better anyway IMHO.

What DB wrapper do you use? What do you think about PDO?

Personally I like to write my own, bare bone wrappers around mysql_* functions for php but to make things compatible I'm using PEAR::DB.


Andre Medeiros said...

I've actually switched from the native mysql function calls to PDO, and I couldn't be happier. Besides being object-oriented, you can configure it in a way that it throws exceptions and it's a hell of a lot faster.

If you'd like to discuss it further, my msn contact is afmedeiros [at] eda [dot] pt

mike said...

I use my own barebones one as well. A few generic db_XXX() functions. Supports multiple datasources, defaults to utf-8, in use on a lot of projects now spread over personal, corporate and freelance projects. I might "open source" it at some point as part of a mini "framework" of sorts.

Anonymous said...

This DB::isManip() is just broken by design. MDB2 does not rely on it and DB has been deprecated in favor of MDB2 since quite some time now. said...

Do you do mysql consulting in the bay area?

650.796.4810 said...

oops. i didn't think comments would auto-publish - can you remove my last one :) i don't want my phone number out there...

Anonymous said...



A片,色情,成人,做愛,情色文學,A片下載,色情遊戲,色情影片,色情聊天室,情色電影,免費視訊,免費視訊聊天,免費視訊聊天室,一葉情貼圖片區,情色,情色視訊,免費成人影片,視訊交友,視訊聊天,視訊聊天室,言情小說,愛情小說,AIO,AV片,A漫,av dvd,聊天室,自拍,情色論壇,視訊美女,AV成人網,色情A片,SEX