The OPM Query Translator consists of several modules that are intimately related. The OqJoin class handles the generation of SQL joins and SQL queries in general. The OqVar class handles the evaluation of variables. OqCond handles condition evaluation. All of these modules are used by OqtCom, the common translator module, subclassed by OqtRaw, the raw SQL translator, and OqtSsp, the Sybase stored procedure translator.
For purposes of testing, debugging, studying the output SQL translation, as well as applications development, the SQL translation drivers oqtraw and oqtssp are provided in the developer's kit. Sample unix sessions are shown below:
% oqtraw -v 2 -s metadata.so -q sel01.oqt -T tupout.sql -O oidout.sql
% oqtssp -v 2 -s metadata.so -q sel01.oqt -o out.sql
The, -v 2 or "verbosity level 2" tells the translator to also generate projection descriptors information as comments in the output SQL files. The tupout.sql file contains the tuple projection output SQL. The oidout.sql file contains the SQL template to be reused for retrieving an object instance. The Oid parameter is replaced by the actual value in the query resubmission. The out.sql file for stored procedure provides a cursor based output that combines both tuple and object output using stored procedures. This SQL output may be executed directly using Sybase's isql utility for testing. For update queries, oqtssp is sufficient. For retrieval queries, one gets a relational dumps from isql, but no repackaging of the results in an object format, hence, it is not sufficient for serious application use.