本文整理汇总了Java中java.sql.ResultSet.CONCUR_READ_ONLY属性的典型用法代码示例。如果您正苦于以下问题:Java ResultSet.CONCUR_READ_ONLY属性的具体用法?Java ResultSet.CONCUR_READ_ONLY怎么用?Java ResultSet.CONCUR_READ_ONLY使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.sql.ResultSet
的用法示例。
在下文中一共展示了ResultSet.CONCUR_READ_ONLY属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: supportsResultSetConcurrency
/**
* JDBC 2.0 Does the database support the concurrency type in combination
* with the given result set type?
*
* @param type
* defined in java.sql.ResultSet
* @param concurrency
* type defined in java.sql.ResultSet
* @return true if so
* @exception SQLException
* if a database-access error occurs.
* @see Connection
*/
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException {
switch (type) {
case ResultSet.TYPE_SCROLL_INSENSITIVE:
if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
return true;
}
throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
getExceptionInterceptor());
case ResultSet.TYPE_FORWARD_ONLY:
if ((concurrency == ResultSet.CONCUR_READ_ONLY) || (concurrency == ResultSet.CONCUR_UPDATABLE)) {
return true;
}
throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
getExceptionInterceptor());
case ResultSet.TYPE_SCROLL_SENSITIVE:
return false;
default:
throw SQLError.createSQLException("Illegal arguments to supportsResultSetConcurrency()", SQLError.SQL_STATE_ILLEGAL_ARGUMENT,
getExceptionInterceptor());
}
}
示例2: checkCursor
protected void checkCursor(int rst, int rsc, int rsh) throws SQLException {
if (rst != ResultSet.TYPE_FORWARD_ONLY)
throw new SQLException("SQLite only supports TYPE_FORWARD_ONLY cursors");
if (rsc != ResultSet.CONCUR_READ_ONLY)
throw new SQLException("SQLite only supports CONCUR_READ_ONLY cursors");
if (rsh != ResultSet.CLOSE_CURSORS_AT_COMMIT)
throw new SQLException("SQLite only supports closing cursors at commit");
}
示例3: rowSetConcurrencyTypes
@DataProvider(name = "rowSetConcurrencyTypes")
protected Object[][] rowSetConcurrencyTypes() throws Exception {
RowSet rs = newInstance();
return new Object[][]{
{rs, ResultSet.CONCUR_READ_ONLY},
{rs, ResultSet.CONCUR_UPDATABLE}
};
}
示例4: prepareCall
@Override
public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
return prepareCall(sql);
checkClosed();
throw SQLError.noSupport();
}
示例5: createStatement
@Override
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) {
throw new SQLException(
String.format("Statement with resultset concurrency %d is not supported", resultSetConcurrency));
}
if (resultSetType == ResultSet.TYPE_SCROLL_SENSITIVE) {
throw new SQLException(String.format("Statement with resultset type %d is not supported", resultSetType));
}
return new TsfileStatement(this, client, sessionHandle);
}
示例6: checkUpdatable
private void checkUpdatable() throws SQLException {
checkClosed();
if (rsConcurrency == ResultSet.CONCUR_READ_ONLY) {
throw Util.notUpdatableColumn();
}
}
示例7: isCursorRequired
@Override
boolean isCursorRequired() throws SQLException {
// we only create cursor-backed result sets if
// a) The query is a SELECT
// b) The server supports it
// c) We know it is forward-only (note this doesn't preclude updatable result sets)
// d) The user has set a fetch size
return this.resultFields != null && this.connection.isCursorFetchEnabled() && getResultSetType() == ResultSet.TYPE_FORWARD_ONLY
&& getResultSetConcurrency() == ResultSet.CONCUR_READ_ONLY && getFetchSize() > 0;
}
示例8: supportsResultSetConcurrency
@Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
checkClosed();
if (type == ResultSet.TYPE_SCROLL_INSENSITIVE && concurrency == ResultSet.CONCUR_READ_ONLY)
return true;
return false;
}
示例9: prepareStatement
@Override
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException
{
if (resultSetType == ResultSet.TYPE_SCROLL_INSENSITIVE && resultSetConcurrency == ResultSet.CONCUR_READ_ONLY)
return prepareStatement(sql);
checkClosed();
throw SQLError.noSupport();
}
示例10: getResultSetConcurrency
@Override
default int getResultSetConcurrency() throws SQLException {
return ResultSet.CONCUR_READ_ONLY;
}
示例11: supportsResultSetConcurrency
@Override
public boolean supportsResultSetConcurrency(int type, int concurrency) throws SQLException
{
return type == ResultSet.TYPE_FORWARD_ONLY && concurrency == ResultSet.CONCUR_READ_ONLY;
}
示例12: getConcurrency
@Override
public int getConcurrency() throws SQLException {
return ResultSet.CONCUR_READ_ONLY;
}
示例13: getResultSetConcurrency
@Override
public int getResultSetConcurrency() throws SQLException
{
checkClosed();
return ResultSet.CONCUR_READ_ONLY;
}
示例14: useServerFetch
private boolean useServerFetch() throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
return this.connection.isCursorFetchEnabled() && this.fetchSize > 0 && this.resultSetConcurrency == ResultSet.CONCUR_READ_ONLY
&& this.resultSetType == ResultSet.TYPE_FORWARD_ONLY;
}
}
示例15: checkCreateStatementSupported
/**
* Check if the createStatement() options are supported
*
* See http://docs.oracle.com/javase/7/docs/api/index.html?java/sql/DatabaseMetaData.html
*
* The following flags are supported:
* - The type must either be TYPE_SCROLL_INSENSITIVE or TYPE_FORWARD_ONLY.
* - The concurrency must be CONCUR_READ_ONLY.
* - The holdability must be CLOSE_CURSORS_AT_COMMIT.
*
* @param resultSetType JDBC result set type option
* @param resultSetConcurrency JDBC result set concurrency option
* @param resultSetHoldability JDBC result set holdability option
* @throws SQLException if not supported
*/
private static void checkCreateStatementSupported(
int resultSetType, int resultSetConcurrency, int resultSetHoldability)
throws SQLException
{
if ( ( (resultSetType != ResultSet.TYPE_SCROLL_INSENSITIVE
&& resultSetType != ResultSet.TYPE_FORWARD_ONLY))
|| resultSetConcurrency != ResultSet.CONCUR_READ_ONLY
|| resultSetHoldability != ResultSet.CLOSE_CURSORS_AT_COMMIT) {
throw SQLError.noSupport();
}
}