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 Armin Waibel <ar...@code-au-lait.de> on 2003/11/11 02:04:38 UTC

Kernel api changes be necessary!?

Hi all,

ok, sounds a little bit inflammatory but I
want response as quickly as possible ;-)

In SqlTypeHelper a method
public static int getSqlTypeByValue(Object value)

exists. This method returns the jdbc type of the
given object. The value is in all cases a persistence
capable field value.

But this information is declared in the metadata.
With FieldDescriptor#getColumnJdbcType() we can request
this information. So we don't need this method.

Another problem is the support of BOOLEAN datatype.
If the given object in getSqlTypeByValue(Object value)
is instance of Boolean always Types.BIT is returned. So
there is no way to support Type.BOOLEAN.

Thus I assume we have a 'design bug' in kernel api.

Usage of this method:
SqlTypeHelper#getSqlTypeByValue(Object)
<-- SqlHelper#getSqlTypeByValue(Object)
<-- StatementManager#bindValues(PrepareStmt stmt, Object[] values, int 
index)

To solve the problem we should pass a FieldDescriptor- or a
jdbcType-array, containing all associated FieldDescriptors/jdbcTypes
of the object array.

Method StatementManager#bindValues(...) was only used by
JdbcAccess in
JdbcAccess#executeUpdateSQL(String sql, ClassDescriptor cld, Object[] 
obj, boolean scrollable)
JdbcAccess#executeSQL(...)

I think we need to change method signature in these methods.

StatementManager#bindValues
(PrepareStmt stmt, Object[] values, int index)
change to ==>
StatementManager#bindValues
(PrepareStmt stmt, Object[] values, int[] jdbcTypes, int index)

JdbcAccess#executeUpdateSQL
(String sql, ClassDescriptor cld, Object[] obj, boolean scrollable)
change to ==>
JdbcAccess#executeUpdateSQL
(String sql, ClassDescriptor cld, FieldDescriptor[] fields, Object[] 
obj, boolean scrollable)

Same for JdbcAccess#executeSQL(...)

Any comments?

regards,
Armin





---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org