On Jul 30, 5:37 am, Paul F Fraser <[email protected]> wrote:
> Yes it is something I am interested in trying, but need a few clues as
> to method.
> Would I start by adding a type to the TYPES hash in sql.rb or would it
> be handled further up the adapter chain?
> I am using jdbc and pg 8.4
I'd suggest just adding a subclass of Sequel::SQL::Expression. Maybe
supporting an API like:
# Assume foo and bar are database columns of hstore type
:foo.hstore['a'] # foo -> 'a'
:foo.hstore + :bar # foo || bar
:foo.hstore.has_key?('a') # foo ? 'a'
:foo.hstore.include?(bar) # foo @> bar
You should probably also support taking a ruby hash and supporting it
as an hstore:
hash = {:a=>:x, :b=>:y}
hash2 = {:b=>:z}
hash.hstore['a'] # 'a=>x, b=>y'::hstore -> 'a'
hash.hstore + hash2 # 'a=>x, b=>y'::hstore || 'b=>z'::hstore
hash.hstore.has_key?('a') # 'a=>x, b=>y'::hstore ? 'a'
hash.hstore.include?(hash2) # 'a=>x, b=>y'::hstore @> 'b=>z'::hstore
If you look at lib/sequel/sql.rb in the repository to see how the
other SQL expressions are structured, that should hopefully give you a
good idea of how to proceed.
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
-~----------~----~----~----~------~----~------~--~---