techniques for Inserting DB NULL values (PDO is what i use now for "all" DML)

techniques for Inserting DB NULL values (PDO is what i use now for "all" DML)

am 06.09.2007 17:20:06 von GP

I am and have been using PDO for about a year now...and have finally
gotten around to solving the "DB NULL value" issues I ran into early
on...

I am looking for suggestions and techniques to deal with inserting DB
NULL values into my MySQL 5.x DB Tables....I am running PHP 5.2.x on BSD
6.x with Apache 2.2.x....

As mentioned I am writing all my web apps using the PDO extension to
connect and operate on the database. I realized early on that I was
inserting "NULL" not NULL into my tables, but never went to do
anything about it because it wasn't affecting me [enough] at the time...
well.....guess what now it is...and I need to solve it...(ie. Go back and
fix all my DML statements where IS NULL or IS NOT NULL or INSERT...
VALUES (NULL) might show up....change all my PDOStatment::bindParam()
calls appropriately or as needed ....write a php function to change
"NULL" to NULL where allowed.)

Aside from updating all records where fieldname = "NULL" to fieldname
= NULL.... I am specifically curious to know how PDO::PARAM_NULL works
in SP's... do I need to catch all values "NULL" and replace them with
something else...like I said earlier..." I am looking for suggestions and
techniques to deal with inserting DB NULL values into my MySQL 5.x DB
Tables..." using PHP 5.2 and when possible the PDO extention.

Thank you,
Max