Re: DataObject tweak ok with DB and MDB2

From: Date: Thu, 07 Apr 2005 03:54:55 +0000
Subject: Re: DataObject tweak ok with DB and MDB2
References: 1 2 3  Groups: php.pear.general php.pear.general 
Request: Send a blank email to pear-general+get-18584@lists.php.net to get a copy of this message
Eak, finally get a chance to look through a patch ;) Things spotted, that may have been discussed later in this huge thread.. - setLimit() on the DB object worries me as it may affect later queries being sent to the DB.. (or at least I would define that as unpredictable behaviour..) - should MDB sort out it's emulation of this? - are DB_FETCHMODE_ASSOC and MDB2_FETCHMODE_ASSOC really different? - MDB2 should really implement smartQuote to emulate DB, it's a pretty simple function. - layout around connect needs tidying up a bit: $args = array($dsn); if ($db_options) { $args[] = $db_options; } $DB_....connections..... = call_user_func_array( array(....,connect) $args);; Regards Alan On Wed, 2005-04-06 at 07:35 +1000, Dan Rossi wrote: > On 06/04/2005, at 4:07 AM, Justin Patrin wrote: > > >> > > > > 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 > > > > > > 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) { > $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. > > >

« previous php.pear.general (#18584) next »