Additional
Overview
Features
Get
Discuss
News
Partners
Firebird Associate
 
Command Text Macro Processing PDF Print E-mail
Jan 17, 2007

FreeDAC has an extended command macro processor. It provides for dynamical changing of command text before being sent to the DBMS, hide SQL dialect differences and perform conditional expansion of command text.

 

FreeDAC supports three kinds of macro instructions.

 

Substitution variables: These allow substitution by putting parameters in command text. This extends the use of parameters. For example, to parameterize a table name in FROM clauses or column names in SELECT clauses substitution variables can be used where parameters are of no use. For example:

SELECT * FROM &Tab

 

Conditional escape sequences: These allow for an expanded SQL command (conditionally), depending on application defined attributes or currently attached DBMS. For example:

SELECT * FROM MyTab WHERE Year = {fn YEAR({fn NOW()}
{if (Oracl, TO_CHAR, MSSQL, CONVERT)} -> TO_CHAR on Oracle.