public class Session extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Session.AbstractResultSetReader
Reads a JDBC-result-set.
|
static interface |
Session.ResultSetReader
Reads a JDBC-result-set.
|
| Modifier and Type | Field and Description |
|---|---|
static Logger |
_log
The logger.
|
DBMS |
dbms
The DBMS.
|
String |
dbUrl
The dbUrl (
null if unknown) |
boolean |
local |
WorkingTableScope |
scope
Scope of temporary tables.
|
| Constructor and Description |
|---|
Session(DataSource dataSource,
DBMS dbms)
Constructor.
|
Session(DataSource dataSource,
DBMS dbms,
WorkingTableScope scope,
boolean transactional)
Constructor.
|
Session(DataSource dataSource,
DBMS dbms,
WorkingTableScope scope,
boolean transactional,
boolean local)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
closeTemporaryTableSession()
Closes the session in which temporary tables lives, if any.
|
void |
commitAll()
Commits all connections.
|
void |
enableAutomaticReconnect() |
long |
execute(String sql)
Executes a SQL-Statement without returning any result.
|
void |
executeQuery(File sqlFile,
Session.ResultSetReader reader)
Executes a SQL-Query (SELECT).
|
long |
executeQuery(String sqlQuery,
Session.ResultSetReader reader)
Executes a SQL-Query (SELECT).
|
long |
executeQuery(String sqlQuery,
Session.ResultSetReader reader,
String alternativeSQL,
Object context,
int limit)
Executes a SQL-Query (SELECT).
|
long |
executeQuery(String sqlQuery,
Session.ResultSetReader reader,
String alternativeSQL,
Object context,
int limit,
int timeout)
Executes a SQL-Query (SELECT) with timeout.
|
int |
executeUpdate(String sqlUpdate)
Executes a SQL-Update (INSERT, DELETE or UPDATE).
|
int |
executeUpdate(String sqlUpdate,
Object[] parameter)
Executes a SQL-Update (INSERT, DELETE or UPDATE) with parameters.
|
List<String> |
getCliArguments()
Gets CLI connection arguments (UI support)
|
Connection |
getConnection()
Gets the connection for the current thread.
|
InlineViewStyle |
getInlineViewStyle()
Returns a suitable
InlineViewStyle for this session. |
String |
getIntrospectionSchema()
Gets optional schema for database analysis.
|
DatabaseMetaData |
getMetaData()
Gets DB meta data.
|
String |
getPassword()
Gets connection password (UI support)
|
String |
getSchema()
Gets DB schema name.
|
Object |
getSessionProperty(Class<?> owner,
String name)
Gets a session property.
|
boolean |
getSilent()
No SQL-Exceptions will be logged in silent mode.
|
void |
insertBlob(String table,
String column,
String where,
File lobFile)
Inserts a BLob.
|
void |
insertClob(String table,
String column,
String where,
File lobFile,
long length)
Inserts a CLob.
|
void |
insertSQLXML(String table,
String column,
String where,
File lobFile,
long length)
Inserts a SQL-XML.
|
void |
reconnect()
Closes current connection and opens a new one.
|
void |
rollbackAll()
Rolls back and closes all connections.
|
void |
setCliArguments(List<String> args)
Sets CLI connection arguments (UI support)
|
void |
setIntrospectionSchema(String introspectionSchema)
Sets optional schema for database analysis.
|
void |
setPassword(String password)
Sets connection password (UI support)
|
void |
setSessionProperty(Class<?> owner,
String name,
Object property)
Sets a session property.
|
void |
setSilent(boolean silent)
No SQL-Exceptions will be logged in silent mode.
|
void |
shutDown()
Closes all connections.
|
public final WorkingTableScope scope
public final boolean local
public static final Logger _log
public final DBMS dbms
public final String dbUrl
null if unknown)public Session(DataSource dataSource, DBMS dbms) throws SQLException
dataSource - the data sourceschema - the schemadbms - the DBMSSQLExceptionpublic Session(DataSource dataSource, DBMS dbms, WorkingTableScope scope, boolean transactional) throws SQLException
dataSource - the data sourcedbms - the DBMSSQLExceptionpublic Session(DataSource dataSource, DBMS dbms, WorkingTableScope scope, boolean transactional, boolean local) throws SQLException
dataSource - the data sourcedbms - the DBMSlocal - true for the local entity-graph databaseSQLExceptionpublic void reconnect()
throws SQLException
SQLExceptionpublic void setSilent(boolean silent)
silent - true for silencepublic boolean getSilent()
true for silencepublic String getSchema()
public long executeQuery(String sqlQuery, Session.ResultSetReader reader) throws SQLException
sqlQuery - the query in SQLreader - the reader for the resultSQLExceptionpublic long executeQuery(String sqlQuery, Session.ResultSetReader reader, String alternativeSQL, Object context, int limit) throws SQLException
sqlQuery - the query in SQLreader - the reader for the resultalternativeSQL - query to be executed if sqlQuery failslimit - row limit, 0 for unlimitedcontext - cancellation contextSQLExceptionpublic long executeQuery(String sqlQuery, Session.ResultSetReader reader, String alternativeSQL, Object context, int limit, int timeout) throws SQLException
sqlQuery - the query in SQLreader - the reader for the resultalternativeSQL - query to be executed if sqlQuery failslimit - row limit, 0 for unlimitedcontext - cancellation contexttimeout - the timeout in secSQLExceptionpublic void executeQuery(File sqlFile, Session.ResultSetReader reader) throws SQLException
sqlFile - file containing a query in SQLreader - the reader for the resultSQLExceptionpublic int executeUpdate(String sqlUpdate) throws SQLException
sqlUpdate - the update in SQLSQLExceptionpublic int executeUpdate(String sqlUpdate, Object[] parameter) throws SQLException
sqlUpdate - the update in SQLparameter - the parametersSQLExceptionpublic void insertClob(String table, String column, String where, File lobFile, long length) throws SQLException, IOException
SQLExceptionIOExceptionpublic void insertSQLXML(String table, String column, String where, File lobFile, long length) throws SQLException, IOException
SQLExceptionIOExceptionpublic void insertBlob(String table, String column, String where, File lobFile) throws SQLException, IOException
SQLExceptionIOExceptionpublic long execute(String sql) throws SQLException
sql - the SQL-StatementSQLExceptionpublic DatabaseMetaData getMetaData() throws SQLException
SQLExceptionpublic void shutDown()
throws SQLException
SQLExceptionpublic void rollbackAll()
throws SQLException
SQLExceptionpublic void commitAll()
throws SQLException
SQLExceptionpublic String getIntrospectionSchema()
public void setIntrospectionSchema(String introspectionSchema)
introspectionSchema - optional schema for database analysispublic static void closeTemporaryTableSession()
public String getPassword()
public void setPassword(String password)
public void setCliArguments(List<String> args)
public Connection getConnection() throws SQLException
SQLExceptionpublic InlineViewStyle getInlineViewStyle()
InlineViewStyle for this session.InlineViewStyle for this session or null, if no style is foundpublic void setSessionProperty(Class<?> owner, String name, Object property)
owner - the class that owns the propertyname - name of the propertyproperty - value of the propertypublic Object getSessionProperty(Class<?> owner, String name)
owner - the class that owns the propertyname - name of the propertypublic void enableAutomaticReconnect()