Package com.mysql.cj.xdevapi
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.StringdefaultSchemaNameprotected MysqlxSessionsession -
Constructor Summary
Constructors Modifier Constructor Description protectedSessionImpl()SessionImpl(HostInfo hostInfo)Constructor.SessionImpl(XProtocol prot) -
Method Summary
Modifier and Type Method Description voidclose()Close this session.voidcommit()Commit the transaction.SchemacreateSchema(java.lang.String schemaName)Create and return a new schema with the name given by name.SchemacreateSchema(java.lang.String schemaName, boolean reuseExistingObject)Create and return a new schema with the name given by name.voiddropSchema(java.lang.String schemaName)Drop the existing schema with the name given by name.SchemagetDefaultSchema()Retrieve the default schema which may be configured at connect time.java.lang.StringgetDefaultSchemaName()Retrieve the default schema name which may be configured at connect time.SchemagetSchema(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.MysqlxSessiongetSession()java.lang.StringgetUri()Get the URL used to create this session.booleanisOpen()Is this session open?voidreleaseSavepoint(java.lang.String name)Releases the named savepoint.voidrollback()Rollback the transaction.voidrollbackTo(java.lang.String name)Rolls back the transaction to the named savepoint.java.lang.StringsetSavepoint()Creates a transaction savepoint with an implementation-defined generated name and returns its name, which can be used inSession.rollbackTo(String)orSession.releaseSavepoint(String).java.lang.StringsetSavepoint(java.lang.String name)Creates or replaces a transaction savepoint with the given name.SqlStatementImplsql(java.lang.String sql)Create a native SQL command.voidstartTransaction()Start a new transaction.
-
Field Details
-
session
-
defaultSchemaName
protected java.lang.String defaultSchemaName
-
-
Constructor Details
-
SessionImpl
Constructor.- Parameters:
hostInfo-HostInfoinstance
-
SessionImpl
-
SessionImpl
protected SessionImpl()
-
-
Method Details
-
getSchemas
Description copied from interface:SessionRetrieve the list of Schema objects for which the current user has access.- Specified by:
getSchemasin interfaceSession- Returns:
- list of Schema objects
-
getSchema
Description copied from interface:SessionRetrieve the Schema corresponding to name. -
getDefaultSchemaName
public java.lang.String getDefaultSchemaName()Description copied from interface:SessionRetrieve the default schema name which may be configured at connect time.- Specified by:
getDefaultSchemaNamein interfaceSession- Returns:
- default schema name
-
getDefaultSchema
Description copied from interface:SessionRetrieve the default schema which may be configured at connect time.- Specified by:
getDefaultSchemain interfaceSession- Returns:
- default
Schema
-
createSchema
Description copied from interface:SessionCreate and return a new schema with the name given by name.- Specified by:
createSchemain interfaceSession- Parameters:
schemaName- name of schema to create- Returns:
Schemacreated
-
createSchema
Description copied from interface:SessionCreate and return a new schema with the name given by name. If the schema already exists, a reference to it is returned.- Specified by:
createSchemain interfaceSession- Parameters:
schemaName- name of schema to createreuseExistingObject- true to reuse- Returns:
Schemacreated
-
dropSchema
public void dropSchema(java.lang.String schemaName)Description copied from interface:SessionDrop the existing schema with the name given by name.- Specified by:
dropSchemain interfaceSession- Parameters:
schemaName- name of schema to drop
-
startTransaction
public void startTransaction()Description copied from interface:SessionStart a new transaction.- Specified by:
startTransactionin interfaceSession
-
commit
public void commit()Description copied from interface:SessionCommit the transaction. -
rollback
public void rollback()Description copied from interface:SessionRollback the transaction. -
setSavepoint
public java.lang.String setSavepoint()Description copied from interface:SessionCreates a transaction savepoint with an implementation-defined generated name and returns its name, which can be used inSession.rollbackTo(String)orSession.releaseSavepoint(String). Calling this method more than once should always work. The generated name shall be unique per session.- Specified by:
setSavepointin interfaceSession- Returns:
- savepoint name
-
setSavepoint
public java.lang.String setSavepoint(java.lang.String name)Description copied from interface:SessionCreates or replaces a transaction savepoint with the given name. Calling this method more than once should always work.- Specified by:
setSavepointin interfaceSession- Parameters:
name- savepoint name- Returns:
- savepoint name
-
rollbackTo
public void rollbackTo(java.lang.String name)Description copied from interface:SessionRolls 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:
rollbackToin interfaceSession- Parameters:
name- savepoint name
-
releaseSavepoint
public void releaseSavepoint(java.lang.String name)Description copied from interface:SessionReleases 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:
releaseSavepointin interfaceSession- Parameters:
name- savepoint name
-
getUri
public java.lang.String getUri()Description copied from interface:SessionGet the URL used to create this session. -
isOpen
public boolean isOpen()Description copied from interface:SessionIs this session open? -
close
public void close()Description copied from interface:SessionClose this session. -
sql
Description copied from interface:SessionCreate a native SQL command. Placeholders are supported using the native "?" syntax.- Specified by:
sqlin interfaceSession- Parameters:
sql- native SQL statement- Returns:
SqlStatement
-
getSession
-