Re: [Fwd: Re: [PEAR] DataObject tweak ok with DB and MDB2]
| From: | Justin Patrin | Date: | Wed, 06 Apr 2005 16:31:07 +0000 |
| Subject: | Re: [Fwd: Re: [PEAR] DataObject tweak ok with DB and MDB2] | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-18547@lists.php.net to get a copy of this message | ||
On Apr 5, 2005 8:13 PM, Dan Rossi <pear@electroteque.org> wrote:
> i tried sending this before
>
> Begin forwarded message:
>
> > From: Pear List <pear@electroteque.org>
> > Date: 6 April 2005 9:58:57 AM
> > To: <pear@electroteque.org>
> > Subject: [Fwd: Re: [PEAR] DataObject tweak ok with DB and MDB2]
> >
> > -------- Original Message --------
> > Subject: Re: [PEAR] DataObject tweak ok with DB and MDB2
> > From: <pear@electroteque.org>
> > Date: Wed, April 6, 2005 9:55 am
> > To: <pear-general@lists.php.net >
> >
> >> On Apr 5, 2005 2:35 PM, Dan Rossi <pear@electroteque.org> wrote:
> >>>
> >>> On 06/04/2005, at 4:07 AM, Justin Patrin wrote:
> >
> >
> >> If we cast it twice I don't think that's a problem. IMHO it's better
> >> to
> >> have leff ifs in the code for the different DBs.
> >>
> >
> > Ok no problem.
> >
> >
> >>
> >> Not sure what you're asking here. I've never used db_options,
> >> honestly. You're right, though, if it's currently just db_options you
> >> shouldn't be changing it to a nested array.
> >
> > Ok db_options is most important for MDB2, it sends the portability
> > option
> > which lowercases yourfields, i use uppercase ID for keys ie fieldID
> > which
> > breaks having this option on so i need to turn itoff, what is the best
> > way to collect db_options then ? initially its calling it from DB
> > directly, but howdoes DB collect options coz it doesnt , therefore
> > db_options was null. What is the best way to dothis then ? Here is my
> > xml
> > settings
> >
> > <DB_DataObject>
> > <database></database>
> > <schema_location>/www_tools/apache/htdocs/complaints/classes/
> > DataObjects/</
> > schema_location>
> > <class_location>/www_tools/apache/htdocs/complaints/classes/
> > DataObjects/</
> > class_location>
> > <require_prefix>DataObjects/</require_prefix>
> > <class_prefix>DataObjects_</class_prefix>
> > <database_complaints></
> > database_complaints>
> > <ignore_sequence_keys></ignore_sequence_keys>
> > <extends_location></extends_location>
> > <extends></extends>
> > <proxy>full</proxy>
> > <generator_class_rewrite></generator_class_rewrite>
> > <debug>0</debug>
> > <debug_force_updates>0</debug_force_updates>
> > <production>0</production>
> > <db_driver>MDB2</db_driver>
> > <MDB2>
> > <portability>0</portability>
> > <persistent>true</persistent>
> > </MDB2>
> > </DB_DataObject>
> >
Well...I think the thing you think did nothing actually did something.
$db_options = PEAR::getStaticProperty($driver,'options');
This gets the options set for the driver. So to set these for DB you
do the same kind of thing you're already doing for DB_DO.
$config =& PEAR::getStaticProperty('DB', 'options');
$config = array('someOption' => 'someValue', 'etc' =>
'etc');
And then you start using DB_DO and it should pull the options for DB.
You should be able to do the same for MDB2 as DB_DO will still pull
the options. Uncomment that line again and switch to using it unstead
of the config array in the DB_DO global.
> >
> >>
> >> Well...yes, it should be more efficient, and it's also just a better
> >> check. It's better for us to if/switch on the option than to check the
> >> object to see if it has a method.
> >>
> >
> > Ok i had initially done config checks, but though the other way was
> > faster :)
I think a quick == on an array value is probably faster than a method
check. It's also just more correct.
> >
> >
> >>
> >> The source file I put up is the full source of my changed version (all
> >> of my changes to your code are applied). The diff file is mostly for
> >> Alan's benefit so he can see what we changed since his latest CVS
> >> version. You can apply patches with the "patch" utility. ;-) It *may*
> >> not work, though as my filenames are probably off. I mostly use diffs
> >> as a reference anyway.
> >>
> >> But you would need the CVS version of DB_DataObject, not your altered
> >> copy to apply the patch. Better to just grab my source and work from
> >> that.
> >
> > Yeh i am collecting it now, i'll do somemore tweaks and then let you do
> > the patches then, we mayneed Alan to comment on this, I DONT want to
> > shoe
> > in on someone elses project without theirpermission but if it helps
> > everyone great.
I've submitted patched to DB_DO before and if we get this working
properly I would think that Alan wouldn't mind a patch to get this
working.
> > I am fully aware that DB_DataObject will be replaced
> > thewith DBDO extension interfacing with the PDO extension for PHP5, I
> > am
> > also aware that Lukas hasBC
> > broken his MDB2 to be method compliant with PDO but no breakages as
> > yet.
> > I had to move backfrom MDB2_DataObject to DB_DataObject because it
> > became
> > painful to diff and to keep standardnaming conventions.
> >
I understand. I think it would be great to get this in DB_DO.
--
Justin Patrin