Re: DataObject tweak ok with DB and MDB2
| From: | Dan Rossi | Date: | Tue, 05 Apr 2005 21:35:41 +0000 |
| Subject: | Re: DataObject tweak ok with DB and MDB2 | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18528@lists.php.net to get a copy of this message | ||
On 06/04/2005, at 4:07 AM, Justin Patrin wrote:
Wow you're a genious, great to have some team work ! There are two issues, now your have moved the quoting to a _quote method you are casting a string to both methods, I might have to check with Luke but I think his quote is already casting as a string ?? B_DATAOBJECT_STR) {I've made some changes to your version. * affectedRows is in the MDB2_Driver_Common class (in MDB2.php) and is overridden by some of the drivers themselves. There shouldn't be any problem calling it directly (except that it may return an error) * You left a require_once 'MDB2/DataObject/Generator.php'; in there. I assume you mean DB/DataObject/Generator...or is the Generator also changed for MDB2? If so, could you post that? * I introduced a new _quote() method which does the logic for checking the DB type and calling the appropriate method * I added a check to make sure that db_driver is set in the options before using it (should this be set already somewhere automatically?) It might be faster to replace the _quote method and the FETCHMOD stuff with options which are set in _connect. This way it would set two more small vars once per connect and use those instead of adding lots of extra ifs in there. Here's the file: http://formbuilder.reversefold.com/DataObject.DB-MDB2.phps and a diff vs. the newest CVS version http://formbuilder.reversefold.com/DataObject.DB-MDB2.diff
$settings .= "$kSql = ". $this->_quote((string) ( ($v & DB_DATAOBJECT_BOOL) ? (int)(bool)$this->$k : $this->$k )) . ' ';Also with the $db_options variable, where does it ever colllect the info from $options ? I moved it to a nested array so might BC break other ppl ?? I have also noticed i missed the modifylimit query in the delete method hehe, i guess i'll do it and post it bak. You changed my checks for method_exists to $GLOBALS['_DB_DATAOBJECT']['CONFIG']['db_driver'] == 'DB' which is more efficient ? How do I run that diff file, or have you already done it ? can you give me pointers on how to run a diff in the future ? OSx has a cool program called file merger but still working out how to use it, eclipse also has file merging features but is painful to use.