Package com.mysql.cj

Class MysqlxSession

java.lang.Object
com.mysql.cj.CoreSession
com.mysql.cj.MysqlxSession
All Implemented Interfaces:
Session

public class MysqlxSession
extends CoreSession
  • Constructor Details

  • Method Details

    • getProcessHost

      public java.lang.String getProcessHost()
    • getPort

      public int getPort()
    • getProtocol

      public XProtocol getProtocol()
    • quit

      public void quit()
      Description copied from interface: Session
      Log-off of the MySQL server and close the socket.
      Specified by:
      quit in interface Session
      Overrides:
      quit in class CoreSession
    • isClosed

      public boolean isClosed()
    • supportsPreparedStatements

      public boolean supportsPreparedStatements()
      Check if current session is using a MySQL server that supports prepared statements.
      Returns:
      true if the MySQL server in use supports prepared statements
    • readyForPreparingStatements

      public boolean readyForPreparingStatements()
      Check if enough statements were executed in the underlying MySQL server so that another prepare statement attempt should be done.
      Returns:
      true if enough executions have been done since last time a prepared statement failed to be prepared
    • getNewPreparedStatementId

      public int getNewPreparedStatementId​(PreparableStatement<?> preparableStatement)
      Return an id to be used as a client-managed prepared statement id.
      Parameters:
      preparableStatement - PreparableStatement
      Returns:
      a new identifier to be used as prepared statement id
    • freePreparedStatementId

      public void freePreparedStatementId​(int preparedStatementId)
      Free a prepared statement id so that it can be reused.
      Parameters:
      preparedStatementId - the prepared statement id to release
    • failedPreparingStatement

      public boolean failedPreparingStatement​(int preparedStatementId, XProtocolError e)
      Propagate to the underlying protocol instance that preparing a statement on the connected server failed.
      Parameters:
      preparedStatementId - the id of the prepared statement that failed to be prepared
      e - XProtocolError
      Returns:
      true if the exception was properly handled
    • query

      public <M extends Message,​ R,​ RES> RES query​(M message, java.util.function.Predicate<Row> rowFilter, java.util.function.Function<Row,​R> rowMapper, java.util.stream.Collector<R,​?,​RES> collector)
      Description copied from interface: Session
      Synchronously query database with applying rows filtering and mapping.
      Type Parameters:
      M - Message type
      R - Row type
      RES - Result type
      Parameters:
      message - query message
      rowFilter - row filter function
      rowMapper - row map function
      collector - result collector
      Returns:
      List of rows
    • query

      public <M extends Message,​ R extends QueryResult> R query​(M message, ResultBuilder<R> resultBuilder)
      Description copied from interface: Session
      Synchronously query database.
      Type Parameters:
      M - Message type
      R - Result type
      Parameters:
      message - query message
      resultBuilder - ResultBuilder instance
      Returns:
      QueryResult object
    • queryAsync

      public <M extends Message,​ R extends QueryResult> java.util.concurrent.CompletableFuture<R> queryAsync​(M message, ResultBuilder<R> resultBuilder)
      Description copied from interface: Session
      Asynchronously query database.
      Type Parameters:
      M - Message type
      R - Result type
      Parameters:
      message - query message
      resultBuilder - ResultBuilder instance
      Returns:
      CompletableFuture providing a QueryResult object