Subject | FBDatabaseMetaData.getColumns returns DEFAULT_SOURCE instead of DEFAULT_VALUE |
---|---|
Author | sp64_asaon |
Post date | 2003-09-04T08:41:21Z |
Hello Blas,
Recently I had problems during a database update, which among others
had to rename a table. The table renaming creates a new table with
the same meta data as the original. This operation failed because in
the generated DDL statement the DEFAULT clause was incorrect:
...
FIELD_X SMALLINT DEFAULT DEFAULT 0 NOT NULL,
...
Investigating I came accross your changes in revision 1.16 on June
4, in which you implemented the COLUMN_DEF support. You simply use
the content of RDB$RELATION_FIELDS.RDB$DEFAULT_SOURCE. But according
to the specs you should return the default value and not the source
of the ddl statement. For now I use the following temporary
workaround:
...
String defValue = rs.getString("COLUMN_DEF");
if (defValue != null && defValue.startsWith("DEFAULT "))
defValue = defValue.substring(8);
...
But I think it would be better to implement it directly in the
driver so it will conform to the specs.
Best regards,
Stephan
Recently I had problems during a database update, which among others
had to rename a table. The table renaming creates a new table with
the same meta data as the original. This operation failed because in
the generated DDL statement the DEFAULT clause was incorrect:
...
FIELD_X SMALLINT DEFAULT DEFAULT 0 NOT NULL,
...
Investigating I came accross your changes in revision 1.16 on June
4, in which you implemented the COLUMN_DEF support. You simply use
the content of RDB$RELATION_FIELDS.RDB$DEFAULT_SOURCE. But according
to the specs you should return the default value and not the source
of the ddl statement. For now I use the following temporary
workaround:
...
String defValue = rs.getString("COLUMN_DEF");
if (defValue != null && defValue.startsWith("DEFAULT "))
defValue = defValue.substring(8);
...
But I think it would be better to implement it directly in the
driver so it will conform to the specs.
Best regards,
Stephan