org.castor.jdo.engine
Class SQLTypeInfos
java.lang.Object
org.castor.jdo.engine.SQLTypeInfos
public final class SQLTypeInfos
extends java.lang.Object
Utility class to translate SQL type by integer value or name into corresponding
Java type.
$Revision: 7134 $ $Date: 2006-04-08 08:58:10 -0600 (Sat, 08 Apr 2006) $static Object | getValue(ResultSet rs, int index, int sqlType) - Get value from given ResultSet at given index with given SQL type.
|
static int | javaType2sqlTypeNum(Class javaType) - Returns the SQL type from the specified Java type.
|
static void | setValue(PreparedStatement stmt, int index, Object value, int sqlType) - Set given value on given PreparedStatement at given index with given SQL type.
|
static Class | sqlTypeName2javaType(String sqlTypeName) - Returns the Java type for the given SQL type name.
|
static Class | sqlTypeNum2javaType(int sqlTypeNum) - Returns the Java type for the given SQL type.
|
getValue
public static Object getValue(ResultSet rs,
int index,
int sqlType)
throws SQLException
Get value from given ResultSet at given index with given SQL type.
rs
- The ResultSet to get the value from.index
- The index of the value in the ResultSet.sqlType
- The SQL type of the value.
javaType2sqlTypeNum
public static int javaType2sqlTypeNum(Class javaType)
Returns the SQL type from the specified Java type. Returns OTHER
if the Java type has no suitable SQL type mapping.
javaType
- The Java class of the SQL type.
- SQL type from the specified Java type.
setValue
public static void setValue(PreparedStatement stmt,
int index,
Object value,
int sqlType)
Set given value on given PreparedStatement at given index with given SQL type.
stmt
- The PreparedStatement to set value on.index
- The index of the value in the PreparedStatement.value
- The value to set.sqlType
- The SQL type of the value.
sqlTypeName2javaType
public static Class sqlTypeName2javaType(String sqlTypeName)
throws MappingException
Returns the Java type for the given SQL type name.
sqlTypeName
- SQL type name (e.g. numeric).
sqlTypeNum2javaType
public static Class sqlTypeNum2javaType(int sqlTypeNum)
throws MappingException
Returns the Java type for the given SQL type.
sqlTypeNum
- SQL type name (see JDBC API)
Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com