Package nl.cwi.monetdb.embedded.jdbc
Class EmbeddedProtocol
java.lang.Object
nl.cwi.monetdb.mcl.protocol.AbstractProtocol
nl.cwi.monetdb.embedded.jdbc.EmbeddedProtocol
public final class EmbeddedProtocol
extends nl.cwi.monetdb.mcl.protocol.AbstractProtocol
The JDBC abstract protocol implementation on an embedded connection. This Class is just a Proxy Class to access the
JNI mapped methods on the
JDBCEmbeddedConnection instance.- Author:
- Pedro Ferreira
-
Method Summary
Modifier and Type Method Description voidfetchNextResponseData()On an embedded connection, the server response is immediately set, so this method does nothing :)nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponsegetAnEmptyDataBlockResponse(int rowcount, int columncount, nl.cwi.monetdb.mcl.protocol.AbstractProtocol protocol, int[] JdbcSQLTypes, String[] types)Get an empty EmbeddedDataBlockResponse from the server.intgetCurrentServerResponse()Gets the current server response, obtained immediately after a query is performed.nl.cwi.monetdb.mcl.responses.AutoCommitResponsegetNextAutoCommitResponse()Gets the next AutoCommitResponse response from the server.nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponsegetNextDatablockResponse(Map<Integer,nl.cwi.monetdb.mcl.responses.ResultSetResponse> rsresponses)Gets the next DataBlockResponse response from the server, belonging to a ResultSetResponsenl.cwi.monetdb.mcl.responses.ResultSetResponsegetNextResultSetResponse(nl.cwi.monetdb.jdbc.MonetConnection con, nl.cwi.monetdb.jdbc.MonetConnection.ResponseList list, int seqnr, int maxrows)Gets the next ResultSet response from the server, belonging to a ResponseList.intgetNextStarterHeader()Gets the next starter header of a server response.intgetNextTableHeader(String[] columnNames, int[] columnLengths, String[] types, String[] tableNames)Gets the next Table Header for a ResultSetResponse.nl.cwi.monetdb.mcl.responses.UpdateResponsegetNextUpdateResponse()Gets the next UpdateResponse response from the server.StringgetRemainingStringLine(int startIndex)Gets the remaining response line from the underlying connection as a Java String.voidwaitUntilPrompt()On an embedded connection, there is no need to wait for prompt, so this method does nothing :)voidwriteNextQuery(String prefix, String query, String suffix)Writes a user query to the server, while providing the respective prefixes and suffixes depending on the current language and connection used.Methods inherited from class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
getMonetDate, getMonetParserPosition, getMonetTime, getMonetTimePrinter, getMonetTimestamp, getMonetTimestampPrinter, getMonetTimestampTz, getMonetTimestampTzPrinter, getMonetTimeTz, getMonetTimeTzPrinter, getNextSchemaResponse
-
Method Details
-
getCurrentServerResponse
public int getCurrentServerResponse()Gets the current server response, obtained immediately after a query is performed.- Specified by:
getCurrentServerResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Returns:
- The integer representation of
ServerResponses
-
waitUntilPrompt
On an embedded connection, there is no need to wait for prompt, so this method does nothing :)- Specified by:
waitUntilPromptin classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Throws:
IOException- Never thrown :)
-
fetchNextResponseData
On an embedded connection, the server response is immediately set, so this method does nothing :)- Specified by:
fetchNextResponseDatain classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Throws:
IOException- Never thrown :)
-
getNextStarterHeader
public int getNextStarterHeader()Gets the next starter header of a server response.- Specified by:
getNextStarterHeaderin classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Returns:
- The integer representation of
StarterHeaders
-
getNextResultSetResponse
public nl.cwi.monetdb.mcl.responses.ResultSetResponse getNextResultSetResponse(nl.cwi.monetdb.jdbc.MonetConnection con, nl.cwi.monetdb.jdbc.MonetConnection.ResponseList list, int seqnr, int maxrows) throws nl.cwi.monetdb.mcl.protocol.ProtocolExceptionGets the next ResultSet response from the server, belonging to a ResponseList.- Specified by:
getNextResultSetResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
con- The current MonetDB's JDBC connectionlist- The Response List this result set will belong toseqnr- The sequence number of this result set on the Response Listmaxrows- A maxrows to set if so (not used)- Returns:
- The ResultSet instance
- Throws:
nl.cwi.monetdb.mcl.protocol.ProtocolException- If an error in the underlying connection happened.
-
getNextUpdateResponse
public nl.cwi.monetdb.mcl.responses.UpdateResponse getNextUpdateResponse() throws nl.cwi.monetdb.mcl.protocol.ProtocolExceptionGets the next UpdateResponse response from the server.- Specified by:
getNextUpdateResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Returns:
- The UpdateResponse instance
- Throws:
nl.cwi.monetdb.mcl.protocol.ProtocolException- If an error in the underlying connection happened.
-
getNextAutoCommitResponse
public nl.cwi.monetdb.mcl.responses.AutoCommitResponse getNextAutoCommitResponse() throws nl.cwi.monetdb.mcl.protocol.ProtocolExceptionGets the next AutoCommitResponse response from the server.- Specified by:
getNextAutoCommitResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Returns:
- The AutoCommitResponse instance
- Throws:
nl.cwi.monetdb.mcl.protocol.ProtocolException- If an error in the underlying connection happened.
-
getAnEmptyDataBlockResponse
public nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponse getAnEmptyDataBlockResponse(int rowcount, int columncount, nl.cwi.monetdb.mcl.protocol.AbstractProtocol protocol, int[] JdbcSQLTypes, String[] types)Get an empty EmbeddedDataBlockResponse from the server.- Specified by:
getAnEmptyDataBlockResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
rowcount- - Number of tuplescolumncount- - Number of tuplesprotocol- - This protocolJdbcSQLTypes- - the types arraytypes- - the description of the types array- Returns:
- An EmbeddedDataBlockResponse instance
-
getNextDatablockResponse
public nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponse getNextDatablockResponse(Map<Integer,nl.cwi.monetdb.mcl.responses.ResultSetResponse> rsresponses) throws nl.cwi.monetdb.mcl.protocol.ProtocolExceptionGets the next DataBlockResponse response from the server, belonging to a ResultSetResponse- Specified by:
getNextDatablockResponsein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
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.- Returns:
- The DataBlockResponse instance
- Throws:
nl.cwi.monetdb.mcl.protocol.ProtocolException- If an error in the underlying connection happened.
-
getNextTableHeader
public int getNextTableHeader(String[] columnNames, int[] columnLengths, String[] types, String[] tableNames) throws nl.cwi.monetdb.mcl.protocol.ProtocolExceptionGets the next Table Header for a ResultSetResponse. More than one of the parameter arrays can be filled at once.- Specified by:
getNextTableHeaderin classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
columnNames- The column names arraycolumnLengths- The column lengths arraytypes- The columns SQL names arraytableNames- The columns schemas and names in format schema.table- Returns:
- Always TableResultHeaders.ALL
- Throws:
nl.cwi.monetdb.mcl.protocol.ProtocolException- If an error in the underlying connection happened.
-
getRemainingStringLine
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.- Specified by:
getRemainingStringLinein classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
startIndex- The first index in the response line to retrieve the String (ignored)- Returns:
- The String representation of the line starting at the provided index
-
writeNextQuery
Writes a user query to the server, while providing the respective prefixes and suffixes depending on the current language and connection used. On an embedded connection, the prefix and the suffix are ignored.- Specified by:
writeNextQueryin classnl.cwi.monetdb.mcl.protocol.AbstractProtocol- Parameters:
prefix- The prefix to append at the beginning of the query string (ignored)query- The user query to submit to the serversuffix- The suffix to append at the end of the query string (ignored)- Throws:
IOException- If an error in the underlying connection happened.
-