All Packages Class Hierarchy This Package Previous Next Index
Class org.xmlmiddleware.xmldbms.datahandlers.Parameters
java.lang.Object
|
+----org.xmlmiddleware.xmldbms.datahandlers.Parameters
- public class Parameters
- extends Object
Sets parameters in an SQL statement.
The methods in this class assume that the arrays of parameter values and
Columns are in the same order as the parameters in the SQL statement.
Methods that require parameter values to be of the default object type
for the column type use the following default object types:
CHAR, VARCHAR, LONGVARCHAR: String
DATE, TIME, TIMESTAMP: java.sql.Date
BIGINT: Long
INTEGER: Integer
SMALLINT: Short
TINYINT: Byte
DECIMAL, NUMERIC: BigDecimal
DOUBLE, FLOAT: Double
REAL: Float
BINARY, VARBINARY, LONGVARBINARY: org.xmlmiddleware.conversions.ByteArray
BIT: Boolean
- Version:
- 2.0
- Author:
- Ronald Bourret
-
Parameters()
-
-
convertAndSetParameter(PreparedStatement, int, Column, Object)
- Set a single parameter, converting the object type first if necessary.
-
convertAndSetParameters(PreparedStatement, int, Column[], Object[])
- Set parameters from an array of values, converting the object type first
if necessary.
-
setParameter(PreparedStatement, int, Column, Object)
- Set a single parameter.
-
setParameters(PreparedStatement, int, Column[], Object[])
- Set parameters from an array of values.
Parameters
public Parameters()
setParameters
public static void setParameters(PreparedStatement p,
int offset,
Column columns[],
Object values[]) throws SQLException
- Set parameters from an array of values.
For best performance, parameter values should be of the default object type
for the parameter type.
- Parameters:
- p - Prepared SQL statement
- offset - Offset into the list of parameters in the prepared statement.
To start with the first parameter, use an offset of 0.
- columns - An array of Column objects corresponding to the parameters.
- values - Parameter values.
- Throws: SQLException
- A database error occurred while setting
the parameter.
setParameter
public static void setParameter(PreparedStatement p,
int number,
Column column,
Object value) throws SQLException
- Set a single parameter.
For best performance, parameter values should be of the default object type
for the parameter type.
- Parameters:
- p - Prepared SQL statement
- number - The parameter number (1-based)
- column - The column corresponding to the parameter
- value - The parameter value
- Throws: SQLException
- A database error occurred while setting
the parameter.
convertAndSetParameters
public static void convertAndSetParameters(PreparedStatement p,
int offset,
Column columns[],
Object values[]) throws SQLException
- Set parameters from an array of values, converting the object type first
if necessary.
This method checks the object type of the parameter values and performs
any necessary conversions before setting the parameter value. If the parameter
values are all known to be of the default type, use setParameters instead,
since it is faster.
- Parameters:
- p - Prepared SQL statement
- offset - Offset into the list of parameters in the prepared statement.
To start with the first parameter, use an offset of 0.
- columns - An array of Column objects corresponding to the parameters.
- values - Parameter values.
- Throws: SQLException
- A database error occurred while setting
the parameter.
convertAndSetParameter
public static void convertAndSetParameter(PreparedStatement p,
int number,
Column column,
Object value) throws SQLException
- Set a single parameter, converting the object type first if necessary.
This method checks the object type of the parameter value and performs
any necessary conversion before setting the parameter value. If the parameter
value is known to be of the default type, use setParameters instead,
since it is faster.
- Parameters:
- p - Prepared SQL statement
- number - The parameter number (1-based)
- column - A Column object describing the parameter.
- value - The parameter value.
- Throws: SQLException
- A database error occurred while setting
the parameter.
All Packages Class Hierarchy This Package Previous Next Index