On Mar 6, 4:38 pm, pete <[email protected]> wrote:
> I'm working on refactoring an existing app to use JRuby and ran into a
> case where my timestamps weren't being typecast with jdbc-sqlite when
> they were with sqlite3-ruby. Is expected behavior? Is there something
> I can do to combat this besides running Time.parse on all the records
> that come back from the database?
>
> http://gist.github.com/324056
>
> Thank you in advance.

Sequel's jdbc adapter expects JDBC to typecast the columns correctly.
In this case, you are using SQLite, and there isn't really a way for
JDBC to know that a column is a timestamp, so it returns it as a
string.  The jdbc adapter does typecast some java types to ruby types,
but JDBC is returning the column as a string, the jdbc adapter will
not do any further typecasting with it.

Running Time.parse on all records is really the only way to handle
this case.  If you are using models, you can do this in
after_initialize.  If not, you can associate a row_proc with the
dataset that will do the conversion for you.

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