I'm refactoring the code, from mysql
extension to pdo's
. Existing db
schema is such way that for almost all columns in 100 pulse tables are having NOT NULL
constraint. Due to this constraint I'm very often facing following error while inserting
and updating
the data.
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'some-column-name' cannot be null
Obligations:
- Its not possible to change db schema i,e removing NOT NULL constraint.
- Its difficult to check whether value is null or not before inserting for each and every column.
So I'm looking for a generic solution where empty string is inserted instead of NULL
that will be addressed for all PDO
statements. I'm using this PDO
helper class.