> DB[:blah].insert(:text_column=>'foo', :text1_column=>'bar', 
> :geom_column=>:GeomFromText.sql_function('POINT(-1,
> -1)'))

Perfect.  Thanks Jeremy, works a treat.  Will investigate the class
methods for more exotic geometries.

Cheers,

kez

On Wed, Aug 3, 2011 at 7:29 PM, Jeremy Evans <[email protected]> wrote:
> On Aug 3, 2:23 am, kez <[email protected]> wrote:
>> Jeremy -
>>
>> The SQL code is pretty straightforward for what I am doing:
>>
>> "INSERT INTO blah (text_column, text1_column, geom_column) VALUES ("foo",
>> "bar", GeomFromText('POINT(-1,-1)'));"
>
>
> DB[:blah].insert(:text_column=>'foo', :text1_column=>'bar', 
> :geom_column=>:GeomFromText.sql_function('POINT(-1,
> -1)'))
>
> You might consider adding a method like:
>
>  def geom_point(x, y)
>    :GeomFromText.sql_function("POINT(#{x.to_i}, #{y.to_i})"))
>  end
>
> Then you could do:
>
>
> DB[:blah].insert(:text_column=>'foo', :text1_column=>'bar', 
> :geom_column=>geom_point(-1,
> -1))
>
> You could also define a GeomPoint class if you want to handle more
> geometry related stuff in ruby, and just add an sql_literal method to
> it that produced the correct SQL.  Then Sequel would integrate with it
> automatically.
>
> 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.
>
>

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