org.gibello.zql
Class ZqlParser

java.lang.Object
  extended by org.gibello.zql.ZqlParser

public class ZqlParser
extends java.lang.Object

ZqlParser: an SQL parser


Constructor Summary
ZqlParser()
          Create a new parser: before use, call initParser(InputStream) to specify an input stream for the parsing.
ZqlParser(java.io.InputStream in)
          Create a new parser to parse SQL statements from a given input stream.
 
Method Summary
 void addCustomFunction(java.lang.String fct, int nparm)
           
 void initParser(java.io.InputStream in)
          Initialize (or re-initialize) the input stream for the parser.
static void main(java.lang.String[] args)
          Test program: Parses SQL statements from stdin or from a text file.
 ZExp readExpression()
          Parse an SQL Expression (like the WHERE clause of an SQL query).
 ZStatement readStatement()
          Parse an SQL Statement from the parser's input stream.
 java.util.Vector readStatements()
          Parse a set of SQL Statements from the parser's input stream (all the available statements are parsed and returned).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZqlParser

public ZqlParser(java.io.InputStream in)
Create a new parser to parse SQL statements from a given input stream.

Parameters:
in - The InputStream from which SQL statements will be read.

ZqlParser

public ZqlParser()
Create a new parser: before use, call initParser(InputStream) to specify an input stream for the parsing.

Method Detail

main

public static void main(java.lang.String[] args)
                 throws org.gibello.zql.ParseException
Test program: Parses SQL statements from stdin or from a text file.
If the program receives one argument, it is an SQL text file name; if there's no argument, the program reads from stdin.

Throws:
org.gibello.zql.ParseException

initParser

public void initParser(java.io.InputStream in)
Initialize (or re-initialize) the input stream for the parser.


addCustomFunction

public void addCustomFunction(java.lang.String fct,
                              int nparm)

readStatement

public ZStatement readStatement()
                         throws org.gibello.zql.ParseException
Parse an SQL Statement from the parser's input stream.

Returns:
An SQL statement, or null if there's no more statement.
Throws:
org.gibello.zql.ParseException

readStatements

public java.util.Vector readStatements()
                                throws org.gibello.zql.ParseException
Parse a set of SQL Statements from the parser's input stream (all the available statements are parsed and returned).

Returns:
A vector of ZStatement objects (SQL statements).
Throws:
org.gibello.zql.ParseException

readExpression

public ZExp readExpression()
                    throws org.gibello.zql.ParseException
Parse an SQL Expression (like the WHERE clause of an SQL query).

Returns:
An SQL expression.
Throws:
org.gibello.zql.ParseException