On Dec 9, 9:47 am, Christian MICHON <[email protected]>
wrote:
> I choosed text/clob on purpose, not string/varchar as I wish not to
> focus on the max length for many keys/records.
>
> But how do you explain the change of behavior? What I do not
> understand is why the 1st save is ok, while the 2nd is not.

You are only calling save once. :)

I assume by first save, you mean the << call, which is the same as
insert.  This is a dataset method, not a model method, so it just
passes the string you give it directly to the database.

The actual save call uses a model object that you retrieved from the
database.  On retrieval, the JDBC clob type is converted into a
Sequel::SQL::Blob.  When you save it, it saves it in blob format (hex
escape).  The problem is, when inserting into a clob columns, H2
doesn't hex-unescape the output like it does for blobs.

In general, this issue stems from the fact that Sequel treats clobs
like blobs, and H2 does not.  There are a couple ways to fix this:

1) Add full clob support, including a Sequel::SQL::Clob class,
File :clob=>true generic type support, separate literalizations for
clob, type conversion changes in adapters.

2) Just change the h2 adapter to treat clobs as a string type instead
of a blob type.

Since 1) is pretty invasive and I'm not sure it's needed yet, I'll
probably do 2).

Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to