⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 updatableresultset.java

📁 开发MySql数据库的最新JDBC驱动。
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	 * 	 * @exception SQLException	 *                if a database-access error occurs	 * @throws NotImplemented	 *             DOCUMENT ME!	 * 	 * @see DatabaseMetaData#deletesAreDetected	 */	public synchronized boolean rowDeleted() throws SQLException {		throw new NotImplemented();	}	/**	 * JDBC 2.0 Determine if the current row has been inserted. The value	 * returned depends on whether or not the result set can detect visible	 * inserts.	 * 	 * @return true if inserted and inserts are detected	 * 	 * @exception SQLException	 *                if a database-access error occurs	 * @throws NotImplemented	 *             DOCUMENT ME!	 * 	 * @see DatabaseMetaData#insertsAreDetected	 */	public synchronized boolean rowInserted() throws SQLException {		throw new NotImplemented();	}	/**	 * JDBC 2.0 Determine if the current row has been updated. The value	 * returned depends on whether or not the result set can detect updates.	 * 	 * @return true if the row has been visibly updated by the owner or another,	 *         and updates are detected	 * 	 * @exception SQLException	 *                if a database-access error occurs	 * @throws NotImplemented	 *             DOCUMENT ME!	 * 	 * @see DatabaseMetaData#updatesAreDetected	 */	public synchronized boolean rowUpdated() throws SQLException {		throw new NotImplemented();	}	/**	 * 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);		// }	}	private byte[] stripBinaryPrefix(byte[] dataFrom) {		return StringUtils.stripEnclosure(dataFrom, "_binary'", "'");	}	/**	 * Reset UPDATE prepared statement to value in current row. This_Row MUST	 * point to current, valid row.	 * 	 * @throws SQLException	 *             DOCUMENT ME!	 */	synchronized void syncUpdate() throws SQLException {		if (this.updater == null) {			if (this.updateSQL == null) {				generateStatements();			}			this.updater = this.connection					.clientPrepareStatement(this.updateSQL);		}		int numFields = this.fields.length;		this.updater.clearParameters();		for (int i = 0; i < numFields; i++) {			if (this.thisRow[i] != null) {				this.updater.setBytes(i + 1, (byte[]) this.thisRow[i],						this.fields[i].isBinary(), false);			} else {				this.updater.setNull(i + 1, 0);			}		}		int numKeys = this.primaryKeyIndicies.size();		if (numKeys == 1) {			int index = ((Integer) this.primaryKeyIndicies.get(0)).intValue();			byte[] keyData = (byte[]) this.thisRow[index];			this.updater.setBytes(numFields + 1, keyData, false, false);		} else {			for (int i = 0; i < numKeys; i++) {				byte[] currentVal = (byte[]) this.thisRow[((Integer) this.primaryKeyIndicies						.get(i)).intValue()];				if (currentVal != null) {					this.updater.setBytes(numFields + i + 1, currentVal, false,							false);				} else {					this.updater.setNull(numFields + i + 1, 0);				}			}		}	}	/**	 * JDBC 2.0 Update a column with an ascii stream 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 length	 *            the length of the stream	 * 	 * @exception SQLException	 *                if a database-access error occurs	 */	public synchronized void updateAsciiStream(int columnIndex,			java.io.InputStream x, int length) throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setAsciiStream(columnIndex, x, length);		} else {			this.inserter.setAsciiStream(columnIndex, x, length);			this.thisRow[columnIndex - 1] = STREAM_DATA_MARKER;		}	}	/**	 * JDBC 2.0 Update a column with an ascii stream 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 length	 *            of the stream	 * 	 * @exception SQLException	 *                if a database-access error occurs	 */	public synchronized void updateAsciiStream(String columnName,			java.io.InputStream x, int length) throws SQLException {		updateAsciiStream(findColumn(columnName), x, length);	}	/**	 * JDBC 2.0 Update a column with a BigDecimal 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 updateBigDecimal(int columnIndex, BigDecimal x)			throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setBigDecimal(columnIndex, x);		} else {			this.inserter.setBigDecimal(columnIndex, x);			if (x == null) {				this.thisRow[columnIndex - 1] = null;			} else {				this.thisRow[columnIndex - 1] = x.toString().getBytes();			}		}	}	/**	 * JDBC 2.0 Update a column with a BigDecimal 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 updateBigDecimal(String columnName, BigDecimal x)			throws SQLException {		updateBigDecimal(findColumn(columnName), x);	}	/**	 * JDBC 2.0 Update a column with a binary stream 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 length	 *            the length of the stream	 * 	 * @exception SQLException	 *                if a database-access error occurs	 */	public synchronized void updateBinaryStream(int columnIndex,			java.io.InputStream x, int length) throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setBinaryStream(columnIndex, x, length);		} else {			this.inserter.setBinaryStream(columnIndex, x, length);			if (x == null) {				this.thisRow[columnIndex - 1] = null;			} else {				this.thisRow[columnIndex - 1] = STREAM_DATA_MARKER;			}		}	}	/**	 * JDBC 2.0 Update a column with a binary stream 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 length	 *            of the stream	 * 	 * @exception SQLException	 *                if a database-access error occurs	 */	public synchronized void updateBinaryStream(String columnName,			java.io.InputStream x, int length) throws SQLException {		updateBinaryStream(findColumn(columnName), x, length);	}	/**	 * @see ResultSet#updateBlob(int, Blob)	 */	public synchronized void updateBlob(int columnIndex, java.sql.Blob blob)			throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setBlob(columnIndex, blob);		} else {			this.inserter.setBlob(columnIndex, blob);			if (blob == null) {				this.thisRow[columnIndex - 1] = null;			} else {				this.thisRow[columnIndex - 1] = STREAM_DATA_MARKER;			}		}	}	/**	 * @see ResultSet#updateBlob(String, Blob)	 */	public synchronized void updateBlob(String columnName, java.sql.Blob blob)			throws SQLException {		updateBlob(findColumn(columnName), blob);	}	/**	 * JDBC 2.0 Update a column with a boolean 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 updateBoolean(int columnIndex, boolean x)			throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setBoolean(columnIndex, x);		} else {			this.inserter.setBoolean(columnIndex, x);			this.thisRow[columnIndex - 1] = this.inserter					.getBytesRepresentation(columnIndex - 1);		}	}	/**	 * JDBC 2.0 Update a column with a boolean 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 updateBoolean(String columnName, boolean x)			throws SQLException {		updateBoolean(findColumn(columnName), x);	}	/**	 * JDBC 2.0 Update a column with a byte 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 updateByte(int columnIndex, byte x)			throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setByte(columnIndex, x);		} else {			this.inserter.setByte(columnIndex, x);			this.thisRow[columnIndex - 1] = this.inserter					.getBytesRepresentation(columnIndex - 1);		}	}	/**	 * JDBC 2.0 Update a column with a byte 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 updateByte(String columnName, byte x)			throws SQLException {		updateByte(findColumn(columnName), x);	}	/**	 * JDBC 2.0 Update a column with a byte array 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 updateBytes(int columnIndex, byte[] x)			throws SQLException {		if (!this.onInsertRow) {			if (!this.doingUpdates) {				this.doingUpdates = true;				syncUpdate();			}			this.updater.setBytes(columnIndex, x);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -