Subject | Re: [ib-support] Problem with field length |
---|---|
Author | Helen Borrie |
Post date | 2001-12-11T10:55:36Z |
At 11:09 AM 11-12-01 +0100, you wrote:
insert into test VALUES(_UNICODE_FSS'This text is much too long');
I think this should throw an error, even in 0.9.4.
Helen
>HiJust for interest, try
>
>I have a table where I declare a char(10) field and then in an insert
>statement I insert a string which is to long (maybe 30 chars). Surprisingly
>this works fine. Also when I do a select in isql on this table I am getting
>the whole string and not just the first 10 chars. But if I do a select
>using interclient I am getting an exception:
>
>SQL error code = -303
>arithmetic exception, numeric overflow, or string truncation
>
>Here is the script I am using to reproduce this behavior:
>
> CREATE DATABASE 'db:/dbs/error.gdb'
> DEFAULT CHARACTER SET UNICODE_FSS;
>
> create table test(
> text CHAR(10) <-- this column has 30 bytes
> );
>
> insert into test VALUES('This text is much too long');
insert into test VALUES(_UNICODE_FSS'This text is much too long');
I think this should throw an error, even in 0.9.4.
> Exit;That's a very old beta you have there...I seem to recall that Claudio fixed something in DSQL (a long time ago), so that the length in characters would be read, rather than the length in bytes.
>
>the Java code looks like this:
>
> database.setConnection(new com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:interbase://db/dbs/error.gdb", "sysdba", null, true,
>"interbase.interclient.Driver"));
> database.setDatabaseName("");
> Statement statement = database.createStatement();
> try {
> ResultSet results = statement.executeQuery("select text from test"); // the exception happens here
> statement.close();
> }
> catch (Exception ex) {ex.printStackTrace();}
> }
>
>I am using Firebird super server on Linux.
>The version of firebird is 0.9-4 Firebird Test1.
>Interserver is running on the same box
>JDK: 1.3.0-C
>
>Too me this look like a bug. What I expect would either be an error while
>executing the insert statement or a truncation of the inserted string, but
>never an exception on a select statement. This would case invalid data to
>be inserted into the DB and then it breaks the application and maybe even
>the DB get inconsistent?
>
>Is this addressed in Firebird 1 RC1?
Helen