Re: MySQL, PHP or ghost?
| From: | Peter Beckman | Date: | Wed, 27 Aug 2003 14:25:49 +0000 |
| Subject: | Re: MySQL, PHP or ghost? | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-30120@lists.php.net to get a copy of this message | ||
On Wed, 27 Aug 2003, David T-G wrote:
> Looks like it, though I admit that the manual doesn't adequately explain
> your results. Check out section 6.2.2.4 for details.
I did; see my previous (moments ago) email on my read on that manual
section.
> % So my assumption is that if I insert with year="" it should use the
> % default. Or at least 0000.
>
> That makes sense. And so what is the default? Looks like it is, for
> some reason, 2000. [This isn't a TIMESTAMP field, so we don't
> necessarily expect it to be "this year".]
The default at the time was 0000.
After I saw the problem I changed it to the below, but that didn't solve
the problem:
| year | year(4) | YES | | NULL |
Before the change it was:
| year | year(4) | NO | | 0000 |
> Looks like it's standard mysql behavior:
But that's what I'm questioning. Should it be that way? If so, the
manual page for YEAR should be altered. If it shouldn't work that way, it
should be submitted as a bug.
> Note that I sometimes get warnings and sometimes don't. I haven't dug
> into them, though.
Hmmm. Unfortunately I can't use "show warnings" to show the warnings
since I don't have 4.1.0, I have 3.23.49. I can't find the manual on the
MySQL site for 3.23.49, just 4.1.1. I've checked the .err file in my
/var/db/mysql directory but no avail on the warning. Obviously I
shouldn't be using year="", and I've since stopped. However, I do want to
learn what is going on and why when given an empty quoted string MySQL
translates that to 2000 versus the default value (if not null, 0000; if
null, NULL).
Beckman
---------------------------------------------------------------------------
Peter Beckman Internet Guy
beckman@purplecow.com http://www.purplecow.com/
---------------------------------------------------------------------------