All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.imaginary.sql.msql.MsqlPreparedStatement

com.imaginary.sql.msql.MsqlStatement
   |
   +----com.imaginary.sql.msql.MsqlPreparedStatement

public class MsqlPreparedStatement
extends MsqlStatement
The MsqlPreparedStatement is an mSQL implementation of the JDBC PreparedStatement interface. Specifically, it enables an application to execute the same SQL over and over again without repeatedly writing logic to build the SQL statements. Instead, the application just passes new inputs. Because mSQL is completely unaware of the concept of a PreparedStatement, the mSQL driver basically hacks it by doing its own parsing and management. There is still a huge advantage to using the PreparedStatement over a regular statement in that you never have to worry about date or String formatting.
Last modified $Date: 1999/07/09 23:16:34 $

Version:
$Revision: 1.1.2.1 $
Author:
George Reese (borg@imaginary.com)

Method Index

 o addBatch()
Adds the current parameter values to the batch list and then clears the parameters for the next set of parameters.
 o clearParameters()
Clears the current parameters.
 o execute()
Executes the stored procedure with its current values.
 o executeQuery()
Executes the stored query with its current values.
 o executeUpdate()
Executes the stored update with its current values.
 o getMetaData()
This errors out because I have not yet figured out a good way to implement this for mSQL.
 o setAsciiStream(int, InputStream, int)
Sets the parameter to the data in the specified stream.
 o setBigDecimal(int, BigDecimal)
Sets the specified parameter to a BigDecimal value.
 o setBinaryStream(int, InputStream, int)
Sets the parameter to the data in the specified stream.
 o setBoolean(int, boolean)
Sets the specified parameter to a boolean value.
 o setByte(int, byte)
Sets the specified parameter to the specified byte value.
 o setBytes(int, byte[])
Sets the specified parameter to the specified byte value.
 o setCharacterStream(int, Reader, int)
Sets the parameter to the data in the specified stream.
 o setDate(int, Date)
Sets the specified parameter to a date value stored in the mSQL database as a string in the form dd-MMM-yyyy.
 o setDate(int, Date, Calendar)
Sets the specified parameter to a date value stored in the mSQL database as a string in the form dd-MMM-yyyy.
 o setDouble(int, double)
Sets the specified parameter to a double value.
 o setFloat(int, float)
Sets the specified parameter to a float value.
 o setInt(int, int)
Sets the specified parameter to an int value.
 o setLong(int, long)
Sets the specified parameter to a long value.
 o setNull(int, int)
Sets the specified parameter to a null value.
 o setNull(int, int, String)
Sets the specified parameter to a null value.
 o setObject(int, Object)
Sets the specified parameter to a Java object value by calling ob.toString().
 o setObject(int, Object, int)
Sets the specified parameter to a Java object value according to the SQL type specified.
 o setObject(int, Object, int, int)
Sets the specified parameter to a Java object value according to the SQL type specified.
 o setShort(int, short)
Sets the specified parameter to a short value.
 o setString(int, String)
Sets the specified parameter to a String value.
 o setTime(int, Time)
Sets the specified parameter to a Time value.
 o setTime(int, Time, Calendar)
Sets the specified parameter to a Time value.
 o setTimestamp(int, Timestamp)
Sets the specified parameter to a Timestamp value.
 o setTimestamp(int, Timestamp, Calendar)
Sets the specified parameter to a Timestamp value.
 o setUnicodeStream(int, InputStream, int)
Sets the specified parameter to the data contained in the specified unicode stream. Deprecated.

Methods

 o addBatch
 public void addBatch() throws SQLException
Adds the current parameter values to the batch list and then clears the parameters for the next set of parameters.

Throws: SQLException
could not add the current parameters to the batch list
 o clearParameters
 public void clearParameters() throws SQLException
Clears the current parameters.

Throws: SQLException
this is never thrown
 o execute
 public boolean execute() throws SQLException
Executes the stored procedure with its current values.

Returns:
true if the stored procedure generated a result set
Throws: SQLException
an error occurred executing the SQL
 o executeQuery
 public ResultSet executeQuery() throws SQLException
Executes the stored query with its current values.

Returns:
the results of the stored procedure
Throws: SQLException
an error occurred executing the SQL
 o executeUpdate
 public int executeUpdate() throws SQLException
Executes the stored update with its current values.

Returns:
the number of rows affected by the update
Throws: SQLException
an error occurred executing the SQL
 o getMetaData
 public ResultSetMetaData getMetaData() throws SQLException
This errors out because I have not yet figured out a good way to implement this for mSQL.

Returns:
ResultSetMetaData representing result sets for this stored procedure
Throws: SQLException
this is always thrown
 o setAsciiStream
 public void setAsciiStream(int ind,
                            InputStream in,
                            int len) throws SQLException
Sets the parameter to the data in the specified stream.

Parameters:
ind - the parameter to set
in - the stream containing the data
len - the number of bytes in the stream
Throws: SQLException
an error occurred setting the parameter
 o setBigDecimal
 public void setBigDecimal(int ind,
                           BigDecimal bd) throws SQLException
Sets the specified parameter to a BigDecimal value.

Parameters:
ind - the parameter to be set
db - the BigDecimal value
Throws: SQLException
an error occurred setting the parameter
 o setBinaryStream
 public void setBinaryStream(int ind,
                             InputStream in,
                             int len) throws SQLException
Sets the parameter to the data in the specified stream.

Parameters:
ind - the parameter to set
in - the stream containing the data
len - the number of bytes in the stream
Throws: SQLException
this is always thrown as mSQL has no binary object support
 o setBoolean
 public void setBoolean(int ind,
                        boolean b) throws SQLException
