Antwort: Re: [daisy] Porting to DB2
Aaron.Digulla at Globus.ch
Aaron.Digulla at Globus.ch
Thu Sep 14 07:19:28 CDT 2006
daisy-bounces at lists.cocoondev.org schrieb am 14.09.2006 10:16:06:
> > The offending query is:
> >
> > private static final String SELECT_ALL_FROM_ROLES = "select id,
> > \"name\", description, last_modified, last_modifier, updatecount from
> > roles";
> >
> > Why is name quoted in this query?
>
> This was contributed as part of a patch to support Oracle, however other
> users have meanwhile reported that this doesn't work for Oracle either,
> so in the trunk sources this is already removed again.
I see. I've imported the fixes, now and got a bit farther. The next
obstactle is boolean handling.
Somewhere (no idea where, it's *not* in db.props), BOOLEANCHAR is mapped
to CHAR.
In the DB2 docs, I found that one should use SMALLINT for booleans but
adding
BOOLEANCHAR = SMALLINT
doesn't change the mapping :-/ Ok, so I went into columns.vm and added
#if($col.Type == 'BOOLEANCHAR')...
but that didn't work, either. So I printed $col.Type and found that it
already contains 'CHAR' when Velocity gets there :-(
So my only way out was to go into the Velocity templates and add some code
to convert 1 to '1' because DB2 cannot convert int to CHAR automatically.
Unfortunately, somewhere in Daisy/Torque/JDBC, someone maps boolean false
to 'false' which cannot be stored in CHAR (too long). For example in
LocalDocumentStrategy.java in line 600, is this code:
stmt.setBoolean(5, document.isRetired());
results in this SQL:
update document_variants set last_modified = '2006-09-14 13:46:00.821',
last_modifier = 3, lastversion_id = 2, liveversion_id = 2,
***retired = 'false'***,
updatecount = 2, doctype_id = 1 where doc_id = 1 and branch_id = 1 and
lang_id = 2
which gives the error mentioned before.
Question: How do I change the mapping of BOOLEANCHAR to SMALLINT?
Regards,
--
Aaron Digulla
More information about the daisy
mailing list