下面列出了怎么用java.sql.SQLType的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Internal setObject implementation.
*
* @param columnIndex
* @param x
* @param targetType
* @param scaleOrLength
* @throws SQLException
*/
protected void updateObjectInternal(int columnIndex, Object x, SQLType targetType, int scaleOrLength) throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
if (!this.onInsertRow) {
if (!this.doingUpdates) {
this.doingUpdates = true;
syncUpdate();
}
if (targetType == null) {
this.updater.setObject(columnIndex, x);
} else {
this.updater.setObject(columnIndex, x, targetType);
}
} else {
if (targetType == null) {
this.inserter.setObject(columnIndex, x);
} else {
this.inserter.setObject(columnIndex, x, targetType);
}
this.thisRow.setBytes(columnIndex - 1, this.inserter.getBytesRepresentation(columnIndex - 1));
}
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param x
* @param targetSqlType
* @param scaleOrLength
* @throws SQLException
*/
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterName, x, targetSqlType, scaleOrLength);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
@Override
public void updateObject(int columnIndex,
Object x,
SQLType targetSqlType,
int scaleOrLength) throws SQLException {
this.getCurrentResultSet().updateObject(columnIndex, x, targetSqlType);
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @param typeName
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, typeName);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
public void setObject(int parameterIndex, Object parameterObj, SQLType targetSqlType) throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
if (targetSqlType instanceof MysqlType) {
((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), parameterObj, (MysqlType) targetSqlType);
} else {
setObject(parameterIndex, parameterObj, targetSqlType.getVendorTypeNumber());
}
}
}
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
synchronized (checkClosed().getConnectionMutex()) {
if (targetSqlType instanceof MysqlType) {
((PreparedQuery<?>) this.query).getQueryBindings().setObject(getCoreParameterIndex(parameterIndex), x, (MysqlType) targetSqlType,
scaleOrLength);
} else {
setObject(parameterIndex, x, targetSqlType.getVendorTypeNumber(), scaleOrLength);
}
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @throws SQLException
*/
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((PreparedStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
if (sqlType instanceof MysqlType) {
registerOutParameter(parameterIndex, (MysqlType) sqlType, scale);
} else {
registerOutParameter(parameterIndex, sqlType.getVendorTypeNumber(), scale);
}
}
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
if (sqlType instanceof MysqlType) {
registerOutParameter(parameterIndex, (MysqlType) sqlType, typeName);
} else {
registerOutParameter(parameterIndex, sqlType.getVendorTypeNumber(), typeName);
}
}
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
if (sqlType instanceof MysqlType) {
registerOutParameter(getNamedParamIndex(parameterName, true), (MysqlType) sqlType, scale);
} else {
registerOutParameter(getNamedParamIndex(parameterName, true), sqlType.getVendorTypeNumber(), scale);
}
}
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException {
if (sqlType instanceof MysqlType) {
registerOutParameter(getNamedParamIndex(parameterName, true), (MysqlType) sqlType, typeName);
} else {
registerOutParameter(parameterName, sqlType.getVendorTypeNumber(), typeName);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param typeName
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, typeName);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @param typeName
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType, String typeName) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, typeName);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @param scaleOrLength
* @throws SQLException
*/
@Override
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType, scaleOrLength);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param x
* @param targetSqlType
* @param scaleOrLength
* @throws SQLException
*/
public void setObject(String parameterName, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterName, x, targetSqlType, scaleOrLength);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", MysqlErrorNumbers.SQL_STATE_GENERAL_ERROR,
this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param typeName
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, typeName);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @param scaleOrLength
* @throws SQLException
*/
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
if (this.wrappedStmt != null) {
((PreparedStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType, scaleOrLength);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param sqlType
* @param typeName
* @throws SQLException
*/
public void registerOutParameter(int parameterIndex, SQLType sqlType, String typeName) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterIndex, sqlType, typeName);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param sqlType
* @param scale
* @throws SQLException
*/
public void registerOutParameter(String parameterName, SQLType sqlType, int scale) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).registerOutParameter(parameterName, sqlType, scale);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @throws SQLException
*/
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @throws SQLException
*/
public void setObject(int parameterIndex, Object x, SQLType targetSqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterIndex
* @param x
* @param targetSqlType
* @param scaleOrLength
* @throws SQLException
*/
public void setObject(int parameterIndex, Object x, SQLType targetSqlType, int scaleOrLength) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterIndex, x, targetSqlType, scaleOrLength);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}
/**
* Support for java.sql.JDBCType/java.sql.SQLType.
*
* @param parameterName
* @param x
* @param targetSqlType
* @throws SQLException
*/
public void setObject(String parameterName, Object x, SQLType targetSqlType) throws SQLException {
try {
if (this.wrappedStmt != null) {
((CallableStatement) this.wrappedStmt).setObject(parameterName, x, targetSqlType);
} else {
throw SQLError.createSQLException("No operations allowed after statement closed", SQLError.SQL_STATE_GENERAL_ERROR, this.exceptionInterceptor);
}
} catch (SQLException sqlEx) {
checkAndFireConnectionError(sqlEx);
}
}