iiitToolkit 1.0

de.iiit.jdbc
Class JdbcPreparedStatement

java.lang.Object
  |
  +--de.iiit.jdbc.JdbcPreparedStatement

public class JdbcPreparedStatement
extends Object

Encapsulates a java.sql.PreparedStatement

Version:
$Revision: 1.6 $ $Date: 2003/01/01 21:03:49 $

Constructor Summary
protected JdbcPreparedStatement(JdbcConnection connection, PreparedStatement statement)
          Creates a new instance of JdbcPreparedStatement
 
Method Summary
 void clearBatch()
          Empties this JdbcPreparedStatement object's current list of SQL commands.
 void clearWarnings()
          Clears all the warnings reported on this Statement object.
 void close()
          Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
 JdbcResultSet executeQuery()
          Executes the SQL query in this PreparedStatement object and returns the JdbcResultSet object generated by the query.
 int executeUpdate()
          Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.
protected  void finalize()
          Release the JdbcConnection hold by this object explicitly.
 void setLong(int parameterIndex, long x)
          Sets the designated parameter to the given Java long value.
 void setString(int parameterIndex, String x)
          Sets the designated parameter to the given Java String value.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdbcPreparedStatement

protected JdbcPreparedStatement(JdbcConnection connection,
                                PreparedStatement statement)
Creates a new instance of JdbcPreparedStatement

Parameters:
connection - the connection that was used to create the meta data object.
statement - the encapsulated java.sql.PreparedStatement
Method Detail

executeQuery

public JdbcResultSet executeQuery()
                           throws JdbcException
Executes the SQL query in this PreparedStatement object and returns the JdbcResultSet object generated by the query.

Returns:
a JdbcResultSet object that contains the data produced by the query; never null
Throws:
JdbcException - if a database access error occurs or the SQL statement does not return a JdbcResultSet object

executeUpdate

public int executeUpdate()
                  throws JdbcException
Executes the SQL statement in this PreparedStatement object, which must be an SQL INSERT, UPDATE or DELETE statement; or an SQL statement that returns nothing, such as a DDL statement.

Returns:
either (1) the row count for INSERT, UPDATE, or DELETE statements or (2) 0 for SQL statements that return nothing
Throws:
JdbcException - if a database access error occurs or the SQL statement returns a JdbcResultSet object

clearBatch

public void clearBatch()
                throws JdbcException
Empties this JdbcPreparedStatement object's current list of SQL commands.

Throws:
JdbcException - if a database access error occurs or the driver does not support batch updates

clearWarnings

public void clearWarnings()
                   throws JdbcException
Clears all the warnings reported on this Statement object. After a call to this method, the method getWarnings will return null until a new warning is reported for this Statement object.

Throws:
JdbcException - if a database access error occurs

close

public void close()
           throws JdbcException
Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed. It is generally good practice to release resources as soon as you are finished with them to avoid tying up database resources.

Throws:
JdbcException - if a database access error occurs

setString

public void setString(int parameterIndex,
                      String x)
               throws JdbcException
Sets the designated parameter to the given Java String value. The driver converts this to an SQL VARCHAR or LONGVARCHAR value (depending on the argument's size relative to the driver's limits on VARCHAR values) when it sends it to the database.

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the parameter value
Throws:
JdbcException - if a database access error occurs

setLong

public void setLong(int parameterIndex,
                    long x)
             throws JdbcException
Sets the designated parameter to the given Java long value. The driver converts this to an SQL BIGINT value when it sends it to the database

Parameters:
parameterIndex - the first parameter is 1, the second is 2, ...
x - the parameter value
Throws:
JdbcException - if a database access error occurs

finalize

protected void finalize()
                 throws Throwable
Release the JdbcConnection hold by this object explicitly.

Overrides:
finalize in class Object
Throws:
Throwable - Any throwable thrown during the excution.

iiitToolkit 1.0

Copyright © 2002, 2003 ingeneurbuero fuer innovative informationstechnik, Dipl.-Ing. Joerg Beckmann, Dortmund, Germany. All Rights Reserved.
See Copyright statement