On Thu, Jan 24, 2002 at 01:00:19PM -0800, Jeff Zucker wrote: > I am in the process of making SQL::Parser more able to handle a variety > of implementation specific SQL syntaxs and would value suggestions both > in terms of types of variations to handle and in the specifics shown > below. > > The three areas I have tackled first are case sensitivity of column > names, style of embedded comments, and style of escaping for single > quote characters. Essentially, for each one there will be a default > behaviour which can be modified by users either with flags to the new() > method or by creating a dialect config file that defines multiple > features.
I'd strongly suggest that the configuration be implemented in a way compatible with ODBC GetInfo, as far as possible. Which basically means use something like a hash where the key is an integer and the value is the corresponding value of a GetInfo call using that key. See: http://archive.develooper.com/dbi-dev%40perl.org/msg00524.html http://archive.develooper.com/dbi-dev%40perl.org/msg00525.html http://documentacion.hispano4d.com/CMU/CMU11922.HTM Also let it be specified by passing a code ref, in which case the code ref is called with the relevant integer and expected to return the corresponding value. That way you could get SQL::Parser to work in the same way as any given database by simply doing like: $my_sql_parser->config( get_info => sub { $dbh->get_info(shift) } ) Having a way to cahe the info to disk would also be good, for times when the database whoose behaviour you're copying isn't available. (I imagine people could package up these configs into modules like SQL::Parser::Config::Oracle7 or whatever.) > By default column names will be case sensitive, comments will consist of > lines starting with a double hyphen and ending with a newline, and > single quotes will be escaped by doubling them (WHERE name = > 'O''REILLY') but all of the defaults can be modified with user flags or > dialect config file options. > > So, for example, the SQL statement below containing '/* comment */' > would return an error for test('SQL92') but would return 'ok' for > test('ORACLE') whereas the SQL containing '-- comment' would do the > reverse. Both statements would succeed for test('MySQL'). Please make SQL92 the default as far as possible. That means all identifiers are case insentivive unless enclose in double quotes. And the comment style is C-style. Tim.
