Hi,
I have a simple test case where Derby doesn't throw a truncation exception.
//the following Formatters just loads cData with 32700 'c' characters
String cData =
org.apache.derbyTesting.functionTests.util.Formatters.repeatChar("c",32700);
pSt = con.prepareStatement("insert into ct values (cast (? as
varchar(32672)))"); //notice that ? is bound to length
32672
pSt.setString(1, cData);
pSt.execute();//Derby doesn't throw an exception here for 32700 characters
into 32672 parameter. It silently
truncates it to 32672
I think it is a bug that we accept 32700 characters, truncate it to 32672
characters
and insert those 32672 characters into table ct.
This behavior is because ParameterNode.generateExpression() doesn't generate the
method "setWidth" to validate the width at run time. Before I file a Jira
entry, I want
to make sure that community agrees that it is a bug.
thanks,
Mamta