Sets the specified parameter to a boolean value. Specifically, it will set the column to the int 1 foor true or 0 for false.

Parameters:
ind - the parameter to set
b - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setByte
 public void setByte(int ind,
                     byte b) throws SQLException
Sets the specified parameter to the specified byte value.

Parameters:
ind - the paramter to be set
b - the byte value
Throws: SQLException
an error occurred setting the paramter
 o setBytes
 public void setBytes(int ind,
                      byte data[]) throws SQLException
Sets the specified parameter to the specified byte value.

Parameters:
ind - the paramter to be set
data - the byte array value
Throws: SQLException
an error occurred setting the paramter
 o setCharacterStream
 public void setCharacterStream(int ind,
                                Reader in,
                                int len) throws SQLException
Sets the parameter to the data in the specified stream.

Parameters:
ind - the parameter to set
in - the stream containing the data
len - the number of bytes in the stream
Throws: SQLException
an error occurred setting the parameter
 o setDate
 public void setDate(int ind,
                     Date d) throws SQLException
Sets the specified parameter to a date value stored in the mSQL database as a string in the form dd-MMM-yyyy.

Parameters:
ind - the parameter to be set
d - the Date value to set
Throws: SQLException
an error occurred setting the parameter
 o setDate
 public void setDate(int ind,
                     Date d,
                     Calendar cal) throws SQLException
Sets the specified parameter to a date value stored in the mSQL database as a string in the form dd-MMM-yyyy.

Parameters:
ind - the parameter to be set
d - the Date value to set
cal - the Calendar to use
Throws: SQLException
an error occurred setting the parameter
 o setDouble
 public void setDouble(int ind,
                       double d) throws SQLException
Sets the specified parameter to a double value.

Parameters:
ind - the parameter to be set
d - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setFloat
 public void setFloat(int ind,
                      float f) throws SQLException
Sets the specified parameter to a float value.

Parameters:
ind - the parameter to be set
f - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setInt
 public void setInt(int ind,
                    int x) throws SQLException
Sets the specified parameter to an int value.

Parameters:
ind - the parameter to be set
x - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setLong
 public void setLong(int ind,
                     long l) throws SQLException
Sets the specified parameter to a long value.

Parameters:
ind - the parameter to be set
l - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setNull
 public void setNull(int ind,
                     int type) throws SQLException
Sets the specified parameter to a null value.

Parameters:
ind - the parameter to be set
type - the SQL type of the value to be set
Throws: SQLException
an error occurred setting the parameter
 o setNull
 public void setNull(int ind,
                     int type,
                     String tname) throws SQLException
Sets the specified parameter to a null value.

Parameters:
ind - the parameter to be set
type - the SQL type of the value to be set
tname - the name of the UDT
Throws: SQLException
an error occurred setting the parameter
 o setObject
 public void setObject(int ind,
                       Object ob) throws SQLException
Sets the specified parameter to a Java object value by calling ob.toString().

Parameters:
ind - the parameter to be set
ob - the object to be set
Throws: SQLException
an error occurred setting the parameter
 o setObject
 public void setObject(int ind,
                       Object ob,
                       int type) throws SQLException
Sets the specified parameter to a Java object value according to the SQL type specified.

Parameters:
ind - the parameter to be set
ob - the object to be set
type - the target SQL type
Throws: SQLException
an error occurred setting the parameter
 o setObject
 public void setObject(int ind,
                       Object ob,
                       int type,
                       int scale) throws SQLException
Sets the specified parameter to a Java object value according to the SQL type specified.

Parameters:
ind - the parameter to be set
ob - the object to be set
type - the target SQL type
scale - this is ignored
Throws: SQLException
an error occurred setting the parameter
 o setShort
 public void setShort(int ind,
                      short s) throws SQLException
Sets the specified parameter to a short value.

Parameters:
ind - the parameter to be set
s - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setString
 public void setString(int ind,
                       String str) throws SQLException
Sets the specified parameter to a String value.

Parameters:
ind - the parameter to be set
str - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setTime
 public void setTime(int ind,
                     Time t) throws SQLException
Sets the specified parameter to a Time value.

Parameters:
ind - the parameter to be set
t - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setTime
 public void setTime(int ind,
                     Time t,
                     Calendar cal) throws SQLException
Sets the specified parameter to a Time value.

Parameters:
ind - the parameter to be set
t - the value to set
cal - the Calendar to use
Throws: SQLException
an error occurred setting the parameter
 o setTimestamp
 public void setTimestamp(int ind,
                          Timestamp t) throws SQLException
Sets the specified parameter to a Timestamp value.

Parameters:
ind - the parameter to be set
t - the value to set
Throws: SQLException
an error occurred setting the parameter
 o setTimestamp
 public void setTimestamp(int ind,
                          Timestamp t,
                          Calendar cal) throws SQLException
Sets the specified parameter to a Timestamp value.

Parameters:
ind - the parameter to be set
t - the value to set
cal - the Calendar to use
Throws: SQLException
an error occurred setting the parameter
 o setUnicodeStream
 public void setUnicodeStream(int ind,
                              InputStream in,
                              int len) throws SQLException
Note: setUnicodeStream() is deprecated. use setCharacterStream()

Sets the specified parameter to the data contained in the specified unicode stream.

Parameters:
ind - the parameter being set
in - the stream with the data
len - the number of bytes to be read
Throws: SQLException
an error occurred setting the parameter

All Packages  Class Hierarchy  This Package  Previous  Next  Index