db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mamta Satoor" <msat...@gmail.com>
Subject PreparedStatement.setXXX methods do not set up ContextStack. Is that right and if so, why?
Date Sat, 03 Mar 2007 09:18:55 GMT

I noticed that PreparedStatement.executeQuery(like several other JDBC
methods) sets up the context stack by calling setupContextStack in
EmbeddedStatement's executeStatement method(line 1118). But when setXXX
methods are called on PreparedStatement, we do not create a context stack.
Why do we not need the context setting for setXXX methods?

The reason for my question is I ran following simple query in ij
connect 'jdbc:derby:c:/dellater/db1';
prepare p as 'select STATUS_TS  from tstab where status_ts = ?';
execute p using 'values (''20'')';

When trying to debug through the last statement above ***execute p using
'values (''20'')';***, I found that we reach SQLTimestamp.setValue(String
theValue) method. In this method, we try to determine the locale by going
through the Context stack but since none was setup for setXXX methods, we
always use a null locale irrespective of what territory the database was
created with. That doesn't seem like the right thing to do and the reason
this is happening is because no context stack was set up for this particular
JDBC api.

I am not very familiar with context stack and maybe what Derby is doing here
is the right thing to do but I would like to understand why Derby is coded
the way it is for PreparedStatement.setXXX methods. Any feedback will be
very helpful.


View raw message