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.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 inSession.rollbackTo(String)
orSession.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.
-
Field Details
-
session
-
defaultSchemaName
protected java.lang.String defaultSchemaName
-
-
Constructor Details
-
SessionImpl
Constructor.- Parameters:
hostInfo
-HostInfo
instance
-
SessionImpl
-
SessionImpl
protected SessionImpl()
-
-
Method Details
-
getSchemas
Description copied from interface:Session
Retrieve the list of Schema objects for which the current user has access.- Specified by:
getSchemas
in interfaceSession
- Returns:
- list of Schema objects
-
getSchema
Description copied from interface:Session
Retrieve the Schema corresponding to name. -
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 interfaceSession
- Returns:
- default schema name
-
getDefaultSchema
Description copied from interface:Session
Retrieve the default schema which may be configured at connect time.- Specified by:
getDefaultSchema
in interfaceSession
- Returns:
- default
Schema
-
createSchema
Description copied from interface:Session
Create and return a new schema with the name given by name.- Specified by:
createSchema
in interfaceSession
- Parameters:
schemaName
- name of schema to create- Returns:
Schema
created
-
createSchema
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 interfaceSession
- Parameters:
schemaName
- name of schema to createreuseExistingObject
- 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 interfaceSession
- Parameters:
schemaName
- name of schema to drop
-
startTransaction
public void startTransaction()Description copied from interface:Session
Start a new transaction.- Specified by:
startTransaction
in interfaceSession
-
commit
public void commit()Description copied from interface:Session
Commit the transaction. -
rollback
public void rollback()Description copied from interface:Session
Rollback the transaction. -
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 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:
setSavepoint
in interfaceSession
- 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 interfaceSession
- 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 interfaceSession
- 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 interfaceSession
- Parameters:
name
- savepoint name
-
getUri
public java.lang.String getUri()Description copied from interface:Session
Get the URL used to create this session. -
isOpen
public boolean isOpen()Description copied from interface:Session
Is this session open? -
close
public void close()Description copied from interface:Session
Close this session. -
sql
Description copied from interface:Session
Create a native SQL command. Placeholders are supported using the native "?" syntax.- Specified by:
sql
in interfaceSession
- Parameters:
sql
- native SQL statement- Returns:
SqlStatement
-
getSession
-