Changeset: 1e278695fe54 for monetdb-java
URL: https://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=1e278695fe54
Modified Files:
src/main/java/org/monetdb/jdbc/MonetConnection.java
src/main/java/org/monetdb/jdbc/MonetDataSource.java
src/main/java/org/monetdb/jdbc/MonetDriver.java.in
src/main/java/org/monetdb/jdbc/MonetResultSet.java
src/main/java/org/monetdb/jdbc/MonetStatement.java
Branch: default
Log Message:
Small improvements: adding some final keywords, removing unnecesary
initialisations, improve comments.
diffs (116 lines):
diff --git a/src/main/java/org/monetdb/jdbc/MonetConnection.java
b/src/main/java/org/monetdb/jdbc/MonetConnection.java
--- a/src/main/java/org/monetdb/jdbc/MonetConnection.java
+++ b/src/main/java/org/monetdb/jdbc/MonetConnection.java
@@ -92,7 +92,7 @@ public class MonetConnection
private final BufferedMCLWriter out;
/** A StartOfHeaderParser declared for reuse. */
- private StartOfHeaderParser sohp = new StartOfHeaderParser();
+ private final StartOfHeaderParser sohp = new StartOfHeaderParser();
/** Whether this Connection is closed (and cannot be used anymore) */
private boolean closed;
@@ -115,7 +115,7 @@ public class MonetConnection
// See javadoc for documentation about WeakHashMap if you don't know
what
// it does !!!NOW!!! (only when you deal with it of course)
/** A Map containing all (active) Statements created from this
Connection */
- private WeakHashMap<Statement,?> statements = new
WeakHashMap<Statement, Object>();
+ private final WeakHashMap<Statement,?> statements = new
WeakHashMap<Statement, Object>();
/** The number of results we receive from the server at once */
private int curReplySize = -1; // the server by default uses -1 (all)
@@ -137,9 +137,9 @@ public class MonetConnection
private final int lang;
/** Whether or not BLOB is mapped to Types.VARBINARY instead of
Types.BLOB within this connection */
- private boolean treatBlobAsVarBinary = true;
+ private boolean treatBlobAsVarBinary = true; // turned on by default
for optimal performance (from JDBC Driver release 2.30 onwards)
/** Whether or not CLOB is mapped to Types.VARCHAR instead of
Types.CLOB within this connection */
- private boolean treatClobAsVarChar = true;
+ private boolean treatClobAsVarChar = true; // turned on by default
for optimal performance (from JDBC Driver release 2.30 onwards)
/** The last set query timeout on the server as used by Statement,
PreparedStatement and CallableStatement */
protected int lastSetQueryTimeout; // 0 means no timeout, which is
the default on the server
@@ -885,7 +885,7 @@ public class MonetConnection
* @param sql - an SQL statement that may contain one or more '?' IN
parameter placeholders
* @param columnIndexes - an array of column indexes indicating the
columns that should be returned from the inserted row or rows
* @return a new PreparedStatement object, containing the pre-compiled
statement, that is capable of
- * returning the auto-generated keys designated by the given array
of column indexes
+ * returning the auto-generated keys designated by the given array
of column indexes
* @throws SQLException - if a database access error occurs or this
method is called on a closed connection
* @throws SQLFeatureNotSupportedException - if the JDBC driver does
not support this method
*/
@@ -914,7 +914,7 @@ public class MonetConnection
* @param sql - an SQL statement that may contain one or more '?' IN
parameter placeholders
* @param columnNames - an array of column names indicating the columns
that should be returned from the inserted row or rows
* @return a new PreparedStatement object, containing the pre-compiled
statement, that is capable of
- * returning the auto-generated keys designated by the given array
of column names
+ * returning the auto-generated keys designated by the given array
of column names
* @throws SQLException - if a database access error occurs or this
method is called on a closed connection
* @throws SQLFeatureNotSupportedException - if the JDBC driver does
not support this method
*/
@@ -1326,7 +1326,7 @@ public class MonetConnection
if (timeout > 0 && original_timeout !=
this.lastSetQueryTimeout) {
this.lastSetQueryTimeout = original_timeout;
try {
- /* we have to set in the server
explicitly, because the test 'queryTimeout != connection.lastSetQueryTimeout'
+ /* we have to set in the server
explicitly, because the test 'queryTimeout != connection.lastSetQueryTimeout'
on
MonetStatement.internalExecute(sql) won't pass and the server won't be set back
*/
setQueryTimeout(original_timeout);
} catch (SQLException se) {
diff --git a/src/main/java/org/monetdb/jdbc/MonetDataSource.java
b/src/main/java/org/monetdb/jdbc/MonetDataSource.java
--- a/src/main/java/org/monetdb/jdbc/MonetDataSource.java
+++ b/src/main/java/org/monetdb/jdbc/MonetDataSource.java
@@ -34,7 +34,7 @@ public final class MonetDataSource
implements DataSource
{
private String description;
- private int loginTimeout = 0;
+ private int loginTimeout;
private String user;
// insecure, but how to do it better?
private String password;
diff --git a/src/main/java/org/monetdb/jdbc/MonetDriver.java.in
b/src/main/java/org/monetdb/jdbc/MonetDriver.java.in
--- a/src/main/java/org/monetdb/jdbc/MonetDriver.java.in
+++ b/src/main/java/org/monetdb/jdbc/MonetDriver.java.in
@@ -392,7 +392,7 @@ public class MonetDriver implements Driv
* in the SQL CASE statement
* @return a SQL CASE statement
*/
- private static String TypeMapppingSQL = null; // cache to optimise
getSQLTypeMap()
+ private static String TypeMapppingSQL; // cache to optimise
getSQLTypeMap()
static final String getSQLTypeMap(final String column) {
if (TypeMapppingSQL == null) {
// first time, compose TypeMappping SQL string
diff --git a/src/main/java/org/monetdb/jdbc/MonetResultSet.java
b/src/main/java/org/monetdb/jdbc/MonetResultSet.java
--- a/src/main/java/org/monetdb/jdbc/MonetResultSet.java
+++ b/src/main/java/org/monetdb/jdbc/MonetResultSet.java
@@ -90,7 +90,7 @@ public class MonetResultSet
/** The number of rows in this ResultSet */
protected final long tupleCount;
/** The current position of the cursor for this ResultSet object */
- protected int curRow = 0;
+ protected int curRow;
/** The type of this ResultSet (forward or scrollable) */
private int type = DEF_RESULTSETTYPE;
diff --git a/src/main/java/org/monetdb/jdbc/MonetStatement.java
b/src/main/java/org/monetdb/jdbc/MonetStatement.java
--- a/src/main/java/org/monetdb/jdbc/MonetStatement.java
+++ b/src/main/java/org/monetdb/jdbc/MonetStatement.java
@@ -1506,7 +1506,7 @@ public class MonetStatement
* TODO: try to eliminate the need for this class completely.
*/
final class MonetVirtualResultSet extends MonetResultSet {
- private String results[][];
+ private final String results[][];
private boolean closed;
MonetVirtualResultSet(
@@ -1570,7 +1570,6 @@ final class MonetVirtualResultSet extend
public void close() {
if (!closed) {
closed = true;
- results = null;
// types and columns are MonetResultSets private parts
}
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list