Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.0 » UltraLite - C and C++ Programming » Application Development » Developing applications using Embedded SQL » Building embedded SQL applications


Configuring development tools for embedded SQL development

Many development tools use a dependency model, sometimes expressed as a makefile, in which the timestamp on each source file is compared with that on the target file (object file, in most cases) to decide whether the target file needs to be regenerated.

With UltraLite development, a change to any SQL statement in a development project means that the generated code needs to be regenerated. Changes are not reflected in the timestamp on any individual source file because the SQL statements are stored in the reference database.

This section describes how to incorporate UltraLite application development, specifically the SQL preprocessor, into a dependency-based build environment. The specific instructions provided are for Visual C++, and you may need to modify them for your own development tool.

The UltraLite plug-in for CodeWarrior automatically provides Palm Computing Platform developers with the techniques described here. For more information about this plug-in, see Developing UltraLite applications with CodeWarrior.

SQL preprocessing

The first set of instructions describes how to add instructions to run the SQL preprocessor to your development tool.

To add embedded SQL preprocessing into a dependency-based development tool

  1. Add the .sqc files to your development project.

    The development project is defined in your development tool.

  2. Add a custom build rule for each .sqc file.

    • The custom build rule should run the SQL preprocessor. In Visual C++, the build rule should have the following command (entered on a single line):
      "%SQLANY11%\Bin32\sqlpp.exe" -q -u $(InputPath) $(InputName).cpp

      where SQLANY11 is an environment variable that points to your SQL Anywhere installation directory.

      For a full description of the SQL preprocessor command line, see SQL Preprocessor for UltraLite utility (sqlpp).

    • Set the output for the command to $(InputName).cpp.
  3. Compile the .sqc files, and add the generated .cpp files to your development project.

    You need to add the generated files to your project even though they are not source files, so that you can set up dependencies and build options.

  4. For each generated .cpp file, set the preprocessor definitions.

    • Under General or Preprocessor, add UL_USE_DLL to the Preprocessor definitions.
    • Under Preprocessor, add $(SQLANY11)\SDK\Include and any other include folders you require to your include path, as a comma-separated list.