alf-tool / alf-core

Core classes, the kernel of Alf
MIT License
50 stars 5 forks source link

Myrrha error when using a Time (or DateTime or datetime) field #7

Closed eregon closed 10 years ago

eregon commented 10 years ago
require 'sequel'
require 'alf'

DB = Sequel.sqlite

DB.create_table :bugs do
  Integer :n
  Time :t
end

DB[:bugs].insert(n: 42, t: Time.now)

p Alf.query(DB) {
  bugs
}
blambeau commented 10 years ago

I usually use the trick below, that solves the problem here too. I'd like to remove Myrrha completely in a "near" future, so I'll close the issue for now.

::Sequel.datetime_class = ::DateTime
eregon commented 10 years ago

Why is Time not supported? I tend to dislike DateTime given its internal complexity.

blambeau commented 10 years ago

Time should normally supported, but there might be a problem in inferring the Time type or in Myrrha itself. If you can investigate further where the problem comes from, I'll fix it, but I don't have much time for Alf these days.