Interface SRConnection
- All Superinterfaces:
AutoCloseable
,Connection
,Wrapper
-
Field Summary
Fields inherited from interface java.sql.Connection
TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE
-
Method Summary
Modifier and TypeMethodDescriptionlong
fetchGeneratedKey
(PreparedStatement stmt, String table, String column) The counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.Selects the current timestamp from the database and returns it as a java date.Prepares statement for returning generated keys in a way that's safe for all database drivers.runLimitQuery
(String query, int limit) Executes the given SELECT query, applying a limit as defined by the translator.long
runPrepInsertGetKey
(String query, String tableName, String keyCol, Object... args) Runs the given insert query, returning the generated key.runPrepLimitQuery
(String query, int limit, Object... args) Executes the given SELECT query, applying a limit as defined by the translator.runPrepQuery
(String query, Object... args) Executes a SELECT query using a prepared statements, assigning the arguments in order.int
runPrepUpdate
(String query, Object... args) Executes a non-SELECT query using a prepared statement, assigning the arguments in order.Executes the given SELECT query, returning a Dataset of results.runScalarPrepQuery
(String query, Object... args) Executes the query and returns the first return value.runScalarQuery
(String query) Executes the query and returns the first return value.int
runUpdateQuery
(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
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
-
Method Details
-
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
Executes the given SELECT query, returning a Dataset of results.- Returns:
- the results of the query in Dataset form
- Throws:
SQLException
-
runLimitQuery
Executes the given SELECT query, applying a limit as defined by the translator.- Throws:
SQLException
-
runPrepLimitQuery
Executes the given SELECT query, applying a limit as defined by the translator.- Throws:
SQLException
-
runPrepQuery
Executes a SELECT query using a prepared statements, assigning the arguments in order.- Returns:
- the results of the query in Dataset form
- Throws:
SQLException
-
runUpdateQuery
Executes a non-SELECT query.- Returns:
- the number of rows modified
- Throws:
SQLException
-
runPrepUpdate
Executes a non-SELECT query using a prepared statement, assigning the arguments in order.- Returns:
- the number of rows modified
- Throws:
SQLException
-
runScalarQuery
Executes the query and returns the first return value.- Throws:
SQLException
-
runScalarPrepQuery
Executes the query and returns the first return value.- Throws:
SQLException
-
runPrepInsertGetKey
long runPrepInsertGetKey(String query, String tableName, String keyCol, Object... args) throws 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:
SQLException
-
getCurrentDatabaseTime
Selects the current timestamp from the database and returns it as a java date.- Throws:
SQLException
-
prepareStatmentForGeneratedKeys
Prepares statement for returning generated keys in a way that's safe for all database drivers.- Throws:
SQLException
-
fetchGeneratedKey
The counterpart to prepareStatmentForGeneratedKeys, returns the generated key in a way that's safe for all drivers.- Throws:
SQLException
-