[GRASS5] PATCH: sql expression parser

Daniel Calvelo Aros dcalvelo at minag.gob.pe
Tue Jun 14 13:22:29 EDT 2005


From: Paul Kelly <paul-grass at stjohnspoint.co.uk>
Sent: Tue, 14 Jun 2005 09:22:08 +0100 (BST)
[snip]
> Ready to accept the patch for correct arithmetic precedence 
> if it is tested enough.

Seems to work:

Input row: -->>select a from b where not c+d/(e+f/2)<2 and b>1 or d<2;
<<--
Input statement: -->>select a from b where not c+d/(e+f/2)<2 and b>1 or d<2<<--
********** SQL PARSER RESULT **********
INPUT: select a from b where not c+d/(e+f/2)<2 and b>1 or d<2
COMMAND: SELECT
TABLE: b
COLUMN  1: a
WHERE:
op: OR
  op: AND
    op: NOT
      op: <
        op: +
          col: c
          op: /
            col: d
            op: +
              col: e
              op: /
                col: f
                val: 2
        val: 2
    op: >
      col: b
      val: 1
  op: <
    col: d
    val: 2
ORDER BY: (null)
***************************************

NOT also seems to be handled properly as highest precedence. I think the only
tweaking left is unary minus.

Daniel.




More information about the grass-dev mailing list