Class SessionImpl

java.lang.Object
com.mysql.cj.xdevapi.SessionImpl
All Implemented Interfaces:
Session

public class SessionImpl
extends java.lang.Object
implements Session
Session implementation.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    protected java.lang.String defaultSchemaName  
    protected MysqlxSession session  
  • Constructor Summary

    Constructors 
    Modifier Constructor Description
    protected SessionImpl()  
      SessionImpl​(HostInfo hostInfo)
    Constructor.
      SessionImpl​(XProtocol prot)  
  • Method Summary

    Modifier and Type Method Description
    void close()
    Close this session.
    void commit()
    Commit the transaction.
    Schema createSchema​(java.lang.String schemaName)
    Create and return a new schema with the name given by name.
    Schema createSchema​(java.lang.String schemaName, boolean reuseExistingObject)
    Create and return a new schema with the name given by name.
    void dropSchema​(java.lang.String schemaName)
    Drop the existing schema with the name given by name.
    Schema getDefaultSchema()
    Retrieve the default schema which may be configured at connect time.
    java.lang.String getDefaultSchemaName()
    Retrieve the default schema name which may be configured at connect time.
    Schema getSchema​(java.lang.String schemaName)
    Retrieve the Schema corresponding to name.
    java.util.List<Schema> getSchemas()
    Retrieve the list of Schema objects for which the current user has access.
    MysqlxSession getSession()  
    java.lang.String getUri()
    Get the URL used to create this session.
    boolean isOpen()
    Is this session open?
    void releaseSavepoint​(java.lang.String name)
    Releases the named savepoint.
    void rollback()
    Rollback the transaction.
    void rollbackTo​(java.lang.String name)
    Rolls back the transaction to the named savepoint.
    java.lang.String setSavepoint()
    Creates a transaction savepoint with an implementation-defined generated name and returns its name, which can be used in Session.rollbackTo(String) or Session.releaseSavepoint(String).
    java.lang.String setSavepoint​(java.lang.String name)
    Creates or replaces a transaction savepoint with the given name.
    SqlStatementImpl sql​(java.lang.String sql)
    Create a native SQL command.
    void startTransaction()
    Start a new transaction.

    Methods inherited from class java.lang.Object

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

  • Constructor Details

  • Method Details

    • getSchemas

      public java.util.List<Schema> getSchemas()
      Description copied from interface: Session
      Retrieve the list of Schema objects for which the current user has access.
      Specified by:
      getSchemas in interface Session
      Returns:
      list of Schema objects
    • getSchema

      public Schema getSchema​(java.lang.String schemaName)
      Description copied from interface: Session
      Retrieve the Schema corresponding to name.
      Specified by:
      getSchema in interface Session
      Parameters:
      schemaName - name of schema to retrieve
      Returns:
      Schema
    • getDefaultSchemaName

      public java.lang.String getDefaultSchemaName()
      Description copied from interface: Session
      Retrieve the default schema name which may be configured at connect time.
      Specified by:
      getDefaultSchemaName in interface Session
      Returns:
      default schema name
    • getDefaultSchema

      public Schema getDefaultSchema()
      Description copied from interface: Session
      Retrieve the default schema which may be configured at connect time.
      Specified by:
      getDefaultSchema in interface Session
      Returns:
      default Schema
    • createSchema

      public Schema createSchema​(java.lang.String schemaName)
      Description copied from interface: Session
      Create and return a new schema with the name given by name.
      Specified by:
      createSchema in interface Session
      Parameters:
      schemaName - name of schema to create
      Returns:
      Schema created
    • createSchema

      public Schema createSchema​(java.lang.String schemaName, boolean reuseExistingObject)
      Description copied from interface: Session
      Create and return a new schema with the name given by name. If the schema already exists, a reference to it is returned.
      Specified by:
      createSchema in interface Session
      Parameters:
      schemaName - name of schema to create
      reuseExistingObject - true to reuse
      Returns:
      Schema created
    • dropSchema

      public void dropSchema​(java.lang.String schemaName)
      Description copied from interface: Session
      Drop the existing schema with the name given by name.
      Specified by:
      dropSchema in interface Session
      Parameters:
      schemaName - name of schema to drop
    • startTransaction

      public void startTransaction()
      Description copied from interface: Session
      Start a new transaction.
      Specified by:
      startTransaction in interface Session
    • commit

      public void commit()
      Description copied from interface: Session
      Commit the transaction.
      Specified by:
      commit in interface Session
    • rollback

      public void rollback()
      Description copied from interface: Session
      Rollback the transaction.
      Specified by:
      rollback in interface Session
    • setSavepoint

      public java.lang.String setSavepoint()
      Description copied from interface: Session
      Creates a transaction savepoint with an implementation-defined generated name and returns its name, which can be used in Session.rollbackTo(String) or Session.releaseSavepoint(String). Calling this method more than once should always work. The generated name shall be unique per session.
      Specified by:
      setSavepoint in interface Session
      Returns:
      savepoint name
    • setSavepoint

      public java.lang.String setSavepoint​(java.lang.String name)
      Description copied from interface: Session
      Creates or replaces a transaction savepoint with the given name. Calling this method more than once should always work.
      Specified by:
      setSavepoint in interface Session
      Parameters:
      name - savepoint name
      Returns:
      savepoint name
    • rollbackTo

      public void rollbackTo​(java.lang.String name)
      Description copied from interface: Session
      Rolls back the transaction to the named savepoint. This method will succeed as long as the given save point has not been already rolled back or released. Rolling back to a savepoint prior to the one named will release or rollback any that came after.
      Specified by:
      rollbackTo in interface Session
      Parameters:
      name - savepoint name
    • releaseSavepoint

      public void releaseSavepoint​(java.lang.String name)
      Description copied from interface: Session
      Releases the named savepoint. This method will succeed as long as the given save point has not been already rolled back or released. Rolling back to a savepoint prior to the one named will release or rollback any that came after.
      Specified by:
      releaseSavepoint in interface Session
      Parameters:
      name - savepoint name
    • getUri

      public java.lang.String getUri()
      Description copied from interface: Session
      Get the URL used to create this session.
      Specified by:
      getUri in interface Session
      Returns:
      URI
    • isOpen

      public boolean isOpen()
      Description copied from interface: Session
      Is this session open?
      Specified by:
      isOpen in interface Session
      Returns:
      true if session is open
    • close

      public void close()
      Description copied from interface: Session
      Close this session.
      Specified by:
      close in interface Session
    • sql

      public SqlStatementImpl sql​(java.lang.String sql)
      Description copied from interface: Session
      Create a native SQL command. Placeholders are supported using the native "?" syntax.
      Specified by:
      sql in interface Session
      Parameters:
      sql - native SQL statement
      Returns:
      SqlStatement
    • getSession

      public MysqlxSession getSession()