On Sep 17, 10:22 am, funny_falcon <[email protected]> wrote:
> I'm not sure that library should guess for user which operator to use, (just
> my opinion).

In this case, it's not really guessing, it's just using types.  If you
see the ruby expression "x + 'a'", you would assume a string
concatenation operation.  If you see a ruby "x & 1" operation, you
would assume a bitwise operation.  This just updates the code to make
Sequel act more like ruby.  Since it doesn't know the type of column x
if you do ":x + 'a'", it can either generate an addition or
concatenation operation, and I think concatentation makes more sense.

Before, you would need to do ":x.sql_string + 'a'" or ":x.sql_number &
1", this just removes the need for those methods.

> In case user really wants to make `((x+1)||'a')` in SQL, what should he do
> after applying this patch?

That isn't the operator guessing part of the patch, and I don't think
such a thing was supported before (NumericExpression doesn't implement
sql_string).  || on most database types will automatically convert
numerics to strings, so I probably should at least take out the code
that disallows numeric and boolean expressions in string expressions.
To support that, I could make the following work:

  (:x + 1).sql_string + 'a'

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