Subject | FBDatabaseMetaData and underscores |
---|---|
Author | llafranc78 |
Post date | 2002-06-05T14:16:21Z |
Hi :))
I just encountered a real problem...
In my db I've got many (MANY) tables whose names contain underscores (i.e
MODEL_HEAD). Now, if I use FBDatabaseMetaData.getColumns() on such
tables, If I'm lucky (read: "If the table name is SHORT enough"), I
get the right ResultSet, otherwise I get following Exception:
java.sql.DataTruncation: Data truncation
at org.firebirdsql.jdbc.FBStringField.setString(FBStringField.java:275)
at
org.firebirdsql.jdbc.FBPreparedStatement.setString(FBPreparedStatement.java:253)
at org.firebirdsql.jdbc.FBConnection.doQuery(FBConnection.java:1011)
at
org.firebirdsql.jdbc.FBDatabaseMetaData.getColumns(FBDatabaseMetaData.java:2242)
The problem is that underscores are treated as wildcards, and so the
call to "Clause tableClause = new Clause("RF.RDB$RELATION_NAME",
tableNamePattern);" (line 2227) adds SPACES (that's 31 spaces...) plus
"%" to the table name, thus causing it's length to increase, and in
some cases this causes the Exception.
This is really bothering me, because I cannot change the table names,
and I really didn't think of underscores as wildcards. And ironically,
a few Firebird system tables contain underscores in their names...
Shall I blame myself or is this a bug?
TIA :)
Ciao
Luca
I just encountered a real problem...
In my db I've got many (MANY) tables whose names contain underscores (i.e
MODEL_HEAD). Now, if I use FBDatabaseMetaData.getColumns() on such
tables, If I'm lucky (read: "If the table name is SHORT enough"), I
get the right ResultSet, otherwise I get following Exception:
java.sql.DataTruncation: Data truncation
at org.firebirdsql.jdbc.FBStringField.setString(FBStringField.java:275)
at
org.firebirdsql.jdbc.FBPreparedStatement.setString(FBPreparedStatement.java:253)
at org.firebirdsql.jdbc.FBConnection.doQuery(FBConnection.java:1011)
at
org.firebirdsql.jdbc.FBDatabaseMetaData.getColumns(FBDatabaseMetaData.java:2242)
The problem is that underscores are treated as wildcards, and so the
call to "Clause tableClause = new Clause("RF.RDB$RELATION_NAME",
tableNamePattern);" (line 2227) adds SPACES (that's 31 spaces...) plus
"%" to the table name, thus causing it's length to increase, and in
some cases this causes the Exception.
This is really bothering me, because I cannot change the table names,
and I really didn't think of underscores as wildcards. And ironically,
a few Firebird system tables contain underscores in their names...
Shall I blame myself or is this a bug?
TIA :)
Ciao
Luca