org.apache.cocoon.util
Class JDBCTypeConversions
java.lang.Object
|
+--org.apache.cocoon.util.JDBCTypeConversions
- public class JDBCTypeConversions
- extends java.lang.Object
Provide some utility methods to read from JDBC result sets or store
them to JDBC statements. Largely copied from
org.apache.cocoon.acting.AbstractDatabaseAction.
The following table lists all available column type names
together with the JDBC methods used to get or set a column with
that type. In some cases the returned type differs from the type
returned by the getXXX method. To set a column, a number of
conversions are automatically used. For details, please see the
actual code.
type | getXXX | returns | setXXX |
clob | Clob | String | Clob |
ascii | Clob | String | asciStream |
big-decimal | BigDecimal | | BigDecimal |
binary | | | BinaryStream |
blob | | | Blob |
boolean | Bit | Integer | Boolean |
byte | Byte | Byte | Byte |
string | String | | String |
date | Date | | Date |
double | Double | Double | Double |
float | Float | Float | Float |
int | Int | Integer | Int |
long | Long | Long | Long |
short | Short | | Short |
time | Time | | Time |
time-stamp | Timestamp | | Timestamp |
array | Array | | Array |
row | Object | Struct | Object |
object | Object | | Object |
Method Summary |
static java.lang.Object |
convert(java.lang.Object value,
java.lang.String jType)
Converts an object to a JDBC type. |
static java.lang.Object |
getColumn(java.sql.ResultSet set,
org.apache.avalon.framework.configuration.Configuration column)
Get the Statement column so that the results are mapped correctly.
(this has been copied from AbstractDatabaseAction and modified slightly) |
static void |
setColumn(java.sql.PreparedStatement statement,
int position,
java.lang.Object value,
java.lang.Integer typeObject)
Set the Statement column so that the results are mapped correctly. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
typeConstants
public static final java.util.Map typeConstants
JDBCTypeConversions
public JDBCTypeConversions()
convert
public static java.lang.Object convert(java.lang.Object value,
java.lang.String jType)
- Converts an object to a JDBC type. This has just been started
and does not do much at the moment.
getColumn
public static java.lang.Object getColumn(java.sql.ResultSet set,
org.apache.avalon.framework.configuration.Configuration column)
throws java.lang.Exception
- Get the Statement column so that the results are mapped correctly.
(this has been copied from AbstractDatabaseAction and modified slightly)
setColumn
public static void setColumn(java.sql.PreparedStatement statement,
int position,
java.lang.Object value,
java.lang.Integer typeObject)
throws java.lang.Exception
- Set the Statement column so that the results are mapped correctly.
- Parameters:
statement
- the prepared statementposition
- the position of the columnvalue
- the value of the column
Copyright © 1999-2002 Apache Software Foundation. All Rights Reserved.