On Oct 7, 11:50 am, Christer Nilsson <[email protected]>
wrote:
> No, I'm using 1.8.6.
>
> :createdDate is declared varchar(20)   (legacy stuff)
> options[:createdDate] = '2009-09-09'
>
> This works:
>       expr = expr & (:createdDate <= options[:createdDate])
>       expr = expr & (:createdDate >= options[:createdDate])
> This doesn't:
>       expr = expr & (options[:createdDate] >=
> :createdDate)                      # `>=': comparison of String with
> :createdDate failed (ArgumentError)
>       expr = expr & (options[:createdDate] <=
> :createdDate)                      # `<=': comparison of String with
> :createdDate failed (ArgumentError)
>       expr = expr & (options[:createdDate].sql_string >= :createdDate)
> # sql_string not a method
>       expr = expr & (options[:createdDate] >= :createdDate.sql_string)
> # sql_string not a method
> So, there is a workaround, but I'm still confused.

That's different than the code you posted earlier.  It's expected that

  '2009-09-09' >= :createdDate
  '2009-09-09' <= :createdDate

will fail on all ruby implementations, because all ruby
implementations define String#<= and String#>=.  The following code
should work in Sequel:

  :createdDate.sql_string

because Sequel defines Symbol#sql_string.  However, String#sql_string
is not defined by Sequel, so the following code will fail:

  '2009-09-09'.sql_string

You can use the sql_expr extension if you want, which will allow you
to do:

  '2009-09-09'.sql_expr >= :createdDate

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