public class MConnection extends Object implements Connection, DatabaseCallBack
This object is thread safe. It may be accessed safely from concurrent threads.
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE| Constructor and Description |
|---|
MConnection(String url,
DatabaseInterface db_interface,
int cache_size,
int max_size)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
abort(Executor executor) |
protected void |
addSQLWarning(SQLWarning warning)
Adds a new SQLWarning to the chain.
|
void |
clearWarnings() |
void |
close() |
void |
commit() |
Array |
createArrayOf(String typeName,
Object[] elements) |
Blob |
createBlob() |
Clob |
createClob() |
NClob |
createNClob() |
SQLXML |
createSQLXML() |
Statement |
createStatement() |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency) |
Statement |
createStatement(int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
Struct |
createStruct(String typeName,
Object[] attributes) |
void |
databaseEvent(int event_type,
String event_message)
Called when the database has generated an event that this user is
listening for.
|
boolean |
getAutoCommit() |
String |
getCatalog() |
Properties |
getClientInfo() |
String |
getClientInfo(String name) |
int |
getHoldability() |
DatabaseMetaData |
getMetaData() |
int |
getNetworkTimeout() |
protected com.mckoi.database.jdbc.RowCache |
getRowCache()
Returns the row Cache object for this connection.
|
String |
getSchema() |
int |
getTransactionIsolation() |
Map |
getTypeMap() |
SQLWarning |
getWarnings() |
void |
internalClose()
Closes this connection by calling the 'dispose' method in the database
interface.
|
boolean |
isCaseInsensitiveIdentifiers()
Returns true if the database has case insensitive identifiers.
|
boolean |
isClosed() |
boolean |
isReadOnly() |
boolean |
isStrictGetObject()
Returns true if strict get object is enabled (default).
|
boolean |
isValid(int timeout) |
boolean |
isWrapperFor(Class iface) |
void |
login(String default_schema,
String username,
String password)
Attempts to login to the database interface with the given default schema,
username and password.
|
String |
nativeSQL(String sql) |
CallableStatement |
prepareCall(String sql) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency) |
CallableStatement |
prepareCall(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql) |
PreparedStatement |
prepareStatement(String sql,
int autoGeneratedKeys) |
PreparedStatement |
prepareStatement(String sql,
int[] columnIndexes) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency) |
PreparedStatement |
prepareStatement(String sql,
int resultSetType,
int resultSetConcurrency,
int resultSetHoldability) |
PreparedStatement |
prepareStatement(String sql,
String[] columnNames) |
void |
releaseSavepoint(Savepoint savepoint) |
void |
rollback() |
void |
rollback(Savepoint savepoint) |
void |
setAutoCommit(boolean autoCommit) |
void |
setCaseInsensitiveIdentifiers(boolean status)
Toggles whether this connection is handling identifiers as case
insensitive or not.
|
void |
setCatalog(String catalog) |
void |
setClientInfo(Properties properties) |
void |
setClientInfo(String name,
String value) |
void |
setHoldability(int holdability) |
void |
setNetworkTimeout(Executor executor,
int timeout) |
void |
setReadOnly(boolean readOnly) |
Savepoint |
setSavepoint() |
Savepoint |
setSavepoint(String name) |
void |
setSchema(String schema) |
void |
setStrictGetObject(boolean status)
Toggles strict get object.
|
void |
setTransactionIsolation(int level) |
void |
setTypeMap(Map map) |
void |
setVerboseColumnNames(boolean status)
Toggles verbose column names from ResultSetMetaData.
|
Object |
unwrap(Class iface) |
boolean |
verboseColumnNames()
Returns true if ResultSetMetaData should return verbose column names.
|
public MConnection(String url, DatabaseInterface db_interface, int cache_size, int max_size)
public void setStrictGetObject(boolean status)
If the 'getObject' method should return the raw object type (eg. BigDecimal for Integer, String for chars, etc) then this is set to false. If this is true (the default) the 'getObject' methods return the correct object types as specified by the JDBC specification.
The default is true.
public boolean isStrictGetObject()
public void setVerboseColumnNames(boolean status)
If this is set to true, getColumnName will return 'APP.Part.id' for a column name. If it is false getColumnName will return 'id'. This property is for compatibility with older Mckoi applications.
public boolean verboseColumnNames()
public void setCaseInsensitiveIdentifiers(boolean status)
public boolean isCaseInsensitiveIdentifiers()
protected final com.mckoi.database.jdbc.RowCache getRowCache()
protected final void addSQLWarning(SQLWarning warning)
public final void internalClose()
throws SQLException
SQLExceptionpublic void login(String default_schema, String username, String password) throws SQLException
SQLExceptionpublic void databaseEvent(int event_type,
String event_message)
DatabaseCallBackNOTE: The thread that calls back these events is always a volatile thread that may not block. It is especially important that no queries are executed when this calls back. To safely act on events, it is advisable to dispatch onto another thread such as the SwingEventDispatcher thread.
databaseEvent in interface DatabaseCallBackpublic Statement createStatement() throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic String nativeSQL(String sql) throws SQLException
nativeSQL in interface ConnectionSQLExceptionpublic void setAutoCommit(boolean autoCommit)
throws SQLException
setAutoCommit in interface ConnectionSQLExceptionpublic boolean getAutoCommit()
throws SQLException
getAutoCommit in interface ConnectionSQLExceptionpublic void commit()
throws SQLException
commit in interface ConnectionSQLExceptionpublic void rollback()
throws SQLException
rollback in interface ConnectionSQLExceptionpublic void close()
throws SQLException
close in interface AutoCloseableclose in interface ConnectionSQLExceptionpublic boolean isClosed()
throws SQLException
isClosed in interface ConnectionSQLExceptionpublic DatabaseMetaData getMetaData() throws SQLException
getMetaData in interface ConnectionSQLExceptionpublic void setReadOnly(boolean readOnly)
throws SQLException
setReadOnly in interface ConnectionSQLExceptionpublic boolean isReadOnly()
throws SQLException
isReadOnly in interface ConnectionSQLExceptionpublic void setCatalog(String catalog) throws SQLException
setCatalog in interface ConnectionSQLExceptionpublic String getCatalog() throws SQLException
getCatalog in interface ConnectionSQLExceptionpublic void setTransactionIsolation(int level)
throws SQLException
setTransactionIsolation in interface ConnectionSQLExceptionpublic int getTransactionIsolation()
throws SQLException
getTransactionIsolation in interface ConnectionSQLExceptionpublic SQLWarning getWarnings() throws SQLException
getWarnings in interface ConnectionSQLExceptionpublic void clearWarnings()
throws SQLException
clearWarnings in interface ConnectionSQLExceptionpublic Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic Map getTypeMap() throws SQLException
getTypeMap in interface ConnectionSQLExceptionpublic void setTypeMap(Map map) throws SQLException
setTypeMap in interface ConnectionSQLExceptionpublic void setHoldability(int holdability)
throws SQLException
setHoldability in interface ConnectionSQLExceptionpublic int getHoldability()
throws SQLException
getHoldability in interface ConnectionSQLExceptionpublic Savepoint setSavepoint() throws SQLException
setSavepoint in interface ConnectionSQLExceptionpublic Savepoint setSavepoint(String name) throws SQLException
setSavepoint in interface ConnectionSQLExceptionpublic void rollback(Savepoint savepoint) throws SQLException
rollback in interface ConnectionSQLExceptionpublic void releaseSavepoint(Savepoint savepoint) throws SQLException
releaseSavepoint in interface ConnectionSQLExceptionpublic Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
createStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException
prepareCall in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int autoGeneratedKeys) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, int[] columnIndexes) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic PreparedStatement prepareStatement(String sql, String[] columnNames) throws SQLException
prepareStatement in interface ConnectionSQLExceptionpublic Clob createClob() throws SQLException
createClob in interface ConnectionSQLExceptionpublic Blob createBlob() throws SQLException
createBlob in interface ConnectionSQLExceptionpublic NClob createNClob() throws SQLException
createNClob in interface ConnectionSQLExceptionpublic SQLXML createSQLXML() throws SQLException
createSQLXML in interface ConnectionSQLExceptionpublic boolean isValid(int timeout)
throws SQLException
isValid in interface ConnectionSQLExceptionpublic void setClientInfo(String name, String value) throws SQLClientInfoException
setClientInfo in interface ConnectionSQLClientInfoExceptionpublic void setClientInfo(Properties properties) throws SQLClientInfoException
setClientInfo in interface ConnectionSQLClientInfoExceptionpublic String getClientInfo(String name) throws SQLException
getClientInfo in interface ConnectionSQLExceptionpublic Properties getClientInfo() throws SQLException
getClientInfo in interface ConnectionSQLExceptionpublic Array createArrayOf(String typeName, Object[] elements) throws SQLException
createArrayOf in interface ConnectionSQLExceptionpublic Struct createStruct(String typeName, Object[] attributes) throws SQLException
createStruct in interface ConnectionSQLExceptionpublic Object unwrap(Class iface) throws SQLException
unwrap in interface WrapperSQLExceptionpublic boolean isWrapperFor(Class iface) throws SQLException
isWrapperFor in interface WrapperSQLExceptionpublic int getNetworkTimeout()
throws SQLException
getNetworkTimeout in interface ConnectionSQLExceptionpublic void setNetworkTimeout(Executor executor, int timeout) throws SQLException
setNetworkTimeout in interface ConnectionSQLExceptionpublic void abort(Executor executor) throws SQLException
abort in interface ConnectionSQLExceptionpublic String getSchema() throws SQLException
getSchema in interface ConnectionSQLExceptionpublic void setSchema(String schema) throws SQLException
setSchema in interface ConnectionSQLExceptionCopyright © 2019. All rights reserved.