Re: some DB::quote() options?
| From: | Analysis & Solutions | Date: | Thu, 30 Oct 2003 16:05:43 +0000 |
| Subject: | Re: some DB::quote() options? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-23144@lists.php.net to get a copy of this message | ||
Hi:
On Thu, Oct 30, 2003 at 09:09:32AM +0100, Lukas Smith wrote:
> > From: Analysis & Solutions [mailto:danielc@analysisandsolutions.com]
> > Sent: Thursday, October 30, 2003 2:07 AM
>
> > 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.
True. But if the field is NOT NULL then folks will run into problems.
Hmm... I was thinking about cases where the field is char(), but what
about numeric fields... I guess that's when the second parameter I'm
proposing, $type, comes in to return 0 instead of ''.
> > 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?
Yes, pardon me.
> 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)
By LOB you mean things like BLOB? I haven't seen the quote() functions
doing anything differently for them.
> 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 ...
Thanks. I'd rather stick with DB at this point.
Enjoy,
--Dan
--
FREE scripts that make web and database programming easier
http://www.analysisandsolutions.com/software/
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7th Ave #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409