Changeset: ccf366781fc3 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ccf366781fc3 Modified Files: java/ChangeLog.Apr2011 java/src/nl/cwi/monetdb/jdbc/MonetConnection.java Branch: Apr2011 Log Message:
JDBC: properly advertise Connection read-only mode JDBC's Connection read-only mode appears to be just a hint to the driver to enable certain optimisations, if possible. It has nothing to do with being able to write to the database (or make modifications). Hence, a Connection with MonetDB is never read-only, and setReadOnly should only emit a warning when called with true. Thanks to Martin Weindel for pointing this out in bug #2818. diffs (43 lines): diff --git a/java/ChangeLog.Apr2011 b/java/ChangeLog.Apr2011 --- a/java/ChangeLog.Apr2011 +++ b/java/ChangeLog.Apr2011 @@ -2,5 +2,8 @@ # This file is updated with Maddlog * Mon Jun 6 2011 Fabian Groffen <[email protected]> +- Fixed read-only interpretation. Connection.isReadOnly now always + returns false, setReadOnly now generates a warning when called with + true. Partly from bug #2818 - Allow readonly to be set when autocommit is disabled as well. Bug #2818 diff --git a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java --- a/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java +++ b/java/src/nl/cwi/monetdb/jdbc/MonetConnection.java @@ -563,12 +563,14 @@ /** * Retrieves whether this Connection object is in read-only mode. - * MonetDB currently doesn't support updateable result sets. + * MonetDB currently doesn't support updateable result sets, but + * updates are possible. Hence the Connection object is never in + * read-only mode. * * @return true if this Connection object is read-only; false otherwise */ public boolean isReadOnly() { - return(true); + return(false); } public String nativeSQL(String sql) {return(sql);} @@ -918,8 +920,8 @@ * method is called during a transaction. */ public void setReadOnly(boolean readOnly) throws SQLException { - if (readOnly == false) - addWarning("cannot setReadOnly(false): writable mode not supported"); + if (readOnly == true) + addWarning("cannot setReadOnly(true): read-only Connection mode not supported"); } /** _______________________________________________ Checkin-list mailing list [email protected] http://mail.monetdb.org/mailman/listinfo/checkin-list
