Thread

  1. parser problem

    Michael Meskes <meskes@topsystem.de> — 1998-04-22T14:42:25Z

    Is it correct that the following two statements are equal?
    
    select "a" from foo;
    
    select a from foo;
    
    
    That results in the following problem for ecpg:
    
    When I'm in SQL mode (that is after reading "exec sql") I do not get
    quotations. But what do I do with this?
    
    exec sql whenever sqlerror do printf("There was an error\n");
    
    Since my lex file is almost the same as scan.l I wonder if anyone has an
    idea.
    
    Michael
    -- 
    Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
    meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
    meskes@debian.org                      | 52146 Wuerselen
    Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
    Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10
    
    
  2. Re: [HACKERS] parser problem

    Thomas Lockhart <lockhart@alumni.caltech.edu> — 1998-04-23T02:10:46Z

    > Is it correct that the following two statements are equal?
    > select "a" from foo;
    > select a from foo;
    
    Yes.
    
    > That results in the following problem for ecpg:
    > When I'm in SQL mode (that is after reading "exec sql") I do not get
    > quotations. But what do I do with this?
    > 
    > exec sql whenever sqlerror do printf("There was an error\n");
    > 
    > Since my lex file is almost the same as scan.l I wonder if anyone has 
    > an idea.
    
    What different kinds of clauses are available with the "whenever ...
    do"? My Ingres manual indicates that the syntax is:
    
      exec sql whenever <condition> <action>
    
    where <condition> is one of:
    
      sqlwarning
      sqlerror
      sqlmessage
      not found
      dbevent
    
    and the <action> is one of:
    
      continue
      stop
      goto <label>
      call <procedure>
    
    where <procedure> cannot be called with any arguments. This syntax would
    be easy to parse with your existing lexer. My SQL books shows an even
    more limited syntax with only "continue" and "goto" allowed.
    
    If you want to allow some other syntax, including double-quoted strings,
    then you will need to implement it explicitly in your grammar.
    
                           - Tom
    
    
  3. Re: [HACKERS] parser problem

    Michael Meskes <meskes@topsystem.de> — 1998-04-23T07:31:43Z

    Thomas G. Lockhart writes:
    > where <condition> is one of:
    > 
    >   sqlwarning
    >   sqlerror
    >   sqlmessage
    >   not found
    >   dbevent
    
    At the moment we only can sqlerror and not found.
    
    >   continue
    >   stop
    >   goto <label>
    
    Got these plus go to <label> and sqlprint.
    
    >   call <procedure>
    
    Hmm, this is called "do" in Oracle. I think I allow both for compatibility.
    
    > where <procedure> cannot be called with any arguments. This syntax would
    > be easy to parse with your existing lexer. My SQL books shows an even
    > more limited syntax with only "continue" and "goto" allowed.
    
    Yes, but we don't have to play it down to the standard, do we? :-)
    
    > If you want to allow some other syntax, including double-quoted strings,
    > then you will need to implement it explicitly in your grammar.
    
    IMO an argument is a very good idea. So I have to think about it a little
    bit more.
    
    Michael
    -- 
    Dr. Michael Meskes, Project-Manager    | topsystem Systemhaus GmbH
    meskes@topsystem.de                    | Europark A2, Adenauerstr. 20
    meskes@debian.org                      | 52146 Wuerselen
    Go SF49ers! Go Rhein Fire!             | Tel: (+49) 2405/4670-44
    Use Debian GNU/Linux!                  | Fax: (+49) 2405/4670-10