IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Noticed that before
And it's MySQL not PHP. When you add a field, even if it's defined "not null", it seems to default to NULL. All you have to do is pick a default value and do
UPDATE table SET new_field = 'default_value'
and they'll all be set.

One thing when pulling MySQL values into PHP, if you fetch the results into an array and do
if( $results['new_field'] ){ ... }
you won't get anything for null or empty values. But the query in MySQL will return different results if you use
SELECT * WHERE new_field IS NULL
and
SELECT * WHERE new_field = ''
===
Microsoft offers them the one thing most business people will pay any price for - the ability to say "we had no choice - everyone's doing it that way." -- [link|http://z.iwethey.org/forums/render/content/show?contentid=38978|Andrew Grygus]
New 'default value' must be non-null it appears
All you have to do is pick a default value and do
UPDATE table SET new_field = 'default_value'
and they'll all be set.


I tried that with null, and it did not solve the problem. What did seem to work is to set them all to a non-null value, and then back to null (if that is the default).

It is as if something mistakes lack of a column for null, and it only puts in an explicit null and/or cell if you set stuff to a non-null value first. IOW, setting to a non-null value will "properly" initialize it.

I thot that such oddity only came from MS products :-)

BTW, I think Chris Date's group hates nulls as much as I do. It is nice to know that somebody with credibility shares my opinions. (I could use a non-null default value, but such tends to ruin portability if you forget to keep an eye on it, in my experience.)
________________
oop.ismad.com
     MySQL and new fields - (tablizer) - (3)
         Sounds like you have to do it the old-fashioned way: - (CRConrad)
         Noticed that before - (drewk) - (1)
             'default value' must be non-null it appears - (tablizer)

The universe is 98 percent hydrogen and helium... and I'm rather fond of the other 2 percent.
68 ms