Jeremy,

I tried to model my change on the Postgres version:

http://github.com/epugh/sequel/commit/558e6717e9e1e714c5cf8cf724fa7778e6a85bf4

If this looks like it's on the right track of what you want, then I'll  
look at adding a spec...    Or, if I am off in left field, let me know  
that as well!

Eric

On Mar 16, 2009, at 6:46 PM, Jeremy Evans wrote:

>
> On Mar 16, 2:43 pm, Eric Pugh <[email protected]> wrote:
>> I did the horrible hack of changing the mysql.rb to be this:
>>
>>        # Convert the type of v using the method in MYSQL_TYPES[type].
>>        def convert_type(v, type)
>>          if v
>>            if type == 1 && Sequel.convert_tinyint_to_bool
>>              # We special case tinyint here to avoid adding
>>              # a method to an ancestor of Fixnum
>>              v.to_i == 0 ? false : true
>>            else
>>              if v == '0000-00-00 00:00:00' or v == '0000-00-00' then
>>                nil
>>              else
>>                (t = MYSQL_TYPES[type]) ? v.send(t) : v
>>              end
>>            end
>>          else
>>            nil
>>          end
>>        end
>>
>> But of course, would like something better that doesn't require
>> hacking the gem!
>
> This question has come up in the past, so you could search the
> archives.  It's actually a smaller change with the current master
> branch, you should only have to modify 3 lines inside the
> MYSQL_TYPE_PROCS hash.
>
> I don't think Sequel should convert bogus dates to nil automatically,
> but I suppose I could consider a patch that made it optional, similar
> to some of the PostgreSQL specific options.  If you want to work on a
> patch against the master branch that makes this conversion optional,
> I'd consider it.
>
> Thanks,
> Jeremy
> >

-----------------------------------------------------
Eric Pugh | Principal | OpenSource Connections, LLC | 434.466.1467 | 
http://www.opensourceconnections.com
Free/Busy: http://tinyurl.com/eric-cal





--~--~---------~--~----~------------~-------~--~----~
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