📄 updatableresultset.java
字号:
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateNull(String columnName)
throws SQLException {
updateNull(findColumn(columnName));
}
/**
* JDBC 2.0 Update a column with an Object value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
* @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
* this is the number of digits after the decimal. For all other
* types this value will be ignored.
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateObject(int columnIndex, Object x, int scale)
throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setObject(columnIndex, x);
} else {
inserter.setObject(columnIndex, x);
this.thisRow[columnIndex - 1] = this.inserter.getBytes(columnIndex
- 1);
}
}
/**
* JDBC 2.0 Update a column with an Object value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateObject(int columnIndex, Object x)
throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setObject(columnIndex, x);
} else {
inserter.setObject(columnIndex, x);
this.thisRow[columnIndex - 1] = this.inserter.getBytes(columnIndex
- 1);
}
}
/**
* JDBC 2.0 Update a column with an Object value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnName the name of the column
* @param x the new column value
* @param scale For java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types
* this is the number of digits after the decimal. For all other
* types this value will be ignored.
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateObject(String columnName, Object x, int scale)
throws SQLException {
updateObject(findColumn(columnName), x);
}
/**
* JDBC 2.0 Update a column with an Object value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnName the name of the column
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateObject(String columnName, Object x)
throws SQLException {
updateObject(findColumn(columnName), x);
}
/**
* JDBC 2.0 Update the underlying database with the new contents of the
* current row. Cannot be called when on the insert row.
*
* @exception SQLException if a database-access error occurs, or if called
* when on the insert row
* @throws NotUpdatable DOCUMENT ME!
*/
public synchronized void updateRow() throws SQLException {
if (!isUpdatable) {
throw new NotUpdatable();
}
if (doingUpdates) {
updater.executeUpdate();
refreshRow();
doingUpdates = false;
}
//
// fixes calling updateRow() and then doing more
// updates on same row...
syncUpdate();
}
/**
* JDBC 2.0 Update a column with a short value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateShort(int columnIndex, short x)
throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setShort(columnIndex, x);
} else {
inserter.setShort(columnIndex, x);
this.thisRow[columnIndex - 1] = this.inserter.getBytes(columnIndex
- 1);
}
}
/**
* JDBC 2.0 Update a column with a short value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnName the name of the column
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateShort(String columnName, short x)
throws SQLException {
updateShort(findColumn(columnName), x);
}
/**
* JDBC 2.0 Update a column with a String value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateString(int columnIndex, String x)
throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setString(columnIndex, x);
} else {
inserter.setString(columnIndex, x);
if (x == null) {
this.thisRow[columnIndex - 1] = null;
} else {
if (getCharConverter() != null) {
try {
this.thisRow[columnIndex - 1] = StringUtils.getBytes(x,
this.charConverter, this.charEncoding);
} catch (UnsupportedEncodingException uEE) {
throw new SQLException(
"Unsupported character encoding '"
+ this.charEncoding + "'", SQLError.SQL_STATE_ILLEGAL_ARGUMENT);
}
} else {
this.thisRow[columnIndex - 1] = x.getBytes();
}
}
}
}
/**
* JDBC 2.0 Update a column with a String value. The updateXXX() methods
* are used to update column values in the current row, or the insert row.
* The updateXXX() methods do not update the underlying database, instead
* the updateRow() or insertRow() methods are called to update the
* database.
*
* @param columnName the name of the column
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateString(String columnName, String x)
throws SQLException {
updateString(findColumn(columnName), x);
}
/**
* JDBC 2.0 Update a column with a Time value. The updateXXX() methods are
* used to update column values in the current row, or the insert row. The
* updateXXX() methods do not update the underlying database, instead the
* updateRow() or insertRow() methods are called to update the database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateTime(int columnIndex, java.sql.Time x)
throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setTime(columnIndex, x);
} else {
inserter.setTime(columnIndex, x);
this.thisRow[columnIndex - 1] = this.inserter.getBytes(columnIndex
- 1);
}
}
/**
* JDBC 2.0 Update a column with a Time value. The updateXXX() methods are
* used to update column values in the current row, or the insert row. The
* updateXXX() methods do not update the underlying database, instead the
* updateRow() or insertRow() methods are called to update the database.
*
* @param columnName the name of the column
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateTime(String columnName, java.sql.Time x)
throws SQLException {
updateTime(findColumn(columnName), x);
}
/**
* JDBC 2.0 Update a column with a Timestamp value. The updateXXX()
* methods are used to update column values in the current row, or the
* insert row. The updateXXX() methods do not update the underlying
* database, instead the updateRow() or insertRow() methods are called to
* update the database.
*
* @param columnIndex the first column is 1, the second is 2, ...
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateTimestamp(int columnIndex,
java.sql.Timestamp x) throws SQLException {
if (!onInsertRow) {
if (!doingUpdates) {
doingUpdates = true;
syncUpdate();
}
updater.setTimestamp(columnIndex, x);
} else {
inserter.setTimestamp(columnIndex, x);
this.thisRow[columnIndex - 1] = this.inserter.getBytes(columnIndex
- 1);
}
}
/**
* JDBC 2.0 Update a column with a Timestamp value. The updateXXX()
* methods are used to update column values in the current row, or the
* insert row. The updateXXX() methods do not update the underlying
* database, instead the updateRow() or insertRow() methods are called to
* update the database.
*
* @param columnName the name of the column
* @param x the new column value
*
* @exception SQLException if a database-access error occurs
*/
public synchronized void updateTimestamp(String columnName,
java.sql.Timestamp x) throws SQLException {
updateTimestamp(findColumn(columnName), x);
}
/**
* Sets the concurrency type of this result set
*
* @param concurrencyFlag the type of concurrency that this ResultSet
* should support.
*/
protected void setResultSetConcurrency(int concurrencyFlag) {
super.setResultSetConcurrency(concurrencyFlag);
//
// FIXME: Issue warning when asked for updateable result set, but result set is not
// updatable
//
//if ((concurrencyFlag == CONCUR_UPDATABLE) && !isUpdatable()) {
//java.sql.SQLWarning warning = new java.sql.SQLWarning(
//NotUpdatable.NOT_UPDATEABLE_MESSAGE);
//}
}
protected void checkRowPos() throws SQLException {
// don't use RowData's idea of
// row bounds when we're doing
// inserts...
if (!this.onInsertRow) {
super.checkRowPos();
}
}
/**
* Figure out whether or not this ResultSet is updateable, and if so,
* generate the PreparedStatements to support updates.
*
* @throws SQLException DOCUMENT ME!
* @throws NotU
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -