I'm trying to write some data definition code (DDL) and data
manipulation (DML) SQL code and I want a single source code file for
both Oracle PL/SQL and Microsoft's TSQL.


Does anyone know of a pre-processor that would accept a source file like
this 
-- begin file xyz.sql
#if PLSQL
<ORACLE only SQL statements go here>
#elseif TSQL 
<Microsoft TSQL specific statements go here>
#elseif !TSQL && !PLSQL
<Statements for other databases like MYSQL and DB2 go here>
#endif


<Statements common to all databases go here.>


#if PLSQL || TSQL
<statements common to PLSQL and TSQL go here>
#else
<statements common to all other databases go here>
#endif
<more statements common to all databases go here>

-- end file xyz.sql


This preprocessor would read the above source code and produce separate
files that only contain PLSQL code, TSQL code and other.


One would run the pre-processor like this:


perl dabatase_preprocessor.pl <xyz.sql >xyz.tsql.sql TSQL
perl dabatase_preprocessor.pl <xyz.sql >xyz.plsql.sql PLSQL



Hmmm... I'm guessing I'd have to write my own in perl....  I thought I
would check before starting on the project to avoid reinventing the
wheel. I was not sure what to google search for.


I guess I'll grab the recursive descent parser out of an antique edition
of the camel book to evaluate my logic expressions.


Anyone have any suggestions to make it easier?
Can anyone help me get started?


Thanks
Siegfried

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to