db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Satheesh Bandaram <sathe...@Sourcery.Org>
Subject Re: [jira] Commented: (DERBY-142) ResultSetMetaData.isReadOnly() also returns wrong results
Date Wed, 12 Oct 2005 18:51:08 GMT
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Great... Thanks for discussing this at the EG this week. Please let us
know of any outcome, if possible. I am willing to address the problem
either way, once we reach some conclusion.<br>
<br>
Here are some of the points to consider:<br>
<ol>
  <li>ODBC spec is unambiguous... It says
ResultSetMetaData.isReadOnly() should return information about the
result column, not the base column. JDBC doesn't need to follow ODBC
here, but something to keep in mind.</li>
  <li>Thomas Fischer seems to indicate many JDBC drivers implement
isReadOnly to refer to base column, not the result column. But my
testing with DB2 seems to indicate that isReadOnly() returns
information about the result column NOT the base column. I haven't
tested with other database drivers.</li>
  <li>Both you and Dan pointed to the fact that this method was there
in JDBC 1.0, which predates updatable resultsets.</li>
  <li>It would make more sense to make ResultSetMetaData.isReadOnly()
to reflect ResultSet itself, rather than the base table.
DatabaseMetaData might be more appropriate for checking for
read/writeOnly info for base columns.</li>
</ol>
Again, I am OK with implementing a consensus either way. Hope we can
reach one, quickly.<span class="moz-smiley-s1"><span> :-) </span></span><br>
<br>
Satheesh<br>
<br>
Lance J. Andersen wrote:
<blockquote cite="mid434D0AA2.7070107@sun.com" type="cite">
  <meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
  <title></title>
As i mentioned earlier, i will be addressing the lack of clarity in the
JDBC 4.0 spec, for the public draft (EDR2 just went to the JCP and
should be posted shortly)/<br>
  <br>
  <br>
These metadata methods were added during the initial JDBC 1.0.2 release
which was prior to updatable resultsets within jdbc.    <br>
  <br>
I am going to be discussing this in my weekly EG call this week.<br>
  <br>
-lance<br>
  <br>
Jean T. Anderson (JIRA) wrote:
  <blockquote
 cite="mid1633188981.1129074305455.JavaMail.jira@ajax.apache.org"
 type="cite">
    <pre wrap="">    [ <a class="moz-txt-link-freetext"
 href="http://issues.apache.org/jira/browse/DERBY-142?page=comments#action_12331849">http://issues.apache.org/jira/browse/DERBY-142?page=comments#action_12331849</a>
] 

Jean T. Anderson commented on DERBY-142:
----------------------------------------

So Torque uses Village ( <a class="moz-txt-link-freetext"
 href="http://www.softwareforge.de/releases/village/">http://www.softwareforge.de/releases/village/</a>
) to insert/modify datasets. Here are a few more details about what Village does under the
hood after a (very quick) look at it. (Torque lurkers should feel free to correct these details.)

Village obtains the schema for a given table with this query:

     String sql = "SELECT " + columnsAttribute + " FROM " + tableName + " WHERE 1 = -1";

This query will work in any database, so this much makes sense. And it also makes sense to
me that they wouldn't include a "FOR  UPDATE" clause on it. At this point, they're just building
internal information about the schema.

Information for each column is then obtained with the ResultSetMetaData methods, including
whether or not the column is writeable with that isReadOnly method call. The Village method
that inserts a new row only does so if the columns are writeable. Hence the current problem.

I'm looking at the jdbc docs at <a class="moz-txt-link-freetext"
 href="http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSetMetaData.html">http://java.sun.com/j2se/1.4.2/docs/api/java/sql/ResultSetMetaData.html</a>
and I'm not seeing clearly whether these metadata calls are intended to just describe columns
in the result set or columns in the underlying table:

   - isReadOnly: "Indicates whether the designated column is definitely not writable."
   - isWritable: "Indicates whether it is possible for a write on the designated column to
succeed.".

What is the "designated column"? Just the result set? Or could it also refer to the underlying
table?

I'm looking at the "JDBC API Tutorial and Reference, Third Edition", and section 27.1.19 on
"Queries That Produce Updateable Result Sets" suggests to me a strong association with the
permissions on the underlying table. --I'm left wondering what it might mean to update a result
set outside the context of an underlying table.



  </pre>
    <blockquote type="cite">
      <pre wrap="">ResultSetMetaData.isReadOnly() also returns wrong results
---------------------------------------------------------

         Key: DERBY-142
         URL: <a class="moz-txt-link-freetext"
 href="http://issues.apache.org/jira/browse/DERBY-142">http://issues.apache.org/jira/browse/DERBY-142</a>
     Project: Derby
        Type: Sub-task
  Components: JDBC
    Versions: 10.0.2.1
 Environment: Using DB2 universal driver with standalone derby server
    Reporter: Thomas Fischer
 Attachments: DerbyTest.java, DerbyTest142.java

ResultSetMetaData.isReadOnly() always returns true, even when writing to the table is possible.
 
The JDBC 2.0 spec says: "ResultSetMetaData.isReadOnly() : Indicates whether the designated
column is definitely not writable.", so the method should return false for a table.
I will attach a testcase for this behaviour.
    </pre>
    </blockquote>
    <pre wrap=""><!---->
  </pre>
  </blockquote>
</blockquote>
</body>
</html>


Mime
View raw message