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

📄 statementimpl.java

📁 mysql5.0 JDBC 驱动 放在glassfish或者tomcat的lib文件夹下就可以了
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
	 * @return the last update ID.	 */	public long getLastInsertID() {		return this.lastInsertId;	}	/**	 * getLongUpdateCount returns the current result as an update count, if the	 * result is a ResultSet or there are no more results, -1 is returned. It	 * should only be called once per result.	 *	 * <p>	 * This method returns longs as MySQL server versions newer than 3.22.4	 * return 64-bit values for update counts	 * </p>	 *	 * @return the current update count.	 */	public long getLongUpdateCount() {		if (this.results == null) {			return -1;		}		if (this.results.reallyResult()) {			return -1;		}		return this.updateCount;	}	/**	 * The maxFieldSize limit (in bytes) is the maximum amount of data returned	 * for any column value; it only applies to BINARY, VARBINARY,	 * LONGVARBINARY, CHAR, VARCHAR and LONGVARCHAR columns. If the limit is	 * exceeded, the excess data is silently discarded.	 *	 * @return the current max column size limit; zero means unlimited	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public int getMaxFieldSize() throws SQLException {		return this.maxFieldSize;	}	/**	 * The maxRows limit is set to limit the number of rows that any ResultSet	 * can contain. If the limit is exceeded, the excess rows are silently	 * dropped.	 *	 * @return the current maximum row limit; zero means unlimited	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public int getMaxRows() throws SQLException {		if (this.maxRows <= 0) {			return 0;		}		return this.maxRows;	}	/**	 * getMoreResults moves to a Statement's next result. If it returns true,	 * this result is a ResulSet.	 *	 * @return true if the next ResultSet is valid	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public boolean getMoreResults() throws SQLException {		return getMoreResults(CLOSE_CURRENT_RESULT);	}	/**	 * @see StatementImpl#getMoreResults(int)	 */	public boolean getMoreResults(int current) throws SQLException {		if (this.results == null) {			return false;		}		boolean streamingMode = createStreamingResultSet();				if (streamingMode) {			if (this.results.reallyResult()) {				while (this.results.next()); // need to drain remaining rows to get to server status 										 // which tells us whether more results actually exist or not			}		}				ResultSetInternalMethods nextResultSet = this.results.getNextResultSet();		switch (current) {		case java.sql.Statement.CLOSE_CURRENT_RESULT:			if (this.results != null) {				if (!streamingMode) { 					this.results.close();				}								this.results.clearNextResult();			}			break;		case java.sql.Statement.CLOSE_ALL_RESULTS:			if (this.results != null) {				if (!streamingMode) { 					this.results.close();				}								this.results.clearNextResult();			}			closeAllOpenResults();			break;		case java.sql.Statement.KEEP_CURRENT_RESULT:			if (!this.connection.getDontTrackOpenResources()) {				this.openResults.add(this.results);			}			this.results.clearNextResult(); // nobody besides us should			// ever need this value...			break;		default:			throw SQLError.createSQLException(Messages					.getString("Statement.19"), //$NON-NLS-1$					SQLError.SQL_STATE_ILLEGAL_ARGUMENT); //$NON-NLS-1$		}		this.results = nextResultSet;		if (this.results == null) {			this.updateCount = -1;			this.lastInsertId = -1;		} else if (this.results.reallyResult()) {			this.updateCount = -1;			this.lastInsertId = -1;		} else {			this.updateCount = this.results.getUpdateCount();			this.lastInsertId = this.results.getUpdateID();		}		return ((this.results != null) && this.results.reallyResult()) ? true				: false;	}	/**	 * The queryTimeout limit is the number of seconds the driver will wait for	 * a Statement to execute. If the limit is exceeded, a SQLException is	 * thrown.	 *	 * @return the current query timeout limit in seconds; 0 = unlimited	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public int getQueryTimeout() throws SQLException {		return this.timeoutInMillis / 1000;	}	/**	 * Parses actual record count from 'info' message	 *	 * @param serverInfo	 *            DOCUMENT ME!	 *	 * @return DOCUMENT ME!	 */	private int getRecordCountFromInfo(String serverInfo) {		StringBuffer recordsBuf = new StringBuffer();		int recordsCount = 0;		int duplicatesCount = 0;		char c = (char) 0;		int length = serverInfo.length();		int i = 0;		for (; i < length; i++) {			c = serverInfo.charAt(i);			if (Character.isDigit(c)) {				break;			}		}		recordsBuf.append(c);		i++;		for (; i < length; i++) {			c = serverInfo.charAt(i);			if (!Character.isDigit(c)) {				break;			}			recordsBuf.append(c);		}		recordsCount = Integer.parseInt(recordsBuf.toString());		StringBuffer duplicatesBuf = new StringBuffer();		for (; i < length; i++) {			c = serverInfo.charAt(i);			if (Character.isDigit(c)) {				break;			}		}		duplicatesBuf.append(c);		i++;		for (; i < length; i++) {			c = serverInfo.charAt(i);			if (!Character.isDigit(c)) {				break;			}			duplicatesBuf.append(c);		}		duplicatesCount = Integer.parseInt(duplicatesBuf.toString());		return recordsCount - duplicatesCount;	}	/**	 * getResultSet returns the current result as a ResultSet. It should only be	 * called once per result.	 *	 * @return the current result set; null if there are no more	 *	 * @exception SQLException	 *                if a database access error occurs (why?)	 */	public java.sql.ResultSet getResultSet() throws SQLException {		return ((this.results != null) && this.results.reallyResult()) ? (java.sql.ResultSet) this.results				: null;	}	/**	 * JDBC 2.0 Determine the result set concurrency.	 *	 * @return CONCUR_UPDATABLE or CONCUR_READONLY	 *	 * @throws SQLException	 *             if an error occurs	 */	public int getResultSetConcurrency() throws SQLException {		return this.resultSetConcurrency;	}	/**	 * @see StatementImpl#getResultSetHoldability()	 */	public int getResultSetHoldability() throws SQLException {		return java.sql.ResultSet.HOLD_CURSORS_OVER_COMMIT;	}	protected ResultSetInternalMethods getResultSetInternal() {		return this.results;	}	/**	 * JDBC 2.0 Determine the result set type.	 *	 * @return the ResultSet type (SCROLL_SENSITIVE or SCROLL_INSENSITIVE)	 *	 * @throws SQLException	 *             if an error occurs.	 */	public int getResultSetType() throws SQLException {		return this.resultSetType;	}	/**	 * getUpdateCount returns the current result as an update count, if the	 * result is a ResultSet or there are no more results, -1 is returned. It	 * should only be called once per result.	 *	 * @return the current result as an update count.	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public int getUpdateCount() throws SQLException {		if (this.results == null) {			return -1;		}		if (this.results.reallyResult()) {			return -1;		}		int truncatedUpdateCount = 0;		if (this.results.getUpdateCount() > Integer.MAX_VALUE) {			truncatedUpdateCount = Integer.MAX_VALUE;		} else {			truncatedUpdateCount = (int) this.results.getUpdateCount();		}		return truncatedUpdateCount;	}	/**	 * The first warning reported by calls on this Statement is returned. A	 * Statement's execute methods clear its java.sql.SQLWarning chain.	 * Subsequent Statement warnings will be chained to this	 * java.sql.SQLWarning.	 *	 * <p>	 * The Warning chain is automatically cleared each time a statement is	 * (re)executed.	 * </p>	 *	 * <p>	 * <B>Note:</B> If you are processing a ResultSet then any warnings	 * associated with ResultSet reads will be chained on the ResultSet object.	 * </p>	 *	 * @return the first java.sql.SQLWarning or null	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public java.sql.SQLWarning getWarnings() throws SQLException {		checkClosed();		if (this.connection != null && !this.connection.isClosed()				&& this.connection.versionMeetsMinimum(4, 1, 0)) {			SQLWarning pendingWarningsFromServer = SQLError					.convertShowWarningsToSQLWarnings(this.connection);			if (this.warningChain != null) {				this.warningChain.setNextWarning(pendingWarningsFromServer);			} else {				this.warningChain = pendingWarningsFromServer;			}			return this.warningChain;		}		return this.warningChain;	}	/**	 * Closes this statement, and frees resources.	 *	 * @param calledExplicitly	 *            was this called from close()?	 *	 * @throws SQLException	 *             if an error occurs	 */	protected void realClose(boolean calledExplicitly, boolean closeOpenResults)			throws SQLException {		if (this.isClosed) {			return;		}		if (this.useUsageAdvisor) {			if (!calledExplicitly) {				String message = Messages.getString("Statement.63") //$NON-NLS-1$						+ Messages.getString("Statement.64"); //$NON-NLS-1$				this.eventSink.consumeEvent(new ProfilerEvent(						ProfilerEvent.TYPE_WARN,						"", //$NON-NLS-1$						this.currentCatalog, this.connectionId, this.getId(),						-1, System.currentTimeMillis(), 0,						Constants.MILLIS_I18N, null, this.pointOfOrigin,						message));			}		}		if (closeOpenResults) {			closeOpenResults = !this.holdResultsOpenOverClose;		}				if (closeOpenResults) {			if (this.results != null) {								try {					this.results.close();				} catch (Exception ex) {					;				}			}						closeAllOpenResults();		}		if (this.connection != null) {			if (this.maxRowsChanged) {				this.connection.unsetMaxRows(this);			}			if (!this.connection.getDontTrackOpenResources()) {				this.connection.unregisterStatement(this);			}		}		this.isClosed = true;		this.results = null;		this.connection = null;		this.warningChain = null;		this.openResults = null;		this.batchedGeneratedKeys = null;		this.localInfileInputStream = null;		this.pingTarget = null;	}	/**	 * setCursorName defines the SQL cursor name that will be used by subsequent	 * execute methods. This name can then be used in SQL positioned	 * update/delete statements to identify the current row in the ResultSet	 * generated by this statement. If a database doesn't support positioned	 * update/delete, this method is a no-op.	 *	 * <p>	 * <b>Note:</b> This MySQL driver does not support cursors.	 * </p>	 *	 * @param name	 *            the new cursor name	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public void setCursorName(String name) throws SQLException {		// No-op	}	/**	 * If escape scanning is on (the default), the driver will do escape	 * substitution before sending the SQL to the database.	 *	 * @param enable	 *            true to enable; false to disable	 *	 * @exception SQLException	 *                if a database access error occurs	 */	public void setEscapeProcessing(boolean enable)			throws SQLException {		this.doEscapeProcessing = enable;	}	/**	 * JDBC 2.0 Give a hint as to the direction in which the rows in a result	 * set will be processed. The hint applies only to result sets created using	 * this Statement object. The default value is ResultSet.FETCH_FORWARD.	 *	 * @param direction	 *            the initial direction for processing rows	 *	 * @exception SQLException	 *                if a database-access error occurs or direction is not one	 *   

⌨️ 快捷键说明

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