INFORMIX
DataBlade Developers Kit User's Guide
Chapter 3: Using BladeSmith
Home Contents Index Master Index New Book

Generating Files

When you generate files, BladeSmith creates files that describe the objects you defined in your project. The files include:

Generate SQL files, source files, functional test files, and installation files at any time. See "Regenerating Files" for more information on when to regenerate. If you change any of the output directories, regenerate all files.

To generate files or change the properties of generated files, choose Generate DataBlade to display the Generate DataBlade dialog box (Figure 3-2).

Figure 3-2
Generate DataBlade Dialog Box

The Generate DataBlade dialog box contains a file tree that shows categories of generated files. Each category is represented by a folder in this dialog box. When you click a folder, the Generate button changes to reflect the name of the category.

The directory structure of the generated files is illustrated by Figure 3-3.

Figure 3-3
Generated File Directory Structure

Programming language subdirectories are created during generation only if you have defined objects in those languages.

Setting Generated File Properties

Most categories of generated files have properties that you can change. The properties appear in the Generate DataBlade dialog box Properties grid when you select a category in the file tree.

The following table lists the properties of the generated file categories, their default values, categories to which they belong, and a brief description of each.
Property Default Value Category Description

Format

DOS

Generate DataBlade

The format of the generated files:

Directory

install

src

scripts

functest

Packaging

Source

SQL

Tests

The name of the directory that receives the generated files from each category. The path is relative to the directory that contains the project file.

Logging

False

Source

Whether to generate logging information.

Merge

True

Source

Whether to merge custom changes from previous source code files into the new files, or to overwrite existing files.

Tracing

False

Source

Whether to add tracing to your generated source code.

See "Tracing and Error Handling" for more information.

MMX

False

C

Whether to allow Intel MMX media enhancement technology in your DataBlade module.

If you change the value to True, BladeSmith generates the Gen_IsMMXMachine function to check for an Intel MMX processor. See "The Gen_IsMMXMachine() Utility Function" for more information.

To change a property of a generated file category

    1. Click the folder of the category whose properties you want to change.

    2. Click the name of the property whose value you want to edit in the Property column of the Properties grid.

    3. Edit the value by typing a new value or selecting a new value from the popup list in the Value column.

    4. Click Apply.

Generating All Files

The top-level folder in the Generate DataBlade dialog box file tree is Generate DataBlade (see Figure 3-2).

To generate all the files for your DataBlade module

    1. In the Generate DataBlade dialog box, click the Generate DataBlade folder in the file tree.

    2. Edit the properties of the generated file categories, if necessary. See "Setting Generated File Properties" for instructions.

    3. Click Generate DataBlade.

The property associated with the Generate DataBlade folder is Format. You use the Format property to specify how text lines end in the generated files:

The default value for the Format property is DOS.

Generating SQL Scripts

To generate only the SQL scripts, click the SQL folder in the Generate DataBlade file tree, then click Generate Scripts.

The property associated with the SQL folder is Directory. The default directory is scripts. You can change the name of the directory the SQL scripts are saved in, but the path must be relative to the project directory.

The following table describes the generated SQL scripts.

SQL Script Purpose

prepare.sql

Contains SQL statements that describe the DataBlade module to BladeManager.

objects.sql

Contains SQL statements that update the sysbldobjects system table with information about the DataBlade module objects that are created in a database. BladeManager uses the information in the table to register, unregister, and upgrade DataBlade modules.

BladeSmith generates separate files for locale-specific objects such as error messages. For example, the files for the default U.S. English locale are prepare.en_us.sql and errors.en_us.1252.

Important: Only one error message file is necessary per language. The database server automatically translates between languages. For example, the errors.en_us.1252 file is sufficient for all en_us encodings; you do not need additional encodings like error.en_us.8859-1.
You can add SQL statements to the generated SQL scripts by adding an SQL file object to your project. See "Adding SQL Files" for more information about adding SQL statements to a DataBlade module.

Warning: Do not edit generated SQL scripts. Use BladeSmith to make changes; then regenerate the scripts.

Generating Source Files

