db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mamta Satoor <msat...@gmail.com>
Subject [PATCH] Jira-189 ResultSetMetaData.getSchemaName and ResultSetMetaData.isWritable donot return correct values
Date Tue, 05 Apr 2005 21:40:23 GMT
Hi,

I have sent 2 patches for Derby engine code in the past(and they are
already commited) in preparation for making updatable resultset
functionality available in Network Server mode. Here is another patch
to make progress towards that goal.

The problem is that Derby does not return correct values for
ResultSetMetaData.getSchemaName and ResultSetMetaData.isWritable. And
these 2 methods are crucial to have updatable resultset functionality
under Network Server mode.

Following is the description of the issue from Jira
"Derby Net Client and JCC driver rely on getSchemanName method to
construct the correct "update where current of sql" for an updatRow.
For eg, if the user is in say schema s1 and the updatable resultset is
issued on a table from schema s2 with the sql "select c11 from s2.t1
for update". Currenly, getSchemaName returns null and hence, the
client code constructs a sql like "update t1 ... where current of
...". ie the update is being issued against table t1 in schema s1.
getSchemaName should return s2, so the driver can correctly genereat
sql as "update s2.t1 ... where current of ...".

In addition, the client code lets a user issue an updateXXX on a
column only if the column is writable and it determines that by
looking at the return value of isWritable(). Derby engine currently
always returns false for this method and because of that, updateXXX
fails in Network Server mode. Derby should return true for the columns
which can be updated in the given resultset. For eg for "select c11,
c12 from t1 for update of c11", isWritable should return true for c11
and false for c12. "

Most of the changes in this patch are to add methods and variables
related to  schema name and writable status to columns so they are
available correctly to EmbedResultSetMetaData.java. These changes went
into ResultColumn.java, VirtualColumnNode.java, BaseColumnNode.java,
ColumnReference.java, ValueNode.java, GenericColumnDescriptor.java,
ColumnDescriptor.java, ResultColumnDescriptor.java

CursorNode.java currently marks the columns updatable in FromTable
object only. The columns need to be marked correctly in
ResultSetColumnList associated with the cursor also. That is what the
change in CursorNode.java does.

ResultColumnList.java currently doesn't handle marking columns
updatable for the column list associated with a cursor node. Added
markColumnsInSelectListUpdatableByCursor method to handle that.

Change in EmbedResultSet.java is to catch updateXXX on read-only
columns of the resultset. Have added test for this.

Change in EmbedResultSetMetaData.java is have isWritable method return
the column's updatableByCursor state. And to call the correct schema
name method on the column in getSchemaName method.

svn stat
M      java\engine\org\apache\derby\impl\sql\compile\ResultColumn.java
M      java\engine\org\apache\derby\impl\sql\compile\VirtualColumnNode.java
M      java\engine\org\apache\derby\impl\sql\compile\CursorNode.java
M      java\engine\org\apache\derby\impl\sql\compile\BaseColumnNode.java
M      java\engine\org\apache\derby\impl\sql\compile\ColumnReference.java
M      java\engine\org\apache\derby\impl\sql\compile\ValueNode.java
M      java\engine\org\apache\derby\impl\sql\compile\ResultColumnList.java
M      java\engine\org\apache\derby\impl\sql\GenericColumnDescriptor.java
M      java\engine\org\apache\derby\impl\jdbc\EmbedResultSet.java
M      java\engine\org\apache\derby\impl\jdbc\EmbedResultSetMetaData.java
M      java\engine\org\apache\derby\iapi\sql\dictionary\ColumnDescriptor.java
M      java\engine\org\apache\derby\iapi\sql\ResultColumnDescriptor.java
M      java\testing\org\apache\derbyTesting\functionTests\tests\lang\updatableResultSet.java
M      java\testing\org\apache\derbyTesting\functionTests\master\DerbyNet\updatableResultSet.out
M      java\testing\org\apache\derbyTesting\functionTests\master\DerbyNet\resultset.out
M      java\testing\org\apache\derbyTesting\functionTests\master\DerbyNetClient\updatableResultSet.out
M      java\testing\org\apache\derbyTesting\functionTests\master\DerbyNetClient\resultset.out
M      java\testing\org\apache\derbyTesting\functionTests\master\updatableResultSet.out
M      java\testing\org\apache\derbyTesting\functionTests\master\jdk14\updatableResultSet.out
M      java\testing\org\apache\derbyTesting\functionTests\master\resultset.out

If no objection from anyone, can a commiter commit this patch?

thanks,
Mamta

Mime
View raw message