Forum OpenACS Development: Response to Brief update on CVS status ...

Collapse
Posted by Don Baccus on
Dan's about 99% right - queries that are mostly SQL92 compliant ("mostly" because currently I'm including function calls to PL/[pg]SQL functions in that category - at the moment we can't use any RDMBS without decent programatic language support) go in *.xql.

This means outer joins don't go into *-postgresql.xql after porting because they're portable to any SQL92 RDBMS (PG supports pure SQL92 outer joins).  Of course, the oracle specific outer joins do have to go to *-oracle.sql.  Porting the query to SQL92/PG outer join syntax and sticking it in the generic *.xql file means you've also completed the query port for InterBase - congratulations!

Likewise, the query extractor converts "nvl" into "coalesce" and puts the new query into *.xql, not *-postgresql.xql.  Since Oracle (to my surprise) doesn't handle "coalesce" the original "nvl" query is stuck into the proper *-oracle.xql queryfile.

Direct db_exec_plsql calls put nothing into the generic *.xql file, because standard SQL92 doesn't have any equivalent to use as a basis for writing a portable query.  These get copied into both the *-oracle.xql and *-postgresql.xql files.

Queries that are copied but can't be fixed by the extractor in its current form are flagged "FIX ME" with an explanation, i.e. "FIX ME OUTER JOIN".

The easiest way to understand this is to download the extractor and run it over one of the larger models.  Please read the README_PORTERS file first, though - it explains the above in more detail and also some of the limitations. The query extractor is by no means perfect, it is meant to catch a bunch of common cases and put them in the right place and convert when it is easy to do so.  Even though it's not perfect it certainly is a timesaver.