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 long
fetchGeneratedKey(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.Timestamp
getCurrentDatabaseTime()
Selects the current timestamp from the database and returns it as a java date.Datasource
getParentDatasource()
java.sql.PreparedStatement
prepareStatmentForGeneratedKeys(java.lang.String sql)
Prepares statement for returning generated keys in a way that's safe for all database drivers.Dataset
runLimitQuery(java.lang.String query, int limit)
Executes the given SELECT query, applying a limit as defined by the translator.long
runPrepInsertGetKey(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.Dataset
runPrepLimitQuery(java.lang.String query, int limit, java.lang.Object... args)
Executes the given SELECT query, applying a limit as defined by the translator.Dataset
runPrepQuery(java.lang.String query, java.lang.Object... args)
Executes a SELECT query using a prepared statements, assigning the arguments in order.int
runPrepUpdate(java.lang.String query, java.lang.Object... args)
Executes a non-SELECT query using a prepared statement, assigning the arguments in order.Dataset
runQuery(java.lang.String query)
Executes the given SELECT query, returning a Dataset of results.java.lang.Object
runScalarPrepQuery(java.lang.String query, java.lang.Object... args)
Executes the query and returns the first return value.java.lang.Object
runScalarQuery(java.lang.String query)
Executes the query and returns the first return value.int
runUpdateQuery(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.SQLException
Executes 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.SQLException
Executes 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.SQLException
Executes 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.SQLException
Executes the query and returns the first return value.- Throws:
java.sql.SQLException
-
runPrepInsertGetKey
long runPrepInsertGetKey(java.lang.String query, java.lang.String tableName, java.lang.String keyCol, java.lang.Object... args) throws java.sql.SQLException
Runs 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.SQLException
Selects 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.SQLException
Prepares statement for returning generated keys in a way that's safe for all database drivers.- Throws:
java.sql.SQLException
-
fetchGeneratedKey
long fetchGeneratedKey(java.sql.PreparedStatement stmt, java.lang.String table, java.lang.String column) throws java.sql.SQLException
The counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.- Throws:
java.sql.SQLException
-
-