Re: Bug with date conversion

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]>
Newsgroups gmane.lisp.clsql.devel
Message-ID <[email protected]>
Massimiliano Campagnoli wrote: (shortened)
> Instead, query 1) using CLSQL gives out an error:
> * (CLSQL:QUERY "SELECT DATALANCIO FROM LOTTI WHERE CODICELOTTO=8100")
> Type-error in KERNEL::OBJECT-NOT-TYPE-ERROR-HANDLER:
>   98 is not of type (INTEGER 1 31)
>   [Condition of type TYPE-ERROR]

Interesting. It seems that DB2/ODBC driver returns dates differently
than Postgresql/ODBC, Oracle/ODBC, and MySQL/ODBC. It's also rather
unusual that field value submitted to the day of the month "(INTEGER 1
31)" is 98 rather than the 1998 value you have in your database. I
haven't seen any ODBC drivers return a 2-digit date field. Are you
using a ODBC v3 compatible driver with DB2? Are using unixODBC as your
ODBC driver manager or Microsoft Windows?

> But query 2) that cast the date field to ISO format works ok:
> [...]
> (("1998-07-31"))

I think the issue here is that the CHAR operator converted the
result to string field so that CLSQL handled it fine, not that the
data was in an ISO format.

I don't have a DB2 installation available to work on adding DB2
compatibility to CLSQL. Would you have a server available that I can
connect use for working on adding DB2/ODBC compatibility?

Alternately, if you wish to work on adding such compatibility, I
believe you'll find the issues are confined to the
db-odbc/odbc-api.lisp file in CLSQL. As long as submitted patches
don't affect proper ODBC functioning for Postgresql, Mysql, and
Oracle, I'll be glad to incorporate them in CLSQL.

-- 
Kevin Rosenberg
kevin-HJRc7zDS/[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.