db-torque-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joe Carter" <joe.car...@gmail.com>
Subject RE: Prepared statements
Date Wed, 24 May 2006 17:09:46 GMT
Hi again,

I've changed the call in my Peer to use doPSSelect() instead of doSelect().
It seems to be confused about one of my fields.

I get this exception...

Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Implicit conversion
from datatype 'CHAR' to 'NUMERIC' is not allowed.  Use the CONVERT
function to run this query.

    at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2614)
    at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2007)
    at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)
    at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)
    at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1548)
    at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1533)
    at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:72)
    at com.p6spy.engine.logging.P6LogPreparedStatement.executeQuery(P6LogPreparedStatement.java:172)
    at org.apache.torque.util.BasePeer.doPSSelect(BasePeer.java:1439)
    ... 31 more

The statement from p6spy is...
148490079357|4|1|statement|SELECT security_subscriber.SUBSCRIBER_ID,
security_subscriber.SERVICE_PROVIDER_ID_NUM,
security_subscriber.USERNAME, security_subscriber.PIN,
security_subscriber.PIN_REQUIRED,
security_subscriber.PIN_CHANGE_REQUIRED,
security_subscriber.PIN_CHANGED, security_subscriber.PASSWORD,
security_subscriber.PASSWORD_REQUIRED,
security_subscriber.LOGIN_FAIL_COUNT,
security_subscriber.SECURITY_QUESTION,
security_subscriber.SECURITY_ANSWER,
security_subscriber.UTC_LOCKED_UNTIL,
security_subscriber.PASSWORD_CHANGE_REQUIRED,
security_subscriber.PASSWORD_CHANGED,
security_subscriber.SECURITY_A_CHANGE_REQUIRED,
security_subscriber.SECURITY_A_CHANGED,
security_subscriber.UTC_LOCKED_ON FROM security_subscriber WHERE
security_subscriber.SERVICE_PROVIDER_ID_NUM= ? |SELECT
security_subscriber.SUBSCRIBER_ID,
security_subscriber.SERVICE_PROVIDER_ID_NUM,
security_subscriber.USERNAME, security_subscriber.PIN,
security_subscriber.PIN_REQUIRED,
security_subscriber.PIN_CHANGE_REQUIRED,
security_subscriber.PIN_CHANGED, security_subscriber.PASSWORD,
security_subscriber.PASSWORD_REQUIRED,
security_subscriber.LOGIN_FAIL_COUNT,
security_subscriber.SECURITY_QUESTION,
security_subscriber.SECURITY_ANSWER,
security_subscriber.UTC_LOCKED_UNTIL,
security_subscriber.PASSWORD_CHANGE_REQUIRED,
security_subscriber.PASSWORD_CHANGED,
security_subscriber.SECURITY_A_CHANGE_REQUIRED,
security_subscriber.SECURITY_A_CHANGED,
security_subscriber.UTC_LOCKED_ON FROM security_subscriber WHERE
security_subscriber.SERVICE_PROVIDER_ID_NUM= '1'

It seems to be quoting the SERVICE_PROVIDER_ID_NUM which is a
NUMERIC field (BigDecimal in Java). Column spec follows...

    <column name="SERVICE_PROVIDER_ID_NUM"
      type="NUMERIC"
      size="12"
      required="true"
      description="Which provider is this subscriber associated with"/>

Is this a known issue?
I presume I'm going to have to build and fix Torque to sort this out?
Or am I missing something?

If there's more information I can provide, just let me know.
Also is there any way of switching to prepared mode for selects
without hacking the generated code?
It's all statics in the peers so there's no easy way to overload it
that I can see.

Thanks

Joe

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


Mime
View raw message