Oracle compatibility

You need to be logged in to post messages in the forums. New users may register here.

Gaetano Giunta

Member since:
09 January 2008

Posts: 152

Friday 29 August 2008 3:30:03 am

While trying to move an existing eZP 4.0.0 install from mysql to oracle, I had errors in the ezsurvey, ezsurveymetadata and ezsurveyquestionmetadata tables.

The problem is that there are columns defined as 'not null' in those tables, but by default rows inserted there contain the empty string (aka. '') for those cols. Since for Oracle the empty string and NULL are the same thing, an error is thrown when trying to insert the data.

There are many ways to solve this problem:

- remove the NOT NULL definition on those columns in mysql. Then the table definition imported from mysql into oracle will be fine.
This has the potential side effect of breaking queries later if a NULL value is inserted there (eg queries where the field is tested like this: mycolumn != 'value'). If null is never inserted anyway, there is no risk

- remove the NOT NULL definition on those columns in oracle. For other db tables, this is done by a blacklist of table fields that have to drop the "not null" constraint, inside the ezoracle extension. The list is read by the script that creates the oracle db form scratch and by the one that copies an existing mysql db over.
This has the potential side effect of breaking queries later on oracle if a '' value is inserted there (which is a guaranteed event), if a query such as the one outline above is used.

The second solution is maybe easier to implement without breaking compatibility between ezsurvey versions: you should add in the extension a dbschema.ini.append.php file, with the following section:

[oracle]
ColumnOptionTranslations[tablename1.columname1]=null
ColumnOptionTranslations[tablename2.columname2]=null
...

This file is read then by the scripts in the ezoracle extension, and all should be fine
Up

You need to be logged in to post messages in the forums. New users may register here.