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
    void fetchNextResponseData()
    On an embedded connection, the server response is immediately set, so this method does nothing :)
    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.
    int getCurrentServerResponse()
    Gets the current server response, obtained immediately after a query is performed.
    nl.cwi.monetdb.mcl.responses.AutoCommitResponse getNextAutoCommitResponse()
    Gets the next AutoCommitResponse response from the server.
    nl.cwi.monetdb.mcl.responses.AbstractDataBlockResponse getNextDatablockResponse​(Map<Integer,​nl.cwi.monetdb.mcl.responses.ResultSetResponse> rsresponses)
    Gets the next DataBlockResponse response from the server, belonging to a ResultSetResponse
    nl.cwi.monetdb.mcl.responses.ResultSetResponse getNextResultSetResponse​(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.
    int getNextStarterHeader()
    Gets the next starter header of a server response.
    int getNextTableHeader​(String[] columnNames, int[] columnLengths, String[] types, String[] tableNames)
    Gets the next Table Header for a ResultSetResponse.
    nl.cwi.monetdb.mcl.responses.UpdateResponse getNextUpdateResponse()
    Gets the next UpdateResponse response from the server.
    String getRemainingStringLine​(int startIndex)
    Gets the remaining response line from the underlying connection as a Java String.
    void waitUntilPrompt()
    On an embedded connection, there is no need to wait for prompt, so this method does nothing :)
    void writeNextQuery​(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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCurrentServerResponse

      public int getCurrentServerResponse()
      Gets the current server response, obtained immediately after a query is performed.
      Specified by:
      getCurrentServerResponse in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Returns:
      The integer representation of ServerResponses
    • waitUntilPrompt

      public void waitUntilPrompt() throws IOException
      On an embedded connection, there is no need to wait for prompt, so this method does nothing :)
      Specified by:
      waitUntilPrompt in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Throws:
      IOException - Never thrown :)
    • fetchNextResponseData

      public void fetchNextResponseData() throws IOException
      On an embedded connection, the server response is immediately set, so this method does nothing :)
      Specified by:
      fetchNextResponseData in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Throws:
      IOException - Never thrown :)
    • getNextStarterHeader

      public int getNextStarterHeader()
      Gets the next starter header of a server response.
      Specified by:
      getNextStarterHeader in class nl.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.ProtocolException
      Gets the next ResultSet response from the server, belonging to a ResponseList.
      Specified by:
      getNextResultSetResponse in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Parameters:
      con - The current MonetDB's JDBC connection
      list - The Response List this result set will belong to
      seqnr - The sequence number of this result set on the Response List
      maxrows - 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.ProtocolException
      Gets the next UpdateResponse response from the server.
      Specified by:
      getNextUpdateResponse in class nl.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.ProtocolException
      Gets the next AutoCommitResponse response from the server.
      Specified by:
      getNextAutoCommitResponse in class nl.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:
      getAnEmptyDataBlockResponse in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Parameters:
      rowcount - - Number of tuples
      columncount - - Number of tuples
      protocol - - This protocol
      JdbcSQLTypes - - the types array
      types - - 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.ProtocolException
      Gets the next DataBlockResponse response from the server, belonging to a ResultSetResponse
      Specified by:
      getNextDatablockResponse in class nl.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.ProtocolException
      Gets the next Table Header for a ResultSetResponse. More than one of the parameter arrays can be filled at once.
      Specified by:
      getNextTableHeader in class nl.cwi.monetdb.mcl.protocol.AbstractProtocol
      Parameters:
      columnNames - The column names array
      columnLengths - The column lengths array
      types - The columns SQL names array
      tableNames - 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

      public String getRemainingStringLine​(int startIndex)
      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:
      getRemainingStringLine in class nl.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

      public void writeNextQuery​(String prefix, String query, String suffix) throws IOException
      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:
      writeNextQuery in class nl.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 server
      suffix - The suffix to append at the end of the query string (ignored)
      Throws:
      IOException - If an error in the underlying connection happened.