|
|||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.northgateis.reality.realsql
Class RealSQLCallableStatement
java.lang.Object | +--com.northgateis.reality.realsql.RealSQLStatement | +--com.northgateis.reality.realsql.RealSQLPreparedStatement | +--com.northgateis.reality.realsql.RealSQLCallableStatement
- public class RealSQLCallableStatement
- extends RealSQLPreparedStatement
- implements java.sql.CallableStatement
- extends RealSQLPreparedStatement
RealSQLCallableStatement is an implementation of the JDBC 2.0 CallableStatement interface.
When instantiated this object is used to execute an SQL stored procedure, which in a Reality database are DATABASIC subroutines. The stored procedure SQL escape syntax has one form that includes a result parameter and one that does not. If used, the result parameter must be registered as an OUT parameter. The other parameters can be used for input, output or both. Parameters are referred to sequentially, by number. The first parameter is 1.
Reality does not support the ability to return a ResultSet when executing a stored procedure, therefore all procedures are regarded as prcedures that perform an update, even though the procedure may or may not perform any physical updates on the database.
{ ?= CALL PROCEDURE_NAME(ARG1, ARG2, ...) }
{ CALL PROCEDURE_NAME(ARG1, ARG2, ...) }
For example the following procedure converts a char-value 'P2' to its corresponding ASCII character string value 'P1' and detects if this character is either a Numeric, or Upper/Lower case leter, returning this in 'P3'.
{ ?= CALL GETCHAR(?, ?) } Where P1 and P3 are registered as OUT parameters and P2 as an IN parameter. GETCHAR is defined by the following DATABASIC subroutine. 001 SUBROUTINE(RESULT, ARG1, ARG2) 002 IF ARG1 >= 48 AND ARG1 <= 59 THEN 003 ARG2 = "Numeric" 004 END ELSE IF ARG1 >= 65 AND ARG1 <= 90 THEN 005 ARG2 = "Upper" 006 END ELSE IF ARG1 >= 97 AND ARG1 <= 122 THEN 007 ARG2 = "Lower" 008 END ELSE 009 ARG2 = "Invalid" 010 END 011 RESULT = CHAR(ARG1) 012 RETURN
- See Also:
CallableStatement
,Connection.prepareCall(java.lang.String)
,ResultSet
Method Summary | |
void | clearParameters() Clears the current output parameters. |
boolean | execute() Executes the stored procedure with its current parameter values. |
java.sql.ResultSet | executeQuery() Executes the stored query with its current parameter values. |
int | executeUpdate() Executes the stored update with its current parameter values. |
java.sql.Array | getArray(int index) Currently not supported by the RealSQL-JDBC driver. |
java.math.BigDecimal | getBigDecimal(int index) Retrieves the specified parameter as a BigDecimal value. |
java.math.BigDecimal | getBigDecimal(int index,
int scale) Retrieves the specified parameter as a BigDecimal value. |
java.sql.Blob | getBlob(int index) Currently not supported by the RealSQL-JDBC driver. |
boolean | getBoolean(int index) Retrieves the specified parameter as a boolean value. |
byte | getByte(int index) Retrives the specified parameter as a byte value. |
byte[] | getBytes(int index) Retrieves the specified parameter as a byte[] value. |
java.sql.Clob | getClob(int index) Currently not supported by the RealSQL-JDBC driver. |
java.sql.Date | getDate(int index) Retrieves the specified parameter as a java.sql.Date value. |
java.sql.Date | getDate(int index,
java.util.Calendar cal) JDBC 2.0 Retrieves the specified parameter as a java.sql.Date value, using the given Calendar object. |
double | getDouble(int index) Retrieves the specified parameter as a double value. |
float | getFloat(int index) Retrieves the specified parameter as a float value. |
int | getInt(int index) Retrieves the specified parameter as an integer value. |
long | getLong(int index) Retrieves the specified parameter as a long value. |
java.lang.Object | getObject(int index) Retrieves the specified parameter as a Java object value. |
java.lang.Object | getObject(int index,
java.util.Map map) Currently not supported by the RealSQL-JDBC driver. |
java.sql.Ref | getRef(int index) Currently not supported by the RealSQL-JDBC driver. |
short | getShort(int index) Retrieves the specified parameter as a short value. |
java.lang.String | getString(int index) Rerieves the specified parameter as a String value. |
java.sql.Time | getTime(int index) Retrieved the specified parameter as a Time value. |
java.sql.Time | getTime(int index,
java.util.Calendar cal) Retrieves the specified parameter as a Time value. |
java.sql.Timestamp | getTimestamp(int index) Retrieves the specified parameter as a Timestamp value. |
java.sql.Timestamp | getTimestamp(int index,
java.util.Calendar cal) Retrieves the specified parameter as a Timestamp value. |
void | registerOutParameter(int index,
int sqlType) Registers the OUT parameter in ordinal position index to the JDBC type sqlType. |
void | registerOutParameter(int index,
int sqlType,
int scale) Registers the OUT parameter in ordinal position index to the JDBC type sqlType. |
void | registerOutParameter(int index,
int sqlType,
java.lang.String typeName) Currently not supported by the RealSQL-JDBC driver. |
boolean | wasNull() Indicates whether or not the last OUTPUT parameter read had the value of SQL NULL. |
Methods inherited from class com.northgateis.reality.realsql.RealSQLPreparedStatement |
addBatch,
close,
getInputParam,
getMetaData,
getParamCount,
sendParams,
setArray,
setAsciiStream,
setBigDecimal,
setBinaryStream,
setBlob,
setBoolean,
setByte,
setBytes,
setCharacterStream,
setClob,
setDate,
setDate,
setDouble,
setFloat,
setInt,
setLong,
setNull,
setNull,
setObject,
setObject,
setObject,
setRef,
setShort,
setString,
setTime,
setTime,
setTimestamp,
setTimestamp,
setUnicodeStream,
validateIndex |
Methods inherited from class com.northgateis.reality.realsql.RealSQLStatement |
addBatch,
addResultSet,
cancel,
clearBatch,
clearWarnings,
completeLoad,
execute,
executeBatch,
executeCatalogQuery,
executeCommon,
executeQuery,
executeQueryCommon,
executeStmt,
executeUpdate,
executeUpdateCommon,
getConnection,
getFetchDirection,
getFetchSize,
getMaxFieldSize,
getMaxRows,
getMoreResults,
getQueryTimeout,
getResultSet,
getResultSetConcurrency,
getResultSetType,
getUpdateCount,
getWarnings,
isCatalogQuery,
methodNotSupported,
prepareStmt,
reset,
setCursorName,
setEscapeProcessing,
setFetchDirection,
setFetchSize,
setMaxFieldSize,
setMaxRows,
setQueryTimeout |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Method Detail |
clearParameters
public void clearParameters() throws java.sql.SQLException
- Clears the current output parameters.
- Throws:
- java.sql.SQLException - this is never thrown.
- Overrides:
- clearParameters in class RealSQLPreparedStatement
execute
public boolean execute() throws java.sql.SQLException
- Executes the stored procedure with its current parameter values.
Reality does not support stored procedures that return a ResultSet. This method will either return false or throw an SQLException indicating an SQL non-update query has been issued.
- Returns:
- true if the stored procedure generated a result set; always returns false.
- Throws:
- java.sql.SQLException - an error occurred executing the SQL.
- Overrides:
- execute in class RealSQLPreparedStatement
executeQuery
public java.sql.ResultSet executeQuery() throws java.sql.SQLException
- Executes the stored query with its current parameter values.
Reality does not support stored procedures that return a ResultSet, therefore this method will always throw an exception.
- Returns:
- the results of the stored procedure.
- Throws:
- java.sql.SQLException - always thrown.
- Overrides:
- executeQuery in class RealSQLPreparedStatement
executeUpdate
public int executeUpdate() throws java.sql.SQLException
- Executes the stored update with its current parameter values.
The update count returned will always be zero, if necessary clients must use an OUTPUT parameter to return the number of records updated.
- Returns:
- the number of rows affected by the update, always returns zero.
- Throws:
- java.sql.SQLException - an error occurred executing the SQL.
- Overrides:
- executeUpdate in class RealSQLPreparedStatement
getArray
public java.sql.Array getArray(int index) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
JDBC 2.0 Retrieves an Array parameter.
- Specified by:
- getArray in interface java.sql.CallableStatement
- Parameters:
index
- of the parameter to be retrieved.- Returns:
- Array object.
- Throws:
- java.sql.SQLException - IM001 - "Driver does not support this function".
getBigDecimal
public java.math.BigDecimal getBigDecimal(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a BigDecimal value.
- Specified by:
- getBigDecimal in interface java.sql.CallableStatement
- Parameters:
index
- of the parameter to be retrieved.- Returns:
- BigDecimal value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getBigDecimal
public java.math.BigDecimal getBigDecimal(int index, int scale) throws java.sql.SQLException
- Retrieves the specified parameter as a BigDecimal value.
- Specified by:
- getBigDecimal in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.scale
- of the BigDecimal value.- Returns:
- BigDecimal value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getBlob
public java.sql.Blob getBlob(int index) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
Retrieves the specified parameter as a Blob value.
- Specified by:
- getBlob in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Blob value specified by index.
- Throws:
- java.sql.SQLException - IM001 - "Driver does not support this function".
getBoolean
public boolean getBoolean(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a boolean value.
- Specified by:
- getBoolean in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to retrieved.- Returns:
- boolean value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getByte
public byte getByte(int index) throws java.sql.SQLException
- Retrives the specified parameter as a byte value.
- Specified by:
- getByte in interface java.sql.CallableStatement
- Parameters:
index
- the paramter to be retrieved.- Returns:
- byte value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getBytes
public byte[] getBytes(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a byte[] value.
- Specified by:
- getBytes in interface java.sql.CallableStatement
- Parameters:
index
- the paramter to be retrieved.byte
- array value specified by index.- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getClob
public java.sql.Clob getClob(int index) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
Retrieves the specified parameter as a Clob value.
- Specified by:
- getClob in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Clob value specified by index.
- Throws:
- java.sql.SQLException - IM001 - "Driver does not support this function".
getDate
public java.sql.Date getDate(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a java.sql.Date value.
- Specified by:
- getDate in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Date value specified by idex.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getDate
public java.sql.Date getDate(int index, java.util.Calendar cal) throws java.sql.SQLException
- JDBC 2.0 Retrieves the specified parameter as a java.sql.Date value,
using the given Calendar object.
- Specified by:
- getDate in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.cal
- the Calendar to use.- Returns:
- Date value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getDouble
public double getDouble(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a double value.
- Specified by:
- getDouble in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- double value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getFloat
public float getFloat(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a float value.
- Specified by:
- getFloat in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- float value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getInt
public int getInt(int index) throws java.sql.SQLException
- Retrieves the specified parameter as an integer value.
- Specified by:
- getInt in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- integer value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getLong
public long getLong(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a long value.
- Specified by:
- getLong in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- long value specified by idex.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getObject
public java.lang.Object getObject(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a Java object value.
- Specified by:
- getObject in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- object value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getObject
public java.lang.Object getObject(int index, java.util.Map map) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
Retrieves the specified parameter as a Java object value according to the SQL type specified, uses map for the custom mapping of the parameter value.
- Specified by:
- getObject in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.map
- the object to use.- Returns:
- Object value specified by index.
- Throws:
- java.sql.SQLException - IM001 - "Driver does not support this function".
getRef
public java.sql.Ref getRef(int index) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
Retrieves the specified parameter as a Ref value.
- Specified by:
- getRef in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Ref value specified by index.
- Throws:
- java.sql.SQLException - IM001 - "Driver does not support this function".
getShort
public short getShort(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a short value.
- Specified by:
- getShort in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrived.- Returns:
- short value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getString
public java.lang.String getString(int index) throws java.sql.SQLException
- Rerieves the specified parameter as a String value.
- Specified by:
- getString in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- String value specified by index.
- Throws:
- java.sql.SQLException - an error occurred retrieving the parameter.
getTime
public java.sql.Time getTime(int index) throws java.sql.SQLException
- Retrieved the specified parameter as a Time value.
- Specified by:
- getTime in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Time value specified by index.
- Throws:
- java.sql.SQLException - if error when retrieving parameter.
getTime
public java.sql.Time getTime(int index, java.util.Calendar cal) throws java.sql.SQLException
- Retrieves the specified parameter as a Time value.
- Specified by:
- getTime in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.cal
- the Calendar to use.- Returns:
- Time value specified by index.
- Throws:
- java.sql.SQLException - if error when retrieving parameter.
getTimestamp
public java.sql.Timestamp getTimestamp(int index) throws java.sql.SQLException
- Retrieves the specified parameter as a Timestamp value.
- Specified by:
- getTimestamp in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.- Returns:
- Timestamp value specified by index.
- Throws:
- java.sql.SQLException - if error when retrieving parameter.
getTimestamp
public java.sql.Timestamp getTimestamp(int index, java.util.Calendar cal) throws java.sql.SQLException
- Retrieves the specified parameter as a Timestamp value.
- Specified by:
- getTimestamp in interface java.sql.CallableStatement
- Parameters:
index
- the parameter to be retrieved.cal
- the Calendar to use.- Returns:
- Timestamp value specified by index.
- Throws:
- java.sql.SQLException - if error when retrieving parameter.
registerOutParameter
public void registerOutParameter(int index, int sqlType) throws java.sql.SQLException
- Registers the OUT parameter in ordinal position index to the
JDBC type sqlType.
- Specified by:
- registerOutParameter in interface java.sql.CallableStatement
- Parameters:
index
- of the output parameter being registered.sqlType
- the JDBC Data Type.- Throws:
- java.sql.SQLException - an error occurred registering the parameter.
registerOutParameter
public void registerOutParameter(int index, int sqlType, int scale) throws java.sql.SQLException
- Registers the OUT parameter in ordinal position index to the
JDBC type sqlType. This version of registerOutParameter should be used when
the parameter is of JDBC type NUMERIC or DECIMAL.
- Specified by:
- registerOutParameter in interface java.sql.CallableStatement
- Parameters:
index
- of the output parameter being registered.sqlType
- the JDBC Data Type.scale
- the desired number of digits to the right of the decimal point. It must be greater than or equal to zero.- Throws:
- java.sql.SQLException - an error occurred registering the parameter.
registerOutParameter
public void registerOutParameter(int index, int sqlType, java.lang.String typeName) throws java.sql.SQLException
- Currently not supported by the RealSQL-JDBC driver.
Registers the OUT parameter in ordinal position index to the JDBC type sqlType. This version of the method registerOutParameter should be used for a user-named or REF output parameter.
Reality does not support a user-named or REF output parameter.
- Specified by:
- registerOutParameter in interface java.sql.CallableStatement
- Parameters:
index
- of the output parameter being registered.sqlType
- the JDBC Data Type.typeName
- the fully-qualified name of an SQL structured type; not used.- Throws:
- java.sql.SQLException - an error occurred registering the parameter.
wasNull
public boolean wasNull() throws java.sql.SQLException
- Indicates whether or not the last OUTPUT parameter read had the value of SQL NULL.
Note that this method should be called only after calling the get method;
otherwise, there is no value to use in determining whether it is null or not.
Reality interprets a zero-length value to be a NULL value.
- Specified by:
- wasNull in interface java.sql.CallableStatement
- Returns:
- boolean true if last last read was interpreted as NULL; else false.
- Throws:
- java.sql.SQLException -
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |