You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/03/02 20:00:39 UTC
svn commit: r382468 - in
/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata:
JdbcType.java JdbcTypesHelper.java
Author: arminw
Date: Thu Mar 2 11:00:37 2006
New Revision: 382468
URL: http://svn.apache.org/viewcvs?rev=382468&view=rev
Log:
add new method to read column value by index
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcType.java
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcType.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcType.java?rev=382468&r1=382467&r2=382468&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcType.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcType.java Thu Mar 2 11:00:37 2006
@@ -60,6 +60,11 @@
public Object getObjectFromColumn(ResultSet rs, String columnName) throws SQLException;
/**
+ * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)}
+ */
+ public Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException;
+
+ /**
* Convert the given {@link java.lang.Long} value to
* a java object representation of this jdbc type.
*/
@@ -85,8 +90,4 @@
// * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)}
// */
// Object getObjectFromColumn(CallableStatement stmt, String columnName) throws SQLException;
-// /**
-// * Convenience method for {@link #getObjectFromColumn(ResultSet, CallableStatement, String, int)}
-// */
-// Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException;
}
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java?rev=382468&r1=382467&r2=382468&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/metadata/JdbcTypesHelper.java Thu Mar 2 11:00:37 2006
@@ -34,6 +34,7 @@
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
+import java.util.Locale;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang.builder.ToStringBuilder;
@@ -128,11 +129,18 @@
/**
* Lookup the {@link JdbcType} by name. If name was not found an exception
* is thrown.
+ *
+ * @param typeName The name of the JDBC type as String, e.g. 'bigint', 'integer'...
*/
public static JdbcType getJdbcTypeByName(String typeName)
{
- JdbcType result = null;
- result = (JdbcType) jdbcObjectTypesFromName.get(typeName.toLowerCase());
+ /*
+ arminw:
+ Some user reported problems when using OJB with non-default Localization. The
+ conversion of sql type names e.g. Turkish 'BIGINT' to lower case will not match 'bigint'
+ Hope that the specification of the localization will fix this.
+ */
+ JdbcType result = (JdbcType) jdbcObjectTypesFromName.get(typeName.toLowerCase(Locale.ENGLISH));
if (result == null)
{
throw new OJBRuntimeException("The type " + typeName + " can not be handled by OJB." +
@@ -309,6 +317,11 @@
public Object getObjectFromColumn(ResultSet rs, String columnName) throws SQLException
{
return getObjectFromColumn(rs, null, columnName, MIN_INT);
+ }
+
+ public Object getObjectFromColumn(ResultSet rs, int columnId) throws SQLException
+ {
+ return getObjectFromColumn(rs, null, null, columnId);
}
public Object getObjectFromColumn(final ResultSet rs, final CallableStatement stmt,
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org