db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject [Fwd: Re: How to run the Apache DB Torque tutorial with Derby]
Date Sat, 08 Oct 2005 09:31:13 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I took a quick look at this bug. It seems to me Derby Client is
behaving as expected rather than the embedded driver though it doesn't
seem like it. The query in question gets a ResultSet and its metadata
as:<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ResultSet rs = s.executeQuery("SELECT id, name FROM
readonlytest");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
ResultSetMetaData metaData = rs.getMetaData();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (metaData.isReadOnly(1))<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
System.out.println("ID column is readonly");<br>
<br>
Since a FOR UPDATE clause is not specified, the resultset that is
returned is <b>readonly</b>, which is what Derby client returns for
metaData.isReadOnly(1). Once a FOR UPDATE clause is added, Derby client
doesn't report the column as readonly.<br>
<br>
The problem is really with the embedded driver... Even when FOR UPDATE
clause is not specified, current implementation of isReadOnly() still
returns FALSE, when returning TRUE seems more correct.<br>
<br>
<u><b>EmbedResultSetMetaData.java:</b></u><br>
&nbsp;&nbsp;&nbsp; public boolean isReadOnly(int column) throws SQLException {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; validColumnNumber(column);<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; // we just don't know if it
is a base table column or not<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; return false;<br>
&nbsp;&nbsp;&nbsp; }<br>
<br>
Satheesh<br>
<br>
</body>
</html>

Mime
View raw message