[CDO] Database mapping: explicitly specify nullable columns [message #1855834] |
Mon, 07 November 2022 09:20 |
Robert Schulk Messages: 142 Registered: July 2015 |
Senior Member |
|
|
I found this issue for nullable EDate attributes in a mysql database.
In mysql, the first(!) column of type "timestamp" will get the default value "current time", if the column is not explicitly declared as nullable. This can lead to very strange effects in CDO, because first the value seems to be set correctly (to null), but once the value is read again from the database, the value changes to some timestamp.
Potentially, the fix is quite simple. In DBAdapter.java, line 965, instead of using an empty string for nullable fields, we should return "NULL" instead.
protected String createFieldDefinition(IDBField field)
{
return getTypeName(field) + (field.isNotNull() ? " NOT NULL" : ""); //$NON-NLS-1$ //$NON-NLS-2$
}
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01823 seconds