📄 callablestatement.java
字号:
Date retValue = rs.getDate(fixParameterName(parameterName), cal); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getDouble(int) */ public synchronized double getDouble(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); double retValue = rs .getDouble(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getDouble(java.lang.String) */ public synchronized double getDouble(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= double retValue = rs.getDouble(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getFloat(int) */ public synchronized float getFloat(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); float retValue = rs .getFloat(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getFloat(java.lang.String) */ public synchronized float getFloat(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= float retValue = rs.getFloat(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getInt(int) */ public synchronized int getInt(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); int retValue = rs .getInt(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getInt(java.lang.String) */ public synchronized int getInt(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= int retValue = rs.getInt(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getLong(int) */ public synchronized long getLong(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); long retValue = rs .getLong(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getLong(java.lang.String) */ public synchronized long getLong(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= long retValue = rs.getLong(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } private int getNamedParamIndex(String paramName, boolean forOut) throws SQLException { if ((paramName == null) || (paramName.length() == 0)) { throw new SQLException(Messages.getString("CallableStatement.2"), //$NON-NLS-1$ SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } CallableStatementParam namedParamInfo = this.paramInfo .getParameter(paramName); if (this.paramInfo == null) { throw new SQLException( Messages.getString("CallableStatement.3") + paramName + Messages.getString("CallableStatement.4"), //$NON-NLS-1$ //$NON-NLS-2$ SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } if (forOut && !namedParamInfo.isOut) { throw new SQLException( Messages.getString("CallableStatement.5") + paramName //$NON-NLS-1$ + Messages.getString("CallableStatement.6"), //$NON-NLS-1$ SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } return namedParamInfo.index + 1; // JDBC indices are 1-based } /** * @see java.sql.CallableStatement#getObject(int) */ public synchronized Object getObject(int parameterIndex) throws SQLException { CallableStatementParam paramDescriptor = checkIsOutputParam(parameterIndex); ResultSet rs = getOutputParameters(parameterIndex); Object retVal = rs.getObjectStoredProc( mapOutputParameterIndexToRsIndex(parameterIndex), paramDescriptor.desiredJdbcType); this.outputParamWasNull = rs.wasNull(); return retVal; } /** * @see java.sql.CallableStatement#getObject(int, java.util.Map) */ public synchronized Object getObject(int parameterIndex, Map map) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Object retVal = rs.getObject( mapOutputParameterIndexToRsIndex(parameterIndex), map); this.outputParamWasNull = rs.wasNull(); return retVal; } /** * @see java.sql.CallableStatement#getObject(java.lang.String) */ public synchronized Object getObject(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Object retValue = rs.getObject(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getObject(java.lang.String, * java.util.Map) */ public synchronized Object getObject(String parameterName, Map map) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Object retValue = rs.getObject(fixParameterName(parameterName), map); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * Returns the ResultSet that holds the output parameters, or throws an * appropriate exception if none exist, or they weren't returned. * * @return the ResultSet that holds the output parameters * * @throws SQLException * if no output parameters were defined, or if no output * parameters were returned. */ private ResultSet getOutputParameters(int paramIndex) throws SQLException { this.outputParamWasNull = false; if (paramIndex == 1 && this.callingStoredFunction && this.returnValueParam != null) { return this.functionReturnValueResults; } if (this.outputParameterResults == null) { if (this.paramInfo.numberOfParameters() == 0) { throw new SQLException(Messages .getString("CallableStatement.7"), //$NON-NLS-1$ SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } throw new SQLException(Messages.getString("CallableStatement.8"), //$NON-NLS-1$ SQLError.SQL_STATE_GENERAL_ERROR); } return this.outputParameterResults; } /** * @see java.sql.CallableStatement#getRef(int) */ public synchronized Ref getRef(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Ref retValue = rs .getRef(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getRef(java.lang.String) */ public synchronized Ref getRef(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Ref retValue = rs.getRef(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getShort(int) */ public synchronized short getShort(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); short retValue = rs .getShort(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getShort(java.lang.String) */ public synchronized short getShort(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= short retValue = rs.getShort(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getString(int) */ public synchronized String getString(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); String retValue = rs .getString(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getString(java.lang.String) */ public synchronized String getString(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= String retValue = rs.getString(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTime(int) */ public synchronized Time getTime(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Time retValue = rs .getTime(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTime(int, java.util.Calendar) */ public synchronized Time getTime(int parameterIndex, Calendar cal) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Time retValue = rs.getTime( mapOutputParameterIndexToRsIndex(parameterIndex), cal); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTime(java.lang.String) */ public synchronized Time getTime(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Time retValue = rs.getTime(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTime(java.lang.String, * java.util.Calendar) */ public synchronized Time getTime(String parameterName, Calendar cal) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Time retValue = rs.getTime(fixParameterName(parameterName), cal); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTimestamp(int) */ public synchronized Timestamp getTimestamp(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Timestamp retValue = rs .getTimestamp(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTimestamp(int, java.util.Calendar) */ public synchronized Timestamp getTimestamp(int parameterIndex, Calendar cal) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); Timestamp retValue = rs.getTimestamp( mapOutputParameterIndexToRsIndex(parameterIndex), cal); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTimestamp(java.lang.String) */ public synchronized Timestamp getTimestamp(String parameterName) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Timestamp retValue = rs.getTimestamp(fixParameterName(parameterName)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getTimestamp(java.lang.String, * java.util.Calendar) */ public synchronized Timestamp getTimestamp(String parameterName, Calendar cal) throws SQLException { ResultSet rs = getOutputParameters(0); // definitely not going to be // from ?= Timestamp retValue = rs.getTimestamp(fixParameterName(parameterName), cal); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getURL(int) */ public synchronized URL getURL(int parameterIndex) throws SQLException { ResultSet rs = getOutputParameters(parameterIndex); URL retValue = rs .getURL(mapOutputParameterIndexToRsIndex(parameterIndex)); this.outputParamWasNull = rs.wasNull(); return retValue; } /** * @see java.sql.CallableStatement#getURL(java.lang.String)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -