ca.idms.jdbc
Class IdmsPreparedStatement

java.lang.Object
  extended by ca.idms.io.TraceObject
      extended by ca.idms.jdbc.IdmsJdbcObject
          extended by ca.idms.jdbc.IdmsResultObject
              extended by ca.idms.jdbc.IdmsStatement
                  extended by ca.idms.jdbc.IdmsPreparedStatement
All Implemented Interfaces:
Trace, SQLState, java.sql.PreparedStatement, java.sql.Statement, java.sql.Wrapper
Direct Known Subclasses:
IdmsCallableStatement

public class IdmsPreparedStatement
extends IdmsStatement
implements java.sql.PreparedStatement

Represents a CA IDMS prepared statement.

Author:
Dave Ross
See Also:
IdmsConnection, IdmsJdbcObject, IdmsStatement

Field Summary
 
Fields inherited from class ca.idms.jdbc.IdmsJdbcObject
FAKE_METHODS, FAKE_SUPPORT, fakeSupport, MESSAGES
 
Fields inherited from class ca.idms.io.TraceObject
exclude, EXCLUDE, FALSE, include, INCLUDE, logWriter, PREFIX, PROPERTIES_FILE, PROPERTIES_KEY, snap, SNAP, SNAP_BYTES, SNAP_NATIVE, SNAP_OBJECT, SNAP_SQL, snapBytes, snapNative, snapObject, snapSql, stub, trace, TRACE, TRACE_FILE, TRACE_LIFE, TRACE_NATIVE, TRACE_PRODUCT, traceLife, traceNative, traceStream, TRUE
 
Fields inherited from interface java.sql.Statement
CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT, EXECUTE_FAILED, KEEP_CURRENT_RESULT, NO_GENERATED_KEYS, RETURN_GENERATED_KEYS, SUCCESS_NO_INFO
 
Fields inherited from interface ca.idms.qcli.SQLState
SQL_00000, SQL_01000, SQL_01004, SQL_07001, SQL_07009, SQL_08001, SQL_08002, SQL_08003, SQL_08004, SQL_08006, SQL_08007, SQL_0A000, SQL_21000, SQL_22000, SQL_22001, SQL_22003, SQL_22005, SQL_22007, SQL_24000, SQL_25000, SQL_3C000, SQL_40000, SQL_42000, SQL_HY000, SQL_HY004, SQL_HY009, SQL_HY010, SQL_HY024, SQL_HY106, SQL_HYC00
 
Method Summary
 void addBatch()
          Adds a set of parameters to the list of batch updates.
 void clearParameters()
          Clears the parameter buffer and associated descriptors.
 void close()
          Indicates that the PreparedStatement is no longer prepared.
 boolean execute()
          Executes a prepared statement.
 boolean execute(java.lang.String sql)
          Hides super class method, which is invalid here.
 int[] executeBatch()
          Executes the current set of batch updates.
 java.sql.ResultSet executeQuery()
          Executes a prepared SQL query.
 java.sql.ResultSet executeQuery(java.lang.String sql)
          Hides super class method, which is invalid here.
 int executeUpdate()
          Executes a SQL INSERT, UPDATE or DELETE statement.
 int executeUpdate(java.lang.String sql)
          Hides super class method, which is invalid here.
protected  java.lang.Object get(java.lang.reflect.Field f)
          Overrides the default get method to allow the default snap method access to the value of a non-public variable.
 java.sql.ResultSetMetaData getMetaData()
          Get result set descriptors, prepares the statement if needed.
protected  ca.idms.qcli.Sqlvar getNullType(int sqlType)
          Gets the appropriate Sqlvar for a Null SQL type.
 java.sql.ParameterMetaData getParameterMetaData()
          Gets a description of the statement's parameters.
 void setArray(int p, java.sql.Array v)
          IDMS does not support the ARRAY type.
 void setAsciiStream(int p, java.io.InputStream in)
          Sets a parameter to an ASCII stream value.
 void setAsciiStream(int p, java.io.InputStream in, int len)
          Sets a parameter to an ASCII stream value.
 void setAsciiStream(int p, java.io.InputStream in, long len)
          Sets a parameter to an ASCII stream value.
 void setBigDecimal(int p, java.math.BigDecimal v)
          Sets a parameter to a BigDecimal value.
 void setBinaryStream(int p, java.io.InputStream in)
          Sets a parameter to a Binary Stream value.
 void setBinaryStream(int p, java.io.InputStream in, int len)
          Sets a parameter to a binary stream value.
 void setBinaryStream(int p, java.io.InputStream in, long len)
          Sets a parameter to a Binary stream value.
 void setBlob(int p, java.sql.Blob v)
          IDMS does not support the BLOB type.
 void setBlob(int p, java.io.InputStream arg1)
          CA IDMS does not support Blob data type
 void setBlob(int p, java.io.InputStream arg1, long arg2)
          CA IDMS does not support Blob data type
 void setBoolean(int p, boolean v)
          Sets a parameter to a Java boolean value.
 void setByte(int p, byte v)
          Sets a parameter to a Java byte value.
 void setBytes(int p, byte[] v)
          Sets a parameter to a Java array of bytes.
 void setCharacterStream(int p, java.io.Reader in)
          Sets a parameter to a Character Stream value.
 void setCharacterStream(int p, java.io.Reader in, int len)
          Sets a parameter value from an input Reader.
 void setCharacterStream(int p, java.io.Reader in, long len)
          Sets a parameter to a Character stream value.
 void setClob(int p, java.sql.Clob v)
          IDMS does not support the CLOB type.
 void setClob(int p, java.io.Reader arg1)
          CA IDMS does not support Clob data type
 void setClob(int p, java.io.Reader arg1, long arg2)
          CA IDMS does not support Clob data type
 void setDate(int p, java.sql.Date v)
          Sets a parameter to a java.sql.Date value.
 void setDate(int p, java.sql.Date v, java.util.Calendar c)
          Sets a parameter to a java.sql.Date value.
 void setDouble(int p, double v)
          Sets a parameter to a Java double value.
 void setFloat(int p, float v)
          Sets a parameter to a Java float value.
 void setInt(int p, int v)
          Sets a parameter to a Java int value.
 void setLong(int p, long v)
          Sets a parameter to a Java long value.
 void setNCharacterStream(int p, java.io.Reader arg1)
          CA IDMS does not support National Character Sets
 void setNCharacterStream(int p, java.io.Reader arg1, long arg2)
          CA IDMS does not support National Character Sets
 void setNClob(int p, java.sql.NClob arg1)
          CA IDMS does not support National Character Sets or Clobs
 void setNClob(int p, java.io.Reader arg1)
          CA IDMS does not support National Character Sets or Clobs
 void setNClob(int p, java.io.Reader arg1, long arg2)
          CA IDMS does not support National Character Sets or Clobs
 void setNString(int p, java.lang.String arg1)
          CA IDMS does not support National Character Sets
 void setNull(int p, int sqlType)
          Sets a parameter to SQL NULL.
 void setNull(int p, int t, java.lang.String n)
          Sets an input parameter to NULL.
 void setObject(int p, java.lang.Object o)
          Sets a parameter to an object with implicit type and scale 0.
 void setObject(int p, java.lang.Object o, int type)
          Sets a parameter to an object value with a scale of zero.
 void setObject(int p, java.lang.Object o, int type, int scale)
          Sets a parameter to an object value converted to the specified type.
 void setRef(int p, java.sql.Ref v)
          IDMS does not support the REFERENCE type.
 void setRowId(int p, java.sql.RowId v)
          Sets a parameter to a Java RowId type.
 void setShort(int p, short v)
          Sets a parameter to a Java short value.
 void setSQLXML(int p, java.sql.SQLXML arg1)
          CA IDMS does not support XML data type
 void setString(int p, java.lang.String v)
          Sets a parameter to a Java String value.
 void setTime(int p, java.sql.Time v)
          Sets a parameter to a java.sql.Time value.
 void setTime(int p, java.sql.Time v, java.util.Calendar c)
          Sets a parameter to a java.sql.Time value.
 void setTimestamp(int p, java.sql.Timestamp v)
          Sets a parameter to a java.sql.Timestamp value.
 void setTimestamp(int p, java.sql.Timestamp v, java.util.Calendar c)
          Sets a parameter to a java.sql.Time value.
 void setUnicodeStream(int p, java.io.InputStream in, int len)
          Deprecated. But required by PreparedStatement interface
 void setURL(int p, java.net.URL v)
          IDMS does not support the URL type.
 
Methods inherited from class ca.idms.jdbc.IdmsStatement
addBatch, cancel, clearBatch, execute, execute, execute, executeUpdate, executeUpdate, executeUpdate, finalize, getConnection, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, isPoolable, setCursorName, setEscapeProcessing, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
 
Methods inherited from class ca.idms.jdbc.IdmsResultObject
getFetchDirection, getFetchSize, isClosed, setFetchDirection, setFetchSize
 
Methods inherited from class ca.idms.jdbc.IdmsJdbcObject
clearWarnings, getWarnings, hasCursor, hasUpdate, isStarted, isSuspended, isWrapperFor, notifyStatementError, unwrap
 
Methods inherited from class ca.idms.io.TraceObject
getBoolean, getClasses, getInteger, getProperty, listProperties, message, parseList, print, print, print, println, println, snap, snap, snap, snap, snap, snap, snap, toHex, toHex, toHex, toHex, toHex, toString, trace, trace, trace, trace, trace, trace, traceEntry, unloadProperties
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.sql.Statement
addBatch, cancel, clearBatch, clearWarnings, execute, execute, execute, executeUpdate, executeUpdate, executeUpdate, getConnection, getFetchDirection, getFetchSize, getGeneratedKeys, getMaxFieldSize, getMaxRows, getMoreResults, getMoreResults, getQueryTimeout, getResultSet, getResultSetConcurrency, getResultSetHoldability, getResultSetType, getUpdateCount, getWarnings, isClosed, isPoolable, setCursorName, setEscapeProcessing, setFetchDirection, setFetchSize, setMaxFieldSize, setMaxRows, setPoolable, setQueryTimeout
 
Methods inherited from interface java.sql.Wrapper
isWrapperFor, unwrap
 

Method Detail

get

protected java.lang.Object get(java.lang.reflect.Field f)
                        throws java.lang.IllegalAccessException
Overrides the default get method to allow the default snap method access to the value of a non-public variable.

Overrides:
get in class IdmsStatement
Parameters:
f - a Field returned by Class.getDeclaredFields
Returns:
the Object named by f
Throws:
java.lang.IllegalAccessException - should not really happen, but Field.get requires it
See Also:
TraceObject.snap, TraceObject.snap()

close

public void close()
           throws java.sql.SQLException
Indicates that the PreparedStatement is no longer prepared. This allows the piggybacked COMMIT processing to work.

Specified by:
close in interface java.sql.Statement
Overrides:
close in class IdmsStatement
Throws:
java.sql.SQLException - if a database-access error occurs.

execute

public boolean execute()
                throws java.sql.SQLException
Executes a prepared statement. Some prepared statements return multiple results; the execute method handles these complex statements as well as the simpler form of statements handled by executeQuery and executeUpdate.

Specified by:
execute in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - if a database-access error occurs.
See Also:
IdmsStatement.execute(java.lang.String)

executeQuery

public java.sql.ResultSet executeQuery()
                                throws java.sql.SQLException
Executes a prepared SQL query.

Specified by:
executeQuery in interface java.sql.PreparedStatement
Returns:
ResultSet that contains the data produced by the query.
Throws:
java.sql.SQLException - if a database-access error occurs.

executeUpdate

public int executeUpdate()
                  throws java.sql.SQLException
Executes a SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.

Specified by:
executeUpdate in interface java.sql.PreparedStatement
Returns:
either the row count for INSERT, UPDATE or DELETE; or 0 for SQL statements that return nothing
Throws:
java.sql.SQLException - if a database-access error occurs.

executeQuery

public java.sql.ResultSet executeQuery(java.lang.String sql)
                                throws java.sql.SQLException
Hides super class method, which is invalid here.

Specified by:
executeQuery in interface java.sql.Statement
Overrides:
executeQuery in class IdmsStatement
Parameters:
sql - invalid!.
Returns:
nothing.
Throws:
java.sql.SQLException - if called.

executeUpdate

public int executeUpdate(java.lang.String sql)
                  throws java.sql.SQLException
Hides super class method, which is invalid here.

Specified by:
executeUpdate in interface java.sql.Statement
Overrides:
executeUpdate in class IdmsStatement
Parameters:
sql - invalid!.
Returns:
nothing.
Throws:
java.sql.SQLException - if called.

execute

public boolean execute(java.lang.String sql)
                throws java.sql.SQLException
Hides super class method, which is invalid here.

Specified by:
execute in interface java.sql.Statement
Overrides:
execute in class IdmsStatement
Parameters:
sql - invalid!.
Returns:
nothing.
Throws:
java.sql.SQLException - if called.
See Also:
IdmsStatement.getResultSet(), IdmsStatement.getUpdateCount(), IdmsStatement.getMoreResults()

setNull

public void setNull(int p,
                    int sqlType)
             throws java.sql.SQLException
Sets a parameter to SQL NULL. If the type specified is different than the type previously specified it is ignored and the previous descriptor is used. The value is NULL either way.

Specified by:
setNull in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
sqlType - SQL type code defined by java.sql.Types
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setBoolean

public void setBoolean(int p,
                       boolean v)
                throws java.sql.SQLException
Sets a parameter to a Java boolean value. The driver converts this to an IDMS SQL SMALLINT value, with true = 1 and false = 0, when it sends it to the database. There is no IDMS BIT type.

Specified by:
setBoolean in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setByte

public void setByte(int p,
                    byte v)
             throws java.sql.SQLException
Sets a parameter to a Java byte value. The driver converts this to an IDMS SQL SMALLINT value when it sends it to the database. There is no IDMS TINYINT type.

Specified by:
setByte in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setShort

public void setShort(int p,
                     short v)
              throws java.sql.SQLException
Sets a parameter to a Java short value. The driver converts this to an IDMS SQL SMALLINT value when it sends it to the database.

Specified by:
setShort in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setInt

public void setInt(int p,
                   int v)
            throws java.sql.SQLException
Sets a parameter to a Java int value. The driver converts this to an IDMS SQL INTEGER value when it sends it to the database.

Specified by:
setInt in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setLong

public void setLong(int p,
                    long v)
             throws java.sql.SQLException
Sets a parameter to a Java long value. The driver converts this to an IDMS SQL LONGINT value when it sends it to the database.

Specified by:
setLong in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setFloat

public void setFloat(int p,
                     float v)
              throws java.sql.SQLException
Sets a parameter to a Java float value. The driver converts this to an IDMS SQL REAL value when it sends it to the database.

Specified by:
setFloat in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setDouble

public void setDouble(int p,
                      double v)
               throws java.sql.SQLException
Sets a parameter to a Java double value. The driver converts this to an IDMS SQL DOUBLE value when it sends it to the database.

Specified by:
setDouble in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setBigDecimal

public void setBigDecimal(int p,
                          java.math.BigDecimal v)
                   throws java.sql.SQLException
Sets a parameter to a BigDecimal value. The driver converts this to an IDMS SQL DECIMAL value when it sends it to the database. DECIMAL and NUMERIC are equivalent as JDBC types. The IDMS DECIMAL type "packs" the data more efficiently than the IDMS NUMERIC type, and is usable directly in internal computations.

Specified by:
setBigDecimal in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds value would be truncated, or a database error occurs.

setString

public void setString(int p,
                      java.lang.String v)
               throws java.sql.SQLException
Sets a parameter to a Java String value. The driver converts this to an IDMS SQL CHAR or VARCHAR type when it sends it to the database. The default is VARCHAR, but CHAR is used if DESCRIBE INPUT has been done before this method is invoked and the actual parameter type is fixed length. There is no IDMS LONGVARCHAR type.

Specified by:
setString in interface java.sql.PreparedStatement
Parameters:
p - parameter number starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setBytes

public void setBytes(int p,
                     byte[] v)
              throws java.sql.SQLException
Sets a parameter to a Java array of bytes. The driver converts this to an IDMS SQL BINARY value when it sends it to the database. There are no IDMS VARBINARY or LONGVARBINARY IDMS types.

Specified by:
setBytes in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setDate

public void setDate(int p,
                    java.sql.Date v)
             throws java.sql.SQLException
Sets a parameter to a java.sql.Date value. The driver converts this to an IDMS SQL DATE value using the current default TimeZone when it sends it to the database.

Specified by:
setDate in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
See Also:
setDate(int,java.sql.Date,Calendar)

setTime

public void setTime(int p,
                    java.sql.Time v)
             throws java.sql.SQLException
Sets a parameter to a java.sql.Time value. The driver converts this to an IDMS SQL TIME value using the current default TimeZone when it sends it to the database.

Specified by:
setTime in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
See Also:
setTime(int,java.sql.Time,Calendar)

setTimestamp

public void setTimestamp(int p,
                         java.sql.Timestamp v)
                  throws java.sql.SQLException
Sets a parameter to a java.sql.Timestamp value. The driver converts this to an IDMS SQL TIMESTAMP value using the current default TimeZone when it sends it to the database.

Specified by:
setTimestamp in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
See Also:
setTimestamp(int,java.sql.Timestamp,Calendar)

setAsciiStream

public void setAsciiStream(int p,
                           java.io.InputStream in,
                           int len)
                    throws java.sql.SQLException
Sets a parameter to an ASCII stream value.

When a very large ASCII value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from ASCII to the database char format.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Specified by:
setAsciiStream in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
in - the java input stream which contains the ASCII parameter value
len - the maximum number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setUnicodeStream

public void setUnicodeStream(int p,
                             java.io.InputStream in,
                             int len)
                      throws java.sql.SQLException
Deprecated. But required by PreparedStatement interface

Sets a parameter to a UNICODE stream value.

When a very large UNICODE value is input to a LONGVARCHAR parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file. The JDBC driver will do any necessary conversion from UNICODE to the database char format.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Specified by:
setUnicodeStream in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
in - the java input stream which contains the UNICODE parameter value
len - the number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setBinaryStream

public void setBinaryStream(int p,
                            java.io.InputStream in,
                            int len)
                     throws java.sql.SQLException
Sets a parameter to a binary stream value.

When a very large binary value is input to a LONGVARBINARY parameter, it may be more practical to send it via a java.io.InputStream. JDBC will read the data from the stream as needed, until it reaches end-of-file.

Note: This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.

Specified by:
setBinaryStream in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
in - the java input stream which contains the binary parameter value
len - the number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

clearParameters

public void clearParameters()
                     throws java.sql.SQLException
Clears the parameter buffer and associated descriptors.

Specified by:
clearParameters in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - not!

setObject

public void setObject(int p,
                      java.lang.Object o,
                      int type,
                      int scale)
               throws java.sql.SQLException
Sets a parameter to an object value converted to the specified type.

The given Java object will be converted to the IDMS type that corresponds the specified JDBC type before being sent to the database.

Use the java.lang equivalent objects for integral values.

Note that since there are no IDMS specific abstract data types specifying type = OTHER will cause an SQLException to be thrown.

Specified by:
setObject in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
o - object containing the input parameter value
type - SQL type (as defined in java.sql.Types) to be sent to the database. The scale argument may further qualify this type.
scale - number of digits after the decimal for DECIMAL NUMERIC types, ignored for all other types.
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.

setObject

public void setObject(int p,
                      java.lang.Object o,
                      int type)
               throws java.sql.SQLException
Sets a parameter to an object value with a scale of zero.

Specified by:
setObject in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
o - object containing the input parameter value
type - JDBC SQL type.
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
See Also:
setObject(int, Object, int, int)

setObject

public void setObject(int p,
                      java.lang.Object o)
               throws java.sql.SQLException
Sets a parameter to an object with implicit type and scale 0.

The JDBC specification specifies a standard mapping from Java Object types to SQL types. The given argument java object will be converted to the corresponding IDMS SQL type before being sent to the database.

Specified by:
setObject in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
o - object containing the input parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
See Also:
setObject(int, Object, int, int)

addBatch

public void addBatch()
              throws java.sql.SQLException
Adds a set of parameters to the list of batch updates. The SQL statement can be an INSERT, UPDATE, DELETE statement.

Specified by:
addBatch in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - if all parameters have not been set
Since:
16.0

executeBatch

public int[] executeBatch()
                   throws java.sql.SQLException
Executes the current set of batch updates. The driver continues execution of the batch after an error occurs executing a statement.

This method exploits the IDMS BULK feature to provide a performance advantage for INSERT commands if the CV is R14.0 or later. When an error occurs, the update counts for all batch elements remaining in the parameter buffer are set to EXECUTE_FAILED, but the driver continues to attempt to insert remaining batch elements. IDMS does not support BULK for UPDATE and DELETE, so these commands are sent to the server separately (as are INSERTs prior to R14.0)

Note that IDMS does not support host variables in DDL, so the Statement methods should be used for DDL commands.

Specified by:
executeBatch in interface java.sql.Statement
Overrides:
executeBatch in class IdmsStatement
Returns:
complete array of update counts
Throws:
java.sql.SQLException - if not connected or the batch is empty
java.sql.BatchUpdateException - if an error occurs processing a statement
Since:
16.0

getMetaData

public java.sql.ResultSetMetaData getMetaData()
                                       throws java.sql.SQLException
Get result set descriptors, prepares the statement if needed.

Specified by:
getMetaData in interface java.sql.PreparedStatement
Returns:
result set description or null if not a SELECT
Throws:
java.sql.SQLException - if an error occurs
Since:
1.2

setArray

public void setArray(int p,
                     java.sql.Array v)
              throws java.sql.SQLException
IDMS does not support the ARRAY type.

Specified by:
setArray in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - the value, ignored
Throws:
java.sql.SQLException - always
Since:
1.2
See Also:
IdmsJdbcObject.fakeSupport

setBlob

public void setBlob(int p,
                    java.sql.Blob v)
             throws java.sql.SQLException
IDMS does not support the BLOB type.

Specified by:
setBlob in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - the value, ignored
Throws:
java.sql.SQLException - always
Since:
1.2
See Also:
IdmsJdbcObject.fakeSupport

setCharacterStream

public void setCharacterStream(int p,
                               java.io.Reader in,
                               int len)
                        throws java.sql.SQLException
Sets a parameter value from an input Reader.

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the input java.io.Reader
len - number of characters
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.2

setClob

public void setClob(int p,
                    java.sql.Clob v)
             throws java.sql.SQLException
IDMS does not support the CLOB type.

Specified by:
setClob in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - the value, ignored
Throws:
java.sql.SQLException - always
Since:
1.2
See Also:
IdmsJdbcObject.fakeSupport

setDate

public void setDate(int p,
                    java.sql.Date v,
                    java.util.Calendar c)
             throws java.sql.SQLException
Sets a parameter to a java.sql.Date value. The driver converts this to an IDMS SQL DATE value using the TimeZone from the Calendar object when it sends it to the database.

Specified by:
setDate in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - Date value
c - Calendar object specifying time zone information
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.2
See Also:
setDate(int,java.sql.Date)

setNull

public void setNull(int p,
                    int t,
                    java.lang.String n)
             throws java.sql.SQLException
Sets an input parameter to NULL. CA IDMS does not support the "advanced data types", so this method is equivalent to setNull(int,int).

Specified by:
setNull in interface java.sql.PreparedStatement
Parameters:
p - parameter number
t - SQL type from java.sql.Types
n - user defined type name, ignored
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.2

setRef

public void setRef(int p,
                   java.sql.Ref v)
            throws java.sql.SQLException
IDMS does not support the REFERENCE type.

Specified by:
setRef in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - the value, ignored
Throws:
java.sql.SQLException - always
Since:
1.2
See Also:
IdmsJdbcObject.fakeSupport

setTime

public void setTime(int p,
                    java.sql.Time v,
                    java.util.Calendar c)
             throws java.sql.SQLException
Sets a parameter to a java.sql.Time value. The driver converts this to an IDMS SQL TIME value using the TimeZone from the Calendar object when it sends it to the database.

Specified by:
setTime in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - Time value
c - Calendar object specifying time zone information
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.2
See Also:
setTime(int,java.sql.Time)

setTimestamp

public void setTimestamp(int p,
                         java.sql.Timestamp v,
                         java.util.Calendar c)
                  throws java.sql.SQLException
Sets a parameter to a java.sql.Time value. The driver converts this to an IDMS SQL TIME value using the TimeZone from the Calendar object when it sends it to the database.

Specified by:
setTimestamp in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - Timestamp value
c - Calendar object specifying time zone information
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.2
See Also:
setTimestamp(int,java.sql.Timestamp)

getParameterMetaData

public java.sql.ParameterMetaData getParameterMetaData()
                                                throws java.sql.SQLException
Gets a description of the statement's parameters. The returned object is always based on the SQLDA returned from the database by DESCRIBE INPUT, unless the database is prior to 14.0, in which case it is based on the parameters that have been set (since DESCRIBE INPUT was not supported for 12.01).

Specified by:
getParameterMetaData in interface java.sql.PreparedStatement
Returns:
an IdmsParameterMetaData object
Throws:
java.sql.SQLException - if an error occurs
Since:
1.4

setURL

public void setURL(int p,
                   java.net.URL v)
            throws java.sql.SQLException
IDMS does not support the URL type.

Specified by:
setURL in interface java.sql.PreparedStatement
Parameters:
p - parameter number
v - the value, ignored
Throws:
java.sql.SQLException - always
Since:
1.4
See Also:
IdmsJdbcObject.fakeSupport

setAsciiStream

public void setAsciiStream(int p,
                           java.io.InputStream in)
                    throws java.sql.SQLException
Sets a parameter to an ASCII stream value. This method accepts no length parameter. It calls setAsciiStream(int, InputStream, int) passing a length which is the maximum size of a CHAR column in IDMS (32,760 bytes).

Specified by:
setAsciiStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the java input stream which contains the ASCII parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setAsciiStream

public void setAsciiStream(int p,
                           java.io.InputStream in,
                           long len)
                    throws java.sql.SQLException
Sets a parameter to an ASCII stream value. This method accepts a long as a length parameter. It calls setAsciiStream(int, InputStream, int) passing either the specified length, or the maximum size of a CHAR column in IDMS (32,760 bytes), whichever is less.

Specified by:
setAsciiStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the java input stream which contains the ASCII parameter value
len - the number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setBinaryStream

public void setBinaryStream(int p,
                            java.io.InputStream in)
                     throws java.sql.SQLException
Sets a parameter to a Binary Stream value. This method accepts no length parameter. It calls setBinaryStream(int, InputStream, int) passing a length which is the maximum size of a BINARY column in IDMS (32,760 bytes).

Specified by:
setBinaryStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the java input stream which contains the binary parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setBinaryStream

public void setBinaryStream(int p,
                            java.io.InputStream in,
                            long len)
                     throws java.sql.SQLException
Sets a parameter to a Binary stream value. This method accepts a long as a length parameter. It calls setBinaryStream(int, InputStream, int) passing either the specified length, or the maximum size of a BINARY value in IDMS (32,760 bytes), whichever is less.

Specified by:
setBinaryStream in interface java.sql.PreparedStatement
Parameters:
p - parameter name
in - the java input stream which contains the binary parameter value
len - the number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setBlob

public void setBlob(int p,
                    java.io.InputStream arg1)
             throws java.sql.SQLException
CA IDMS does not support Blob data type

Specified by:
setBlob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setBlob

public void setBlob(int p,
                    java.io.InputStream arg1,
                    long arg2)
             throws java.sql.SQLException
CA IDMS does not support Blob data type

Specified by:
setBlob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setCharacterStream

public void setCharacterStream(int p,
                               java.io.Reader in)
                        throws java.sql.SQLException
Sets a parameter to a Character Stream value. This method accepts no length parameter. It calls setCharacterStream(int, Reader, int) passing a length which is the maximum size of a CHAR column in IDMS (32,760 bytes).

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the java input stream which contains the character parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setCharacterStream

public void setCharacterStream(int p,
                               java.io.Reader in,
                               long len)
                        throws java.sql.SQLException
Sets a parameter to a Character stream value. This method accepts a long as a length parameter. It calls setCharacterStream(int, Reader, int) passing either the specified length, or the maximum size of a CHAR column in IDMS (32,760 bytes), whichever is less.

Specified by:
setCharacterStream in interface java.sql.PreparedStatement
Parameters:
p - parameter number
in - the java input stream which contains the character parameter value
len - the number of bytes in the stream
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setClob

public void setClob(int p,
                    java.io.Reader arg1)
             throws java.sql.SQLException
CA IDMS does not support Clob data type

Specified by:
setClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setClob

public void setClob(int p,
                    java.io.Reader arg1,
                    long arg2)
             throws java.sql.SQLException
CA IDMS does not support Clob data type

Specified by:
setClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNCharacterStream

public void setNCharacterStream(int p,
                                java.io.Reader arg1)
                         throws java.sql.SQLException
CA IDMS does not support National Character Sets

Specified by:
setNCharacterStream in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNCharacterStream

public void setNCharacterStream(int p,
                                java.io.Reader arg1,
                                long arg2)
                         throws java.sql.SQLException
CA IDMS does not support National Character Sets

Specified by:
setNCharacterStream in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNClob

public void setNClob(int p,
                     java.sql.NClob arg1)
              throws java.sql.SQLException
CA IDMS does not support National Character Sets or Clobs

Specified by:
setNClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNClob

public void setNClob(int p,
                     java.io.Reader arg1)
              throws java.sql.SQLException
CA IDMS does not support National Character Sets or Clobs

Specified by:
setNClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNClob

public void setNClob(int p,
                     java.io.Reader arg1,
                     long arg2)
              throws java.sql.SQLException
CA IDMS does not support National Character Sets or Clobs

Specified by:
setNClob in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setNString

public void setNString(int p,
                       java.lang.String arg1)
                throws java.sql.SQLException
CA IDMS does not support National Character Sets

Specified by:
setNString in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

setRowId

public void setRowId(int p,
                     java.sql.RowId v)
              throws java.sql.SQLException
Sets a parameter to a Java RowId type. The driver converts this to an IDMS SQL BINARY value when it sends it to the database.

Specified by:
setRowId in interface java.sql.PreparedStatement
Parameters:
p - parameter index starting at 1
v - the parameter value
Throws:
java.sql.SQLException - if statement has been closed, p is out of bounds or a database error occurs.
Since:
1.6

setSQLXML

public void setSQLXML(int p,
                      java.sql.SQLXML arg1)
               throws java.sql.SQLException
CA IDMS does not support XML data type

Specified by:
setSQLXML in interface java.sql.PreparedStatement
Throws:
java.sql.SQLException - always
Since:
1.6

getNullType

protected ca.idms.qcli.Sqlvar getNullType(int sqlType)
Gets the appropriate Sqlvar for a Null SQL type. The returned Sqlvar can either be used as-is (for ordinal parameter binding) or is used as a model for cloning a new Sqlvar (for named parameter binding)

Returns:
Sqlvar which corresponds to the SQL type


Copyright © 2009 CA, All rights reserved