sqlpp - SQL preprocessor
sqlpp is a conventional cpp-alike preprocessor taught to understand SQL ( PgSQL,
in particular) syntax specificities.
In addition to the standard #define/#ifdef/#else/#endif cohort,
provides also #perldef for calling arbitrary perl code.
sqlpp [options] filename
-I path - include path -D var[=value] - define variable -o output - output to file ( default to stdout ) -h,--help - display this text -hh - display man page
Copyright (c) 2005 catpipe Systems ApS. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Identical to cpp
Not fully identical to cpp, the behavior is slightly different. Concatenation ( a ## b ) and stringification ( # a ) behave similar to as in cpp.
The multiline macro can be declared either tranditionally via CPP backslash line continuation, or a perl's heredoc style. In the latter case, TAG must be prepended with
Analogous to cpp.
Note: EXPRESSION is evaluated via perl runtime engine, and although can execute arbitrary perl code, it is recommended to use simple arithmetic operators. To operate with defines as strings, use double quotes.
defined() function works like in cpp, not like in perl.
Identical to cpp
macro defines how defines and macros should be tracked and substituted. The reason is that SQL code may contain non-SQL code that is so complicated that would confuse the macro parser. Such sections can be guarded with
#pragma macro(all) brackets, for example.
There are three
comments tells what to do with
-- comments. The default is
strip these from the output, however, the parts of input that are not SQL, can be guarded from incorrect parsing by
#pragma comments(strip) macros. Note that
# comments are ineffectual in macro definitions, because
# is a macro concatenation symbol.
A combination of existing pragmas.
Creates a special define or a macro, where CODE is perl code. PARAMETERS is either a list of perl scalar names ( dollar sign included ), then the code may access the parameters directly. Or, PARAMETERS is the ellipsis (...) string, in which case the code must parse
@_ by itself.
The multiline perl code can be declared either tranditionally via CPP backslash line continuation, or a perl's heredoc style. In the latter case, TAG must be prepended with
The perl code is executed in the anonymous subroutine context, and the return values are passed to further processing. Perl
printf statements may be used to produce direct output into the program output, bypassign the preprocessing.
For the shared storage the code can use
%global; for accessing contents of defines and macros,
%macros internal hashes may be used.
Dmitry Karasik <firstname.lastname@example.org>