RE: [PEAR-DEV] some DB::quote() options?

From: Date: Thu, 30 Oct 2003 08:09:32 +0000
Subject: RE: [PEAR-DEV] some DB::quote() options?
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-23136@lists.php.net to get a copy of this message
> From: Analysis & Solutions [mailto:danielc@analysisandsolutions.com] > Sent: Thursday, October 30, 2003 2:07 AM > I'd like to propose some ehnancements to the DB::quote() function. Adding > two parameters would be very helpful. > > The first proposal is $null. It's would be optional and default to 'null' > If set to 'notnull' the method would return a blank string instead of > "NULL" This is helpful for fields has been defined as > "char() default '' NOT NULL" IIRC DB should only turn php null's into SQL NULL's and not empty strings. > The second proposal is $type. It would permit users to override PHP's > gettype() determinations. This is helpful for situations like when > someone is submitting a numeric value but it's going into a char() field > in the database. > While on this topic, I'm wondering why the string() method in > DB/common.php puts quotes around everything, regardless of data type. > This isn't "standard." You mean quote? Well in PEAR DB there is only very limited type support. Basically there is only: - stuff that needs to be quoted - stuff that is not touched - stuff that is a LOB (although I don't know how much really is supported) If you need datatype abstraction you may want to look at MDB (which I am the lead author of just as an FYI). There you will find methods to handle dates, LOBs, integer,s float's, boolean ... Regards, Lukas

« previous php.pear.dev (#23136) next »