Mercurial > hg > monetdb-java
changeset 101:551093abca52 embedded
More documentation and fixed some tests.
line wrap: on
line diff
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java @@ -39,7 +39,7 @@ import java.util.concurrent.Executor; * The current state of this connection is that it nearly implements the * whole Connection interface. * - * @author Martin van Dinther + * @author Fabian Groffen, Martin van Dinther, Pedro Ferreira * @version 1.3 */ public abstract class MonetConnection extends MonetWrapper implements Connection { @@ -101,10 +101,20 @@ public abstract class MonetConnection ex this.clobIsLongChar = clobIsLongChar; } + /** + * Gets the connection's language data. + * + * @return The connection's language data + */ public IMonetDBLanguage getLanguage() { return language; } + /** + * Gets the connection's protocol. + * + * @return The connection's protocol + */ public AbstractProtocol getProtocol() { return this.protocol; } @@ -112,6 +122,8 @@ public abstract class MonetConnection ex /** * Connects to the server, authenticating the user. * + * @param user The user name to authenticate + * @param pass The user's password * @return A List with informational (warning) messages. If this list is empty; then there are no warnings. * @throws IOException if an I/O error occurs when creating the socket * @throws ProtocolException if bogus data is received
--- a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in +++ b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in @@ -433,7 +433,7 @@ final public class MonetDriver implement if(EmbeddedConnectionClass == null) { EmbeddedConnectionClass = Class.forName("nl.cwi.monetdb.embedded.jdbc.EmbeddedConnection"); if(EmbeddedConnectionClass == null) { //if it's still null then there is a problem - throw new SQLException("EmbeddedConnection Class not found! Please load the MonetDBJavaEmbedded JAR!"); + throw new SQLException("EmbeddedConnection Class not found! Please add the MonetDBJavaEmbedded JAR to the Classpath!"); } } res = (MonetConnection) EmbeddedConnectionClass
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java @@ -15,6 +15,8 @@ package nl.cwi.monetdb.mcl.connection; */ public final class ControlCommands { + /* Please don't change the order or the values */ + /** Send autocommit statement */ public static final int AUTO_COMMIT = 1; /** Set reply size for the server (for the maxrows specification) */
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java @@ -27,11 +27,12 @@ import java.sql.SQLException; import java.util.*; /** - * A {@link Connection} suitable for the MonetDB database on a MAPI connection. + * A {@link Connection} suitable for the MonetDB database using a MAPI connection. * * @author Fabian Groffen, Martin van Dinther, Pedro Ferreira */ public class MapiConnection extends MonetConnection { + /** the PROMPT ASCII char sent by the server */ static final char PROMPT_CHAR = '.'; /** the default number of rows that are (attempted to) read at once */ @@ -190,11 +191,21 @@ public class MapiConnection extends Mone return DEF_FETCHSIZE; } + /** + * Closes the underlying connection implementation. On a MAPI connection, the underlying socket is closed. + * + * @throws IOException if an I/O error occurs while closing the connection + */ @Override public synchronized void closeUnderlyingConnection() throws IOException { ((OldMapiProtocol)protocol).getSocket().close(); } + /** + * Gets the underlying connection JDBC String URL. + * + * @return The underlying connection JDBC String URL + */ @Override public String getJDBCURL() { String res = "jdbc:monetdb://" + this.hostname + ":" + this.port + "/" + this.database; @@ -203,6 +214,13 @@ public class MapiConnection extends Mone return res; } + /** + * Sends a control command to the server. On a MAPI connection, regular MonetDB commands are sent to the server. + * + * @param commandID the command identifier according to {@link ControlCommands} listing + * @param data The integer to send according to the control command + * @throws SQLException if an IO exception or a database error occurs + */ @Override public void sendControlCommand(int commandID, int data) throws SQLException { String command = null; @@ -236,6 +254,16 @@ public class MapiConnection extends Mone } } + /** + * Creates a ResponseList. In a Mapi connection, there are no restrictions while creating the response list. + * + * @param fetchSize the nubmer of rows per block in the response list + * @param maxRows maximum number of rows to allow in the set + * @param resultSetType the type of result sets to produce + * @param resultSetConcurrency the concurrency of result sets to produce + * @return A ResponseList instance + * @throws SQLException if an IO exception or a database error occurs + */ @Override public ResponseList createResponseList(int fetchSize, int maxRows, int resultSetType, int resultSetConcurrency) throws SQLException { @@ -246,6 +274,8 @@ public class MapiConnection extends Mone * Connects to the given host and port, logging in as the given user. If followRedirect is false, a * RedirectionException is thrown when a redirect is encountered. * + * @param user The user name to authenticate + * @param pass The user's password * @return A List with informational (warning) messages. If this list is empty; then there are no warnings. * @throws IOException if an I/O error occurs when creating the socket * @throws ProtocolException if bogus data is received
--- a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java +++ b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java @@ -13,7 +13,7 @@ import nl.cwi.monetdb.mcl.connection.IMo /** * The MAPI implementation of the available languages on a JDBC connection: SQL and MAL. * - * @author Pedro Ferreira + * @author Fabian Groffen, Pedro Ferreira */ public enum MapiLanguage implements IMonetDBLanguage {
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java @@ -34,28 +34,28 @@ public abstract class AbstractProtocol { public abstract void waitUntilPrompt() throws IOException; /** - * Fetch the server's next response data. + * Fetches the server's next response data. * * @throws IOException If an error in the underlying connection happened. */ public abstract void fetchNextResponseData() throws IOException; /** - * Get the current server response, obtained through the fetchNextResponseData method. + * Gets the current server response. * * @return The integer representation of the server response */ public abstract int getCurrentServerResponse(); /** - * Get the next starter header of a server response. + * Gets the next starter header of a server response. * - * @return The integer representation of the starter header + * @return The integer representation of {@link StarterHeaders} */ public abstract int getNextStarterHeader(); /** - * Get the next ResultSet response from the server, belonging to a ResponseList. + * Gets the next ResultSet response from the server, belonging to a ResponseList. * * @param con The current MonetDB's JDBC connection * @param list The Response List this result set will belong to @@ -67,7 +67,7 @@ public abstract class AbstractProtocol { int seqnr) throws ProtocolException; /** - * Get the next UpdateResponse response from the server. + * Gets the next UpdateResponse response from the server. * * @return The UpdateResponse instance * @throws ProtocolException If an error in the underlying connection happened. @@ -75,7 +75,7 @@ public abstract class AbstractProtocol { public abstract UpdateResponse getNextUpdateResponse() throws ProtocolException; /** - * Get the next SchemaResponse response from the server. + * Gets the next SchemaResponse response from the server. * * @return The SchemaResponse instance */ @@ -84,7 +84,7 @@ public abstract class AbstractProtocol { } /** - * Get the next AutoCommitResponse response from the server. + * Gets the next AutoCommitResponse response from the server. * * @return The AutoCommitResponse instance * @throws ProtocolException If an error in the underlying connection happened. @@ -92,7 +92,7 @@ public abstract class AbstractProtocol { public abstract AutoCommitResponse getNextAutoCommitResponse() throws ProtocolException; /** - * Get the next DataBlockResponse response from the server, belonging to a ResultSetResponse + * Gets the next DataBlockResponse response from the server, belonging to a ResultSetResponse * * @param rsresponses A map of ResultSetResponse, in which this Block will belong to one of them, by checking its id * against the keys of the Map. @@ -103,7 +103,7 @@ public abstract class AbstractProtocol { throws ProtocolException; /** - * Get the next Table Header for a ResultSetResponse. More than one of the parameter arrays can be filled at once. + * Gets the next Table Header for a ResultSetResponse. More than one of the parameter arrays can be filled at once. * * @param columnNames The column names array * @param columnLengths The column lengths array @@ -141,7 +141,7 @@ public abstract class AbstractProtocol { * language and connection used. * * @param prefix The prefix to append at the beginning of the query string - * @param query The user query to submit at the server + * @param query The user query to submit to the server * @param suffix The suffix to append at the end of the query string * @throws IOException If an error in the underlying connection happened. */
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java @@ -15,7 +15,7 @@ package nl.cwi.monetdb.mcl.protocol; */ public final class ServerResponses { - /* Please don't change the order */ + /* Please don't change the order or the values */ /** "there is currently no line", or the the type is unknown is represented by UNKNOWN */ public static final int UNKNOWN = 0;
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java @@ -16,7 +16,7 @@ package nl.cwi.monetdb.mcl.protocol; */ public final class StarterHeaders { - /* Please don't change the order */ + /* Please don't change the order or the values */ /** A parse response (not handled) */ public static final int Q_PARSE = 0;
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java @@ -16,7 +16,7 @@ package nl.cwi.monetdb.mcl.protocol; */ public final class TableResultHeaders { - /* Please don't change the order */ + /* Please don't change the order or the values */ /** When an unknown table header is returned on a MAPI connection */ public static final int UNKNOWN = 0;
--- a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java +++ b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java @@ -13,6 +13,7 @@ import nl.cwi.monetdb.mcl.connection.map import nl.cwi.monetdb.mcl.protocol.ProtocolException; import nl.cwi.monetdb.mcl.protocol.AbstractProtocol; import nl.cwi.monetdb.mcl.protocol.ServerResponses; +import nl.cwi.monetdb.mcl.protocol.StarterHeaders; import nl.cwi.monetdb.mcl.responses.AutoCommitResponse; import nl.cwi.monetdb.mcl.responses.UpdateResponse; import nl.cwi.monetdb.mcl.responses.DataBlockResponse; @@ -32,6 +33,11 @@ import java.util.Map; public class OldMapiProtocol extends AbstractProtocol { /** + * The default size for the tuple lines' CharBuffer (it should be less than the OldMapiSocket BLOCK size). + */ + private static final int TUPLE_LINE_BUFFER_DEFAULT_SIZE = 1024; + + /** * The current server response. */ private int currentServerResponseHeader = ServerResponses.UNKNOWN; @@ -54,18 +60,23 @@ public class OldMapiProtocol extends Abs public OldMapiProtocol(OldMapiSocket socket) { this.socket = socket; this.lineBuffer = CharBuffer.wrap(new char[OldMapiSocket.BLOCK]); - this.tupleLineBuffer = CharBuffer.wrap(new char[1024]); + this.tupleLineBuffer = CharBuffer.wrap(new char[TUPLE_LINE_BUFFER_DEFAULT_SIZE]); } /** - * Retrieve the underlying socket data. + * Gets the underlying socket. * - * @return The underlying socket data + * @return The underlying socket */ public OldMapiSocket getSocket() { return socket; } + /** + * Gets the current server response, obtained through the fetchNextResponseData method. + * + * @return The integer representation of {@link ServerResponses} + */ @Override public int getCurrentServerResponse() { return currentServerResponseHeader; @@ -95,7 +106,7 @@ public class OldMapiProtocol extends Abs } /** - * Read a line of text from the socket. A line is considered to be terminated by any one of a line feed ('\n'). + * Reads a line of text from the socket. A line is considered to be terminated by any one of a line feed ('\n'). * * Warning: until the server properly prefixes all of its error messages with SQLSTATE codes, this method prefixes * all errors it sees without sqlstate with the generic data exception code (22000). @@ -120,11 +131,25 @@ public class OldMapiProtocol extends Abs this.lineBuffer.position(1); } + /** + * Gets the next starter header of a server response. + * + * @return The integer representation of {@link StarterHeaders} + */ @Override public int getNextStarterHeader() { return OldMapiStartOfHeaderParser.GetNextStartHeaderOnOldMapi(this); } + /** + * Gets the next ResultSet response from the server, belonging to a ResponseList. + * + * @param con The current MonetDB's JDBC connection + * @param list The Response List this result set will belong to + * @param seqnr The sequence number of this result set on the Response List + * @return The ResultSet instance + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override public ResultSetResponse getNextResultSetResponse(MonetConnection con, MonetConnection.ResponseList list, int seqnr) throws ProtocolException { @@ -135,6 +160,12 @@ public class OldMapiProtocol extends Abs return new ResultSetResponse(con, list, seqnr, id, rowcount, tuplecount, columncount); } + /** + * Gets the next UpdateResponse response from the server. + * + * @return The UpdateResponse instance + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override public UpdateResponse getNextUpdateResponse() throws ProtocolException { int count = OldMapiStartOfHeaderParser.GetNextResponseDataAsInt(this); //The order cannot be switched!! @@ -142,12 +173,26 @@ public class OldMapiProtocol extends Abs return new UpdateResponse(lastId, count); } + /** + * Gets the next AutoCommitResponse response from the server. + * + * @return The AutoCommitResponse instance + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override public AutoCommitResponse getNextAutoCommitResponse() throws ProtocolException { boolean ac = OldMapiStartOfHeaderParser.GetNextResponseDataAsString(this).equals("t"); return new AutoCommitResponse(ac); } + /** + * Gets the next DataBlockResponse response from the server, belonging to a ResultSetResponse + * + * @param rsresponses A map of ResultSetResponse, in which this Block will belong to one of them, by checking its id + * against the keys of the Map. + * @return The DataBlockResponse instance + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override public DataBlockResponse getNextDatablockResponse(Map<Integer, ResultSetResponse> rsresponses) throws ProtocolException { @@ -163,6 +208,16 @@ public class OldMapiProtocol extends Abs return rs.addDataBlockResponse(offset, rowcount, this); } + /** + * Gets the next Table Header for a ResultSetResponse. More than one of the parameter arrays can be filled at once. + * + * @param columnNames The column names array + * @param columnLengths The column lengths array + * @param types The columns SQL names array + * @param tableNames The columns schemas and names in format schema.table + * @return A TableResultHeaders integer representation, representing which of the fields was filled + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override public int getNextTableHeader(String[] columnNames, int[] columnLengths, String[] types, String[] tableNames) throws ProtocolException { @@ -170,12 +225,29 @@ public class OldMapiProtocol extends Abs tableNames); } + /** + * Retrieves the next values in a DataBlockResponse from the underlying connection, starting at a specific line + * number. + * + * @param firstLineNumber The first line number in the response to retrieve + * @param typesMap The JDBC types mapping array for every column in the ResultSetResponse of the DataBlock + * @param values An array of columns to fill the values + * @return The number of lines parsed from the underlying connection + * @throws ProtocolException If an error in the underlying connection happened. + */ @Override - public int parseTupleLines(int firstLineNumber, int[] typesMap, Object[] data) throws ProtocolException { - OldMapiTupleLineParser.OldMapiParseTupleLine(this, firstLineNumber, typesMap, data); + public int parseTupleLines(int firstLineNumber, int[] typesMap, Object[] values) throws ProtocolException { + OldMapiTupleLineParser.OldMapiParseTupleLine(this, firstLineNumber, typesMap, values); return firstLineNumber; } + /** + * Gets the remaining response line from the underlying connection as a Java String. This method is mostly used to + * retrieve error Strings, when they are detected while parsing a response line. + * + * @param startIndex The first index in the response line to retrieve the String + * @return The String representation of the line starting at the provided index + */ @Override public String getRemainingStringLine(int startIndex) { if(this.lineBuffer.limit() > startIndex) { @@ -185,6 +257,15 @@ public class OldMapiProtocol extends Abs } } + /** + * Writes a user query to the server, while providing the respective prefixes and suffixes depending on the current + * language and connection used. + * + * @param prefix The prefix to append at the beginning of the query string + * @param query The user query to submit to the server + * @param suffix The suffix to append at the end of the query string + * @throws IOException If an error in the underlying connection happened. + */ @Override public synchronized void writeNextQuery(String prefix, String query, String suffix) throws IOException { this.socket.writeNextLine(prefix, query, suffix);
--- a/tests/Test_Clargequery.java +++ b/tests/Test_Clargequery.java @@ -44,7 +44,7 @@ public class Test_Clargequery { System.out.print("1. sending"); stmt1.execute(bigq.toString()); int i = 1; // we skip the first "getResultSet()" - while (stmt1.getMoreResults() != false) { + while (stmt1.getMoreResults()) { i++; } if (stmt1.getUpdateCount() != -1) {
--- a/tests/Test_Cmanycon.java +++ b/tests/Test_Cmanycon.java @@ -12,7 +12,7 @@ import java.util.*; public class Test_Cmanycon { public static void main(String[] args) throws Exception { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers - List cons = new ArrayList(100); // Connections go in here + List<Connection> cons = new ArrayList<>(100); // Connections go in here try { // spawn a lot of Connections, just for fun...
--- a/tests/Test_Int128.java +++ b/tests/Test_Int128.java @@ -20,10 +20,8 @@ public class Test_Int128 { public static void main(String[] args) throws Exception { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers Connection con = DriverManager.getConnection(args[0]); - BigInteger bi = new BigInteger( - "123456789012345678909876543210987654321"); - BigDecimal bd = new BigDecimal( - "1234567890123456789.9876543210987654321"); + BigInteger bi = new BigInteger("123456789012345678909876543210987654321"); + BigDecimal bd = new BigDecimal("1234567890123456789.9876543210987654321"); try { con.setAutoCommit(false); Statement s = con.createStatement();
--- a/tests/Test_PSmanycon.java +++ b/tests/Test_PSmanycon.java @@ -12,7 +12,7 @@ import java.util.*; public class Test_PSmanycon { public static void main(String[] args) throws Exception { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers - List pss = new ArrayList(100); // Connections go in here + List<PreparedStatement> pss = new ArrayList<>(100); // Connections go in here try { // spawn a lot of Connections, just for fun... @@ -51,7 +51,7 @@ public class Test_PSmanycon { Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); try { - int affrows = stmt.executeUpdate("update foo where bar is wrong"); + stmt.executeUpdate("update foo where bar is wrong"); System.out.println("oops, faulty statement just got through :("); } catch (SQLException e) { System.out.println("Forced transaction failure");
--- a/tests/Test_PSmetadata.java +++ b/tests/Test_PSmetadata.java @@ -14,9 +14,8 @@ public class Test_PSmetadata { Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); PreparedStatement pstmt; - ResultSet rs = null; - ResultSetMetaData rsmd = null; - ParameterMetaData pmd = null; + ResultSetMetaData rsmd; + ParameterMetaData pmd; con.setAutoCommit(false); // >> false: auto commit should be off now @@ -24,7 +23,6 @@ public class Test_PSmetadata { try { stmt.executeUpdate("CREATE TABLE table_Test_PSmetadata ( myint int, mydouble double, mybool boolean, myvarchar varchar(15), myclob clob )"); - // all NULLs stmt.executeUpdate("INSERT INTO table_Test_PSmetadata VALUES (NULL, NULL, NULL, NULL, NULL)"); // all filled in
--- a/tests/Test_PSsqldata.java +++ b/tests/Test_PSsqldata.java @@ -17,9 +17,9 @@ public class Test_PSsqldata { Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); PreparedStatement pstmt; - ResultSet rs = null; - ResultSetMetaData rsmd = null; - ParameterMetaData pmd = null; + ResultSet rs; + ResultSetMetaData rsmd ; + ParameterMetaData pmd; con.setAutoCommit(false); // >> false: auto commit should be off now
--- a/tests/Test_PStimedate.java +++ b/tests/Test_PStimedate.java @@ -14,7 +14,7 @@ public class Test_PStimedate { Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); PreparedStatement pstmt; - ResultSet rs = null; + ResultSet rs; //DatabaseMetaData dbmd = con.getMetaData(); con.setAutoCommit(false);
--- a/tests/Test_PStimezone.java +++ b/tests/Test_PStimezone.java @@ -22,7 +22,7 @@ public class Test_PStimezone { Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); PreparedStatement pstmt; - ResultSet rs = null; + ResultSet rs; //DatabaseMetaData dbmd = con.getMetaData(); con.setAutoCommit(false);
--- a/tests/Test_PStypes.java +++ b/tests/Test_PStypes.java @@ -23,22 +23,21 @@ public class Test_PStypes { try { stmt.executeUpdate( -"CREATE TABLE htmtest (" + -" htmid bigint NOT NULL," + -" ra double ," + -" decl double ," + -" dra double ," + -" ddecl double ," + -" flux double ," + -" dflux double ," + -" freq double ," + -" bw double ," + -" type decimal(1,0)," + -" imageurl varchar(100)," + -" comment varchar(100)," + -" CONSTRAINT htmtest_htmid_pkey PRIMARY KEY (htmid)" + -")" -); + "CREATE TABLE htmtest (" + + " htmid bigint NOT NULL," + + " ra double ," + + " decl double ," + + " dra double ," + + " ddecl double ," + + " flux double ," + + " dflux double ," + + " freq double ," + + " bw double ," + + " type decimal(1,0)," + + " imageurl varchar(100)," + + " comment varchar(100)," + + " CONSTRAINT htmtest_htmid_pkey PRIMARY KEY (htmid)" + + ")"); // index is not used, but the original bug had it too stmt.executeUpdate("CREATE INDEX htmid ON htmtest (htmid)"); } catch (SQLException e) { @@ -49,9 +48,7 @@ public class Test_PStypes { } try { - pstmt = con.prepareStatement( -"INSERT INTO HTMTEST (HTMID,RA,DECL,FLUX,COMMENT) VALUES (?,?,?,?,?)" -); + pstmt = con.prepareStatement("INSERT INTO HTMTEST (HTMID,RA,DECL,FLUX,COMMENT) VALUES (?,?,?,?,?)"); System.out.print("1. inserting a record..."); pstmt.setLong(1, 1L); @@ -64,9 +61,7 @@ public class Test_PStypes { System.out.println("success :)"); // try an update like bug #1757923 - pstmt = con.prepareStatement( -"UPDATE HTMTEST set COMMENT=?, TYPE=? WHERE HTMID=?" -); + pstmt = con.prepareStatement("UPDATE HTMTEST set COMMENT=?, TYPE=? WHERE HTMID=?"); System.out.print("2. updating record..."); pstmt.setString(1, "some update");
--- a/tests/Test_Rbooleans.java +++ b/tests/Test_Rbooleans.java @@ -13,7 +13,7 @@ public class Test_Rbooleans { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); - ResultSet rs = null; + ResultSet rs; //DatabaseMetaData dbmd = con.getMetaData(); con.setAutoCommit(false);
--- a/tests/Test_Rmetadata.java +++ b/tests/Test_Rmetadata.java @@ -13,8 +13,8 @@ public class Test_Rmetadata { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); - ResultSet rs = null; - ResultSetMetaData rsmd = null; + ResultSet rs; + ResultSetMetaData rsmd; //DatabaseMetaData dbmd = con.getMetaData(); con.setAutoCommit(false); @@ -23,7 +23,6 @@ public class Test_Rmetadata { try { stmt.executeUpdate("CREATE TABLE table_Test_Rmetadata ( myint int, mydouble double, mybool boolean, myvarchar varchar(15), myclob clob )"); - // all NULLs stmt.executeUpdate("INSERT INTO table_Test_Rmetadata VALUES (NULL, NULL, NULL, NULL, NULL)"); // all filled in
--- a/tests/Test_Rsqldata.java +++ b/tests/Test_Rsqldata.java @@ -16,8 +16,8 @@ public class Test_Rsqldata { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); - ResultSet rs = null; - ResultSetMetaData rsmd = null; + ResultSet rs; + ResultSetMetaData rsmd; con.setAutoCommit(false); // >> false: auto commit should be off now
--- a/tests/Test_Rtimedate.java +++ b/tests/Test_Rtimedate.java @@ -13,7 +13,7 @@ public class Test_Rtimedate { // Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); // not needed anymore for self registering JDBC drivers Connection con = DriverManager.getConnection(args[0]); Statement stmt = con.createStatement(); - ResultSet rs = null; + ResultSet rs; //DatabaseMetaData dbmd = con.getMetaData(); con.setAutoCommit(false);
--- a/tests/Test_Smoreresults.java +++ b/tests/Test_Smoreresults.java @@ -21,22 +21,22 @@ public class Test_Smoreresults { try { System.out.print("1. more results?..."); - if (stmt.getMoreResults() != false || stmt.getUpdateCount() != -1) + if (stmt.getMoreResults() || stmt.getUpdateCount() != -1) throw new SQLException("more results on an unitialised Statement, how can that be?"); System.out.println(" nope :)"); System.out.print("2. SELECT 1..."); - if (stmt.execute("SELECT 1;") == false) + if (!stmt.execute("SELECT 1;")) throw new SQLException("SELECT 1 returns update or no results"); System.out.println(" ResultSet :)"); System.out.print("3. more results?..."); - if (stmt.getMoreResults() != false || stmt.getUpdateCount() != -1) + if (stmt.getMoreResults() || stmt.getUpdateCount() != -1) throw new SQLException("more results after SELECT 1 query, how can that be?"); System.out.println(" nope :)"); System.out.print("4. even more results?..."); - if (stmt.getMoreResults() != false || stmt.getUpdateCount() != -1) + if (stmt.getMoreResults() || stmt.getUpdateCount() != -1) throw new SQLException("more results after SELECT 1 query, how can that be?"); System.out.println(" nope :)");
--- a/tests/build.xml +++ b/tests/build.xml @@ -17,7 +17,6 @@ Copyright 1997 - July 2008 CWI, August 2 <project name="JDBCTests" default="compile" basedir="."> - <property file="build.local.properties" /> <property file="build.properties" /> <property file="../build.properties"/> <!-- included for version --> @@ -31,7 +30,7 @@ Copyright 1997 - July 2008 CWI, August 2 value="jdbc:monetdb://localhost/?user=monetdb&password=monetdb${debug}" /> <property name="jdbctests-jar" value="${jardir}/jdbctests.jar" /> - <property name="jvm.version" value="1.7"/> + <property name="jvm.version" value="1.8"/> <!-- Prepares the build directory --> <target name="prepare">