Interface SRConnection
-
- All Superinterfaces:
java.lang.AutoCloseable,java.sql.Connection,java.sql.Wrapper
public interface SRConnection extends java.sql.Connection
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intfetchGeneratedKey(java.sql.PreparedStatement stmt, java.lang.String table, java.lang.String column)The counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.java.sql.TimestampgetCurrentDatabaseTime()Selects the current timestamp from the database and returns it as a java date.DatasourcegetParentDatasource()java.sql.PreparedStatementprepareStatmentForGeneratedKeys(java.lang.String sql)Prepares statement for returning generated keys in a way that's safe for all database drivers.DatasetrunLimitQuery(java.lang.String query, int limit)Executes the given SELECT query, applying a limit as defined by the translator.intrunPrepInsertGetKey(java.lang.String query, java.lang.String tableName, java.lang.String keyCol, java.lang.Object... args)Runs the given insert query, returning the generated key.DatasetrunPrepLimitQuery(java.lang.String query, int limit, java.lang.Object... args)Executes the given SELECT query, applying a limit as defined by the translator.DatasetrunPrepQuery(java.lang.String query, java.lang.Object... args)Executes a SELECT query using a prepared statements, assigning the arguments in order.intrunPrepUpdate(java.lang.String query, java.lang.Object... args)Executes a non-SELECT query using a prepared statement, assigning the arguments in order.DatasetrunQuery(java.lang.String query)Executes the given SELECT query, returning a Dataset of results.java.lang.ObjectrunScalarPrepQuery(java.lang.String query, java.lang.Object... args)Executes the query and returns the first return value.java.lang.ObjectrunScalarQuery(java.lang.String query)Executes the query and returns the first return value.intrunUpdateQuery(java.lang.String query)Executes a non-SELECT query.-
Methods inherited from interface java.sql.Connection
abort, beginRequest, clearWarnings, close, commit, createArrayOf, createBlob, createClob, createNClob, createSQLXML, createStatement, createStatement, createStatement, createStruct, endRequest, getAutoCommit, getCatalog, getClientInfo, getClientInfo, getHoldability, getMetaData, getNetworkTimeout, getSchema, getTransactionIsolation, getTypeMap, getWarnings, isClosed, isReadOnly, isValid, nativeSQL, prepareCall, prepareCall, prepareCall, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, prepareStatement, releaseSavepoint, rollback, rollback, setAutoCommit, setCatalog, setClientInfo, setClientInfo, setHoldability, setNetworkTimeout, setReadOnly, setSavepoint, setSavepoint, setSchema, setShardingKey, setShardingKey, setShardingKeyIfValid, setShardingKeyIfValid, setTransactionIsolation, setTypeMap
-
-
-
-
Method Detail
-
getParentDatasource
Datasource getParentDatasource()
- Returns:
- the Datasource that created this connection. Note that this might not be the Datasource on which getConnection() was called in the case of a failover scenario.
-
runQuery
Dataset runQuery(java.lang.String query) throws java.sql.SQLException
Executes the given SELECT query, returning a Dataset of results.- Returns:
- the results of the query in Dataset form
- Throws:
java.sql.SQLException
-
runLimitQuery
Dataset runLimitQuery(java.lang.String query, int limit) throws java.sql.SQLException
Executes the given SELECT query, applying a limit as defined by the translator.- Throws:
java.sql.SQLException
-
runPrepLimitQuery
Dataset runPrepLimitQuery(java.lang.String query, int limit, java.lang.Object... args) throws java.sql.SQLException
Executes the given SELECT query, applying a limit as defined by the translator.- Throws:
java.sql.SQLException
-
runPrepQuery
Dataset runPrepQuery(java.lang.String query, java.lang.Object... args) throws java.sql.SQLException
Executes a SELECT query using a prepared statements, assigning the arguments in order.- Returns:
- the results of the query in Dataset form
- Throws:
java.sql.SQLException
-
runUpdateQuery
int runUpdateQuery(java.lang.String query) throws java.sql.SQLExceptionExecutes a non-SELECT query.- Returns:
- the number of rows modified
- Throws:
java.sql.SQLException
-
runPrepUpdate
int runPrepUpdate(java.lang.String query, java.lang.Object... args) throws java.sql.SQLExceptionExecutes a non-SELECT query using a prepared statement, assigning the arguments in order.- Returns:
- the number of rows modified
- Throws:
java.sql.SQLException
-
runScalarQuery
java.lang.Object runScalarQuery(java.lang.String query) throws java.sql.SQLExceptionExecutes the query and returns the first return value.- Throws:
java.sql.SQLException
-
runScalarPrepQuery
java.lang.Object runScalarPrepQuery(java.lang.String query, java.lang.Object... args) throws java.sql.SQLExceptionExecutes the query and returns the first return value.- Throws:
java.sql.SQLException
-
runPrepInsertGetKey
int runPrepInsertGetKey(java.lang.String query, java.lang.String tableName, java.lang.String keyCol, java.lang.Object... args) throws java.sql.SQLExceptionRuns the given insert query, returning the generated key. Requires the table name and index column because some database require them in order to get the key.- Throws:
java.sql.SQLException
-
getCurrentDatabaseTime
java.sql.Timestamp getCurrentDatabaseTime() throws java.sql.SQLExceptionSelects the current timestamp from the database and returns it as a java date.- Throws:
java.sql.SQLException
-
prepareStatmentForGeneratedKeys
java.sql.PreparedStatement prepareStatmentForGeneratedKeys(java.lang.String sql) throws java.sql.SQLExceptionPrepares statement for returning generated keys in a way that's safe for all database drivers.- Throws:
java.sql.SQLException
-
fetchGeneratedKey
int fetchGeneratedKey(java.sql.PreparedStatement stmt, java.lang.String table, java.lang.String column) throws java.sql.SQLExceptionThe counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.- Throws:
java.sql.SQLException
-
-