Not operator in update -- set

9 views
Skip to first unread message

Lorenzo

unread,
Mar 6, 2013, 10:28:35 AM3/6/13
to squeryl-co...@googlegroups.com
Hello,

I would like to report a bug, and propose a solution too.
It seems that squeryl does not handle boolean expressions in UpdateStatement:

update(table)(row => where(..) set (row.flag := not row.flag)

See this SO discussion:
http://stackoverflow.com/questions/15243193/squeryl-how-to-toggle-a-boolean-column-using-a-partial-update/15243585#15243585

I helped the guy there because I thought it was something I had fixed before, but it was a new problem. My proposed fix is to add a NotExpression like this:

     class NotExpression(val ast: ExpressionNode)(implicit val mapper: OutMapper[BooleanType])
        extends PrefixOperatorNode(ast, "not ", false)
                with LogicalBoolean with NestedExpression with TypedExpressionNode[BooleanType]

     def not(b: BooleanExpression[BooleanType]) = new NotExpression(b)

Questions:
Does it look right? Is it ok to extend it with
TypedExpressionNode[BooleanType], or should it be done differently?
If it looks right, How do I submit the patch? I was thinking something like
1) Fork on github
2) implement & run unit tests
3) pull request

Lorenzo




Maxime Lévesque

unread,
Mar 6, 2013, 3:34:25 PM3/6/13
to squeryl-co...@googlegroups.com
You got the process right, what version is this against ?


2013/3/6 Lorenzo <lorenzo...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups
> "squeryl-contributors" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to squeryl-contribu...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
A new scientific truth does not triumph by convincing its opponents
and making them see the light, but rather because its opponents
eventually die, and a new generation grows up that is familiar with
it.

-- Max Plank
Reply all
Reply to author
Forward
0 new messages