Re: DB, prepare() and NULL values
| From: | Justin Patrin | Date: | Mon, 03 Apr 2006 18:00:51 +0000 |
| Subject: | Re: DB, prepare() and NULL values | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-23524@lists.php.net to get a copy of this message | ||
On 4/3/06, Chris Boget <chris.boget@wild.net> wrote:
> > As a workaround....try not preparing fields which need to be set to
> > NULL perhaps?
>
First off, look into the portability options, although if you've
checked the code and not found what you want it may not exist in DB.
(DB_DataObject also has "problems" when it comes to null.)
> I'm not sure I follow. So the suggested work around would include 2
> queries? One that is prepare()'d/execute()'d that do not contain those
> fields that can have a NULL value and a second query where I do that
> manually? If that's not what you meant, could you expand on your comment a
> little?
>
No, I'm saying don't use prepare at all or don't prepare those
specific fields. Just put their values right in the SQL (of course
this would require a prepare per-record, you wouldn't be able to
execute the same prepared statement multiple times).
> > Oh, and I also suggest looking into MDB2, perhaps it can do what you want.
>
> I'll look into it. Though, I'd be somewhat reticent to switch as it would
> require a fair bit of regression testing to make sure nothing undue arose as
> a result.
>
MDB2 is the suggested PEAR DB abstraction layer now that it is stable.
It's far more fully featured than DB and is faster in many cases.
--
Justin Patrin