UltraLite Database User's Guide
Utility Programs
Embedded SQL static development model only.
The SQL preprocessor processes a C or C++ program containing embedded SQL, before the compiler is run.
sqlpp [ options ] sql-filename [ output-filename ]
Option | Description |
---|---|
-c "keyword=value;...." | Supply database connection parameters for your reference database |
-d | Generate code that favors small data size |
-e level | Flag non-conforming SQL syntax as an error |
-g | Do not display UltraLite warnings |
-h line-width | Limit the maximum line length of output |
-k | Include user |
-m version | Specify the version name for generated synchronization scripts |
-n | Line numbers |
-o operating-sys | Target operating system: WIN32, WINNT, NETWARE, or UNIX |
-p project-name | UltraLite project name |
-q | Quiet mode—do not print banner |
-s string-len | Maximum string length for the compiler |
-w level | Flag non-conforming SQL syntax as a warning |
-x | Change multi-byte SQL strings to escape sequences. |
-z sequence | Specify collation sequence |
The SQL preprocessor processes a C or C++ source file that contains embedded SQL, before the compiler is run. This preprocessor translates the SQL statements in the input-file into C/C++. It writes the result to the output-file. The normal extension for source files containing embedded SQL is sqc. The default output filename is the SQL-filename base name with an extension of c. However, if the SQL-filename already has the .c extension, the default output extension is .cc.
When preprocessing files that are part of an UltraLite application, the SQL preprocessor requires access to an Adaptive Server Anywhere reference database. You must supply the connection parameters for the reference database using the -c option.
If you specify no project name, the SQL preprocessor also runs the UltraLite generator and appends additional code to the generated C/C++ source file. This code contains a C/C++ language description of your database schema as well as the implementation of the SQL statements in the application.
Customizing UltraLite generator operations The UltraLite analyzer provides hooks that you can use to customize the code generation process. These hooks are stored procedure names. If you supply stored procedures with the following names, the UltraLite analyzer invokes them before and after the analysis process:
sp_hook_ulgen_begin( )
sp_hook_ulgen_end( )
These hooks are defined in the reference database and are used only during the analyzer analysis phase. The hooks can be created as follows:
CREATE PROCEDURE sp_hook_ulgen_begin () BEGIN // actions here END CREATE PROCEDURE sp_hook_ulgen_end () BEGIN // actions here END
-c Required when preprocessing files that are part of an UltraLite application. The connection string must give the SQL preprocessor access to read and modify your reference database.
-d Generate code that reduces data space size. Data structures are reused and initialized at execution time before use. This increases code size.
-e 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:
e flag syntax that is not entry-level SQL/92 syntax
i flag syntax that is not intermediate-level SQL/92 syntax
f flag syntax that is not full-SQL/92 syntax
t flag non-standard host variable types
u flag features not supported by UltraLite
w allow all supported syntax
-g Do not display warning specific to UltraLite code generation.
-h num Limits the maximum length of lines output by sqlpp to NUM characters. The continuation character is a backslash (\), and the minimum value of NUM is ten.
-k Notifies the preprocessor that the program to be compiled includes a user declaration of SQLCODE.
-m version Specify the version name for generated synchronization scripts. The generated synchronization scripts can be used in a MobiLink consolidated database for simple synchronization.
-n Generate line number information in the C file. This consists of #line directives in the appropriate places in the generated C code. If your compiler supports the #line directive, this option will make the compiler report errors on line numbers in the SQL-filename, as opposed to reporting errors on line numbers in the C/C++ output file. Also, the #line directives will indirectly be used by the source-level debugger so that you can debug while viewing the SQL-filename.
-o Specify the target operating system. Note that this option must match the operating system where you will run the program. A reference to a special symbol will be 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 will be detected by the linker. The supported operating systems are:
WIN32 Microsoft Windows 95/98/Me and Windows CE
WINNT Microsoft Windows NT/2000/XP
NETWARE Novell NetWare
UNIX UNIX
-p project-name Identifies the UltraLite project to which the embedded SQL files belong. Applies only when processing files that are part of an UltraLite application.
-q Operate quietly. Do not print the banner.
-s string-len Set the maximum size string that the preprocessor will put into the C file. Strings longer than this value will be 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.
-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:
e flag syntax that is not entry-level SQL/92 syntax
i flag syntax that is not intermediate-level SQL/92 syntax
f flag syntax that is not full-SQL/92 syntax
t flag non-standard host variable types
u flag features not supported by UltraLite
w allow all supported syntax
-x Change multi-byte strings to escape sequences so that they can pass through compilers.
-z sequence This option specifies the collation sequence or filename. For a listing of recommended collation sequences, type dbinit -l at the command prompt.