To generate only the source files for objects defined in your project, click the Source folder or one of its subordinate folders in the Generate DataBlade dialog box file tree (see Figure 3-2); then click Generate Source. The following table lists the source code file generation options.
Click This Folder To Generate This Code

Source

All source code in the coding languages you use for your DataBlade module objects

Client

Client code. (ActiveX only)

Server

Server code in the coding languages you specified when you create objects in BladeSmith

Individual language:
ActiveX, C++, C, or SPL

Source code only for the selected language

The Source folder has these properties:

The property associated with the C folder under the Server folder is MMX. The default value is False. You can choose whether to allow Intel MMX media enhancement technology in your DataBlade module. To generate the Gen_IsMMXMachine function to check for an Intel MMX processor, specify True. See "The Gen_IsMMXMachine() Utility Function" for more information.

BladeSmith writes a header file, source files, and makefiles for Windows NT and UNIX platforms. It also generates other necessary files, depending on the coding language. For information on the source files BladeSmith generates, see "Source Files Generated by BladeSmith" and Appendix A, "Source Files Generated for C DataBlade Modules."

After you generate source files, edit the source files to add your code to the routine declarations BladeSmith generated. For a description of the contents of the generated files and how to modify and compile the generated code, see Chapter 5, "Programming DataBlade Module Routines in C," and Chapter 6, "Creating ActiveX Value Objects."

Generating Test Files

To generate only the functional test files, click the Tests folder in the Generate DataBlade dialog box file tree (see Figure 3-2); then click Generate Tests.

The property associated with the Tests folder is Directory. The default directory is functest. You can change the name of the directory the test files are saved in, but the path must be relative to the project directory.

When you generate test files, BladeSmith creates a set of files to test the opaque data types, casts, and user-defined routines defined in the DataBlade module. BladeSmith creates these subdirectories under the functest directory:

Use the SQL scripts and shell scripts to test the objects you have created.

See Chapter 8, "Testing and Debugging DataBlade Modules on UNIX," for information about executing functional tests.

Generating Installation Package Files

To generate only the installation packaging files that BladePack uses to build installation packages, click the Packaging folder in the Generate DataBlade dialog box file tree (see Figure 3-2); then click Generate Packaging.

The property associated with the Packaging folder is Directory. The default directory is install. You can change the name of the directory where the installation files are saved, but the path must be relative to the project directory.

When you generate installation package files, BladeSmith creates a set of files that you use with BladePack to generate installation scripts for your DataBlade module:

Important: Do not edit the generated installation package files. Instead, use BladeSmith to regenerate the installation package files after you have added or removed DataBlade module objects in the project file. For details about adding files to your installation package and generating installation packages, see Chapter 10, "Using BladePack."

Regenerating Files

After you make changes in a BladeSmith project, be sure to regenerate files. For example, if you add a cast to a DataBlade module, you must regenerate SQL scripts. If the cast has a support routine, you must also regenerate source files. The folders in the generated file category tree on the Generate DataBlade dialog box are displayed with an asterisk when they need to be generated.

When BladeSmith finds existing files, it copies them to backup files before regenerating them. If the Merge property of the Source folder in the Generate DataBlade dialog box is True, BladeSmith copies the changes you made to your source files into the newly generated source files. In this way, you can update your objects in BladeSmith without losing the routine code you added.

If the Merge property of the Source folder in the Generate DataBlade dialog box is False, BladeSmith does not merge your previous changes into the new source files, but existing files are backed up. You can copy changes from the backup files into the newly generated files using a text editor.

If BladeSmith encounters problems while generating files, it displays the Generate Code Problem dialog box. For help in resolving merging problems, click Help on this dialog box and read the on-line help.

BladeSmith does not merge changes to SQL files, test files, or installation files. SQL files and test files are regenerated, replacing the previous files. When you regenerate installation files, BladeSmith deletes relevant entries in the bill of materials file and adds them again. If you use BladePack to add files to the package, regenerating installation files does not affect your additions.




DataBlade Developers Kit User's Guide, version 3.6
Copyright © 1998, Informix Software, Inc. All rights reserved.