Scalable Database Server, HiRDB Version 8 UAP Development Guide
The PreparedStatement interface provides the following principal functions:
Because the PreparedStatement interface is a subinterface of the Statement interface, it inherits all of the Statement interface functions.
Table 17-13 lists the methods of the PreparedStatement interface. This interface does not support methods that are not listed in the table. If an unsupported method is specified, the interface throws an SQLException.
Table 17-13 PreparedStatement interface methods
Method | Remarks |
---|---|
addBatch() | Registers up to 2,147,483,647 parameter sets for the SQL statements to be executed. If this upper limit is exceeded, this method throws an SQLException. |
clearParameters() | -- |
execute() | -- |
executeQuery() | If the SQL statement (such as an INSERT statement) does not have retrieval results, this method throws an SQLException. |
executeUpdate() | A retrieval SQL statement cannot be executed. If a retrieval SQL statement is specified, this method throws an SQLException. |
setAsciiStream(int parameterIndex, InputStream x,int length) | After input from the x argument is completed, this method does not execute the close method for x. |
setBigDecimal(int arameterIndex,BigDecimal x) | -- |
setBinaryStream(int parameterIndex, InputStream x,int length) | After input from the x argument is completed, this method does not execute the close method for x. |
setBlob(int i, Blob x) | -- |
setBoolean(int parameterIndex,boolean x) | If the data type of the ? parameter specified in the parameterIndex argument is HiRDB's CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, or NVARHAR type, the value that is set for the ? parameter is "true" when the x argument is true, and "false" ( is a single-byte space) when the x argument is false. |
setByte(int parameterIndex,byte x) | -- |
setBytes(int parameterIndex,byte b[]) | -- |
setCharacterStream(int parameterIndex,Reader reader,int length) | -- |
setDate(int parameterIndex,Date x) | -- |
setDate(int parameterIndex,Date x,Calendar cal) | -- |
setDouble(int parameterIndex,double x) | -- |
setFloat(int parameterIndex,float x) | -- |
setInt(int parameterIndex,int x) | -- |
setLong(int parameterIndex,long x) | -- |
setNull(int parameterIndex,int sqlType) | The JDBC driver ignores the sqlType argument. |
setObject(int parameterIndex,Object x) | If the data type of the ? parameter specified in the parameterIndex argument is HiRDB's CHAR, MCHAR, NCHAR, VARCHAR, MVARCHAR, or NVARHAR type and if x is a Boolean object, the value that is set for the ? parameter is "true" when the x argument value is true, and "false" ( is a single-byte space) when the x argument value is false. |
setObject(int parameterIndex,Object x,int targetSqlType) | If the targetSqlType argument is java.sql.Types.CHAR, java.sql.Types.VARCHAR, or java.sql.Types.LONGVARCHAR and if the x argument is a Boolean object, the value that is set for the ? parameter is 1 when the x argument value is true, and 0 when the x argument value is false. If the value 1 or 0 is set for a ? parameter that has HiRDB's NCHAR or NVARCHAR type, this method throws an SQLException. |
setObject(int parameterIndex,Object x,int targetSqlType,int scale) | |
setShort(int parameterIndex,short x) | -- |
setString(int parameterIndex,String x) | -- |
setTime(int parameterIndex,Time x) | -- |
setTime(int parameterIndex,Time x,Calendar cal) | -- |
setTimestamp(int parameterIndex, Timestamp x) | -- |
setTimestamp(int parameterIndex, Timestamp x,Calendar cal) | -- |
The names of the package and class for installing this interface are as follows:
Because the PreparedStatement interface is a subinterface of the Statement interface, all notes for the Statement interface also apply to the PreparedStatement interface.
This section describes additional notes that apply to the PreparedStatement interface.
For details about retaining SQL preprocessing results beyond commit or rollback processing, see 17.2.2(1)(c) Notes about specification of HIRDB_CURSOR and STATEMENT_COMMIT_BEHAVIOR.
Described below are operations that are executed when a setXXX method is used to specify a value for a ? parameter of HiRDB's DECIMAL type, and when the precision and decimal scaling position of the ? parameter do not match those of the specification value.
When a setXXX method is used to specify a value for a ? parameter of HiRDB's TIMESTAMP type, and the fraction-of-a-second precision of the value is greater than the fraction-of-a-second precision of the ? parameter, the JDBC driver truncates the fraction-of-a-second precision to match that of the ? parameter.
When a setXXX method is used to specify a value for a ? parameter of HiRDB's CHAR, VARCHAR, NCHAR, NVARCHAR, MCHAR, or MVARCHAR type, and when the length of the value after conversion to a character string expression is greater that the defined length of the ? parameter, the JDBC driver throws an SQLException.
The objects that can be specified for the x argument of setObject are objects of the following types:
All Rights Reserved. Copyright (C) 2007, Hitachi, Ltd.