.TH SqlParser Onyx
.SH NAME
SqlParser \- Base grammar for SQL's
.SH SYNOPSYIS
.nf
class SqlParser : public Parser {
	char		*sql_database;
	
	Text		*sql_results;
	
	int		sql_row_type;	/* 0 = Backup no Rows
					   1 = Rows in file
					   2 = Rows in Text
					*/
	
	Text		*sql_row_text;
	int		sql_row_fd;
	LineStream	*sql_row_stream;
	
	SqlParser();
	virtual ~SqlParser( );
	
	virtual int	message(char *str,
		char *s1=0, char *s2=0, char *s3=0,
		char *s4=0, char *s5=0, char *s6=0,
		char *s7=0, char *s8=0, char *s9=0
		);
	virtual int	error(
		char *s1=0, char *s2=0, char *s3=0,
		char *s4=0, char *s5=0, char *s6=0,
		char *s7=0, char *s8=0, char *s9=0
		);
	
	virtual int		sql();
	virtual int		statement();
	virtual int		database();
	
	virtual int		sql_new(LineStream *Init);
	virtual int		sql_new(Text *Init);
	virtual int		sql_new(char *Init);
	
	virtual int		sql_open();
	virtual int		sql_close();
	
	virtual int		sql_up();
	
	virtual void		sql_purge();
	virtual void		sql_read();
	
	virtual Text		*sql_getresult();
	virtual LineStream	*sql_getstream();
	virtual char		*sql_getrow();
	virtual int		sql_getnum();
	}
.fi
.SH DESCRIPTION
SqlParser is the base class of the Sql's used in Onyx. It definies the
things nessesary in any sql, and the global handling of all sql's.

Normal way to access a sql from C++ is to create a sqlparser (normaly
SqlManager or SqlClient) and give him the transactions by calling
sql_new, which can handle LineStreams, Text, and Strings.

Y now can check the results and errors by calling sql_getresults().
Y can check the number of rows affected by calling sql_getnum().
Y can get the rows retrieved by a select statement by calling
sql_getstream() if Y want them all at a time, or calling sql_getrow()
if Y prefer to get them one after the other.

Y can call sql_up() anytime to check it Yr parser is connected to a
running database engine.

Transactions are written in what I call a BASIC SQL.
Y also can call it a cripled SQL, so if Y need a ANSI-SQL3 buy it,
dont flame be because my parsers are not ANSI compilant.

Any Statement have to end with a semicolon.

SqlParser is nearly doing nothing. Only a few non terminals
are defined here, and can be used or overloaded by child classes.
.SH IMPLEMENTATION
.PP
sql : 
.br
.in +0.8i
.ad l
.nh
statement  ";" | true  
.br
;
.br
.hy

This first purges the parsers from old errors, results or rows
retrieved. Now checks if it is a valid statement, or give an
error.
.PP
statement : 
.br
.in +0.8i
.ad l
.nh
database  
.br
;
.br
.hy

Only database is a valid statement here.
.PP
database : 
.br
.in +0.8i
.ad l
.nh
"database" matchexp  | "connect" matchexp  | "disconnect" matchexp  
.br
;
.br
.hy

This checks if a statement begins with "database" and trys to
connect to the database calling sql_open().

Also "connect" and "disconnect" are valid here.
.SH AUTHOR
Michael Koehne <kraehe@bakunin.north.de>
