SQL Preprocessor for UltraLite utility (sqlpp)

Preprocesses a C/C++ program that contains embedded SQL (ESQL), so that code required for that program can be generated before you run the compiler. Note that the table below describes the entire set of options for completeness, but the only relevant options for UltraLite are -eu and -wu.

Syntax
sqlpp -u [ options ] esql-filename [ output-filename ]
Option Description
-d Generate code that reduces data space size, but increases code size. Data structures are reused and initialized at execution time before use.
-e flag

This option flags as an error any static embedded SQL that is not part of a specified standard. The level value indicates the standard to use. For example, sqlpp -e c03 ... flags any syntax that is not part of the core SQL/2003 standard.

The allowed values of level are:

  • c03   Flag syntax that is not core SQL/2003 syntax

  • p03   Flag syntax that is not full SQL/2003 syntax

  • c99   Flag syntax that is not core SQL/1999 syntax

  • p99   Flag syntax that is not full SQL/1999 syntax

  • e92   Flag syntax that is not entry-level SQL/1992 syntax

  • i92   Flag syntax that is not intermediate-level SQL/1992 syntax

  • f92   Flag syntax that is not full-SQL/1992 syntax

  • t   Flag non-standard host variable types

  • u   Flag syntax that is not supported by UltraLite

For compatibility with previous SQL Anywhere versions, you can also specify e, I, and f, which correspond to e92, i92, and f92, respectively.

-h width Limits the maximum length of split lines output by sqlpp to width in the .c file. Backslash characters are added to the end of split lines, so that a C compiler can parse the split lines as one continuous line. The default value is no maximum line length (output lines are not split by default).
-k Notify the preprocessor that the program to be compiled includes a user declaration of SQLCODE.
-n

Generate line number information in the C file by using #line directives in the appropriate places in the generated code.

Use this option to the report source errors and to debug source on line numbers in the esql-filename file, rather than in the output-filename file.

-o O/S spec Not applicable to UltraLite.
-q Set the utility to run in quiet mode. Suppress informational banners, version numbers, and status messages. Error messages are still displayed, however.
-r Not applicable to UltraLite.
-s string-length Set the maximum size string that the preprocessor will put into the C file. Strings longer than this value are initialized using a list of characters ('a','b','c', and so on). 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.
-u Required for UltraLite. Generate output specifically required for UltraLite databases.
-w level

Flag non-conforming SQL syntax as a warning. The level value indicates the standard to use. For example, sqlpp -w c03 ... flags any SQL syntax that is not part of the core SQL/2003 syntax.

The allowed values of level are:

  • c03   Flag syntax that is not core SQL/2003 syntax

  • p03   Flag syntax that is not full SQL/2003 syntax

  • c99   Flag syntax that is not core SQL/1999 syntax

  • p99   Flag syntax that is not full SQL/1999 syntax

  • e92   Flag syntax that is not entry-level SQL/1992 syntax

  • i92   Flag syntax that is not intermediate-level SQL/1992 syntax

  • f92   Flag syntax that is not full-SQL/1992 syntax

  • t   Flag non-standard host variable types

  • u   Flag syntax that is not supported by UltraLite

For compatibility with previous SQL Anywhere versions, you can also specify e, I, and f, which correspond to e92, i92, and f92, respectively.

-x Change multibyte strings to escape sequences, so that they can be passed through a compiler.
-z collation-sequence Specify the collation sequence.
Remarks

This preprocessor translates the SQL statements in the input-file into C/C++. It writes the result to the output-filename. The normal extension for source files containing embedded SQL is sqc. The default output-filename is the esql-filename base name with an extension of c. However, if the esql-filename already has the .c extension, the default output extension is .cc.

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. In UltraLite, collations include a code page plus a sort order. If you do not specify -z, the preprocessor attempts to determine a reasonable collation to use based on the operating system.

To see a list of supported collations (and its corresponding codepage), run ulcreate -l at a command prompt.

Tip

The SQL preprocessor (sqlpp) has the ability to flag static SQL statements in an embedded SQL application at compile time. This feature can be especially useful when developing an UltraLite application, to verify SQL statements for UltraLite compatibility. You can test compatibility of SQL for both SQL Anywhere and UltraLite applications by using either -e and/or -w options. For an overview of the SQL Flagger, see Testing SQL compliance using the SQL Flagger.

See also
Example

The following command preprocesses the srcfile.sqc embedded SQL file in quiet mode for an UltraLite application.

sqlpp -u -q MyEsqlFile.sqc