Re: Question about type precision vs. CHAR

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Thu May 22 2003 - 10:50:56 EDT

  • Next message: Holger Hoffstätte: "Re: Question about type precision vs. CHAR"

    "-1" means precision not specified (there was no better way to express it
    with primitive int). I'd say we should fix "-1" handling AbstractType. If
    precision is < 0, we should consistently call

      PreparedStatement.setObject(int, Object x, int)

    instead of

      PreparedStatement.setObject(int, Object x, int, int)

    We should probably file a bug for that.

    Andrus

    > [05-22 16:09:18 main] INFO JdbcAdapter: object: object-XYZ pos: 1
    > sqlType: 1 precision: -1
    > [05-22 16:09:18 main] INFO QueryLogger: *** error.
    > com.ibm.db2.jcc.c.SqlException: Invalid argument: scale must be greater
    > than or equal to 0 and less than 32.

    ....

    > org.objectstyle.cayenne.access.types.AbstractType.setJdbcObject(AbstractType.java:74)
    > at

    > Look at the line I added for JdbcAdapter: precision for CHAR types seems
    > to be -1. I cannot find any place where this is configured (it probably
    > indicates a missing value); any hints about how to fix this? Would
    > creating a new CharType and overriding setJdbcObject() be the right
    > place to substitute -1 for, say, 0?



    This archive was generated by hypermail 2.0.0 : Thu May 22 2003 - 10:50:56 EDT