Running the SQL preprocessor (sqlpp)

This section provides the syntax of the sqlpp command and describes the sqlpp command line options.

Syntax

sqlpp [ options ] sql-filename [ output-filename ]

Parameters

The following table lists the options available for the sqlpp utility.

Table 4-1: sqlpp options

Option

Description

-d

Favor data size

-e level

Flag non-conforming SQL syntax as an error

-f

Put the far keyword on generated static data

-h line-width

Limit the maximum line length of output

-k

Include user declaration of SQLCODE

-n

Line numbers

-o operating-sys

Target operating system specification (WINDOWS, WINNT or UNIX)

-q

Quiet mode—do not print banner

-r

Generate reentrant code

-s string-len

Maximum string constant length for the compiler

-w level

Flag non-conforming SQL syntax as a warning

-x

Change multibyte SQL strings to escape sequences

-z sequence

Specify collation sequence

Usage

The SQL preprocessor processes a C or C++ program containing Embedded SQL before the compiler is run. sqlpp translates the SQL statements in the input file sql-filename into C language source that is put into the output-filename. The normal extension for source programs with Embedded SQL is .sqc. The default output filename is the sql-filename with an extension of .c. If the sql-filename has a .c extension, the default output filename extension is .CC.

Options

Favor data size (-d) Generate code that reduces data space size. Data structures are reused and initialized at execution time before use. This increases code size.

Flag SQL/92 errors (-e level) This option flags any Embedded SQL that is not part of a specified set of SQL/92 as an error.

The allowed values of level and their meanings are as follows:

Add far keyword (-f) Put the far keyword in front of preprocessor-generated data. This may be required in conjunction with the Borland C++ compiler for the large memory model. By default, all static data is put in the same segment. Adding the far keyword forces static data into different segments. (By default, WATCOM C and Microsoft C place data objects bigger than a threshold size in their own segment.)

Limit maximum output line length (-h num) Limits the maximum length of lines output by SQLPP to num. The continuation character is a back slash (\), and the minimum value of num is ten.

User SQLCODE declaration (-k) Notifies the preprocessor that the program to be compiled includes a user declaration of SQLCODE.

Generate line number information (-n) Generate line number information in the C file. This consists of #line directives in the appropriate places in the generated C code. If the compiler you are using supports the #line directive, this option makes the compiler report errors on line numbers in the SQC file (the file with the Embedded SQL) as opposed to reporting errors on line numbers in the C file generated by the SQL preprocessor. Also, the #line directives are used indirectly by the source level debugger so that you can debug while viewing the SQC source file.

Target operating system (-o) Specify the target operating system. Note that this option must match the operating system where you run the program. A reference to a special symbol is generated in your program. This symbol is defined in the interface library. If you use the wrong operating system specification or the wrong library, an error is detected by the linker. The supported operating systems are:

Operate quietly (-q) Operate quietly. Do not print the banner.

Generate reentrant code (-r) For more information on reentrant code, see the discussion of SQLCA management for multi-threaded or reentrant code in the Adaptive Server Anywhere Programming Guide.

Set maximum string size (-s string-len) Set the maximum size string that the preprocessor puts into the C file. Strings longer than this value are initialized using a list of characters ('a','b','c', etc.). Most C compilers have a limit on the size of string literal they can handle. This option is used to set that upper limit. The default value is 500.

Flag SQL/92 warnings (-w level) This option flags any Embedded SQL that is not part of a specified set of SQL/92 as a warning.

The allowed values of level and their meanings are as follows:

Escape (-x) Change multibyte strings to escape sequences so that they can pass through compilers.

Specify collation sequence (-z sequence) This option specifies the collation sequence or filename. (For a listing of available collation sequences, see “The Collation utility (dbcollat)”).

The collation sequence is used to help the preprocessor understand the characters used in the source code of the program, for example, in identifying alphabetic characters suitable for use in identifiers. If -z is not specified, the preprocessor attempts to determine a reasonable collation to use, based on the operating system and SQLLOCALE environment variable.

See also

The chapter “Embedded SQL Programming” of the Adaptive Server Anywhere Programming Guide

Chapter 7, “SQL Preprocessor Error Messages” in the Sybase IQ Troubleshooting and Error Messages Guide