Changeset: 551093abca52 for monetdb-java
URL: http://dev.monetdb.org/hg/monetdb-java?cmd=changeset;node=551093abca52
Modified Files:
src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java
src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java
src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java
src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java
src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
tests/Test_Clargequery.java
tests/Test_Cmanycon.java
tests/Test_Int128.java
tests/Test_PSmanycon.java
tests/Test_PSmetadata.java
tests/Test_PSsqldata.java
tests/Test_PStimedate.java
tests/Test_PStimezone.java
tests/Test_PStypes.java
tests/Test_Rbooleans.java
tests/Test_Rmetadata.java
tests/Test_Rsqldata.java
tests/Test_Rtimedate.java
tests/Test_Smoreresults.java
tests/build.xml
Branch: embedded
Log Message:
More documentation and fixed some tests.
diffs (truncated from 771 to 300 lines):
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
b/src/main/java/nl/cwi/monetdb/jdbc/MonetConnection.java
--- 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
diff --git a/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
b/src/main/java/nl/cwi/monetdb/jdbc/MonetDriver.java.in
--- 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
diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/ControlCommands.java
--- 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) */
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiConnection.java
--- 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
diff --git a/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
b/src/main/java/nl/cwi/monetdb/mcl/connection/mapi/MapiLanguage.java
--- 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 {
diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/AbstractProtocol.java
--- 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.
*/
diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/ServerResponses.java
--- 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;
diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/StarterHeaders.java
--- 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;
diff --git a/src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/TableResultHeaders.java
--- 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;
diff --git
a/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
b/src/main/java/nl/cwi/monetdb/mcl/protocol/oldmapi/OldMapiProtocol.java
--- 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).
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list