INFORMIX
DataBlade Developers Kit User's Guide
Chapter 4: C Programming Guidelines
Home Contents Index Master Index New Book

DataBlade API Programming Tips

While you program your DataBlade modules using the DataBlade API, observe these guidelines:

    Informix Dynamic Server never passes a null-terminated external representation of an mi_lvarchar data type; however, the DataBlade API provides functions to convert mi_lvarchar values to and from null-terminated strings. To allocate and free memory for mi_lvarchar data types, use the mi_var accessor functions.

    Write your user-defined routine code to pass arguments using a pointer. All built-in data types are passed by reference except fixed-length, noncharacter data types of fewer than 4 bytes. The mi_real data type (the SQL data type SMALLFLOAT) is always passed by reference. Pass opaque data types by value by creating them with the passedbyvalue modifier.

    If you create a user-defined routine with the with (handlesnulls) modifier, your routine must check the input parameters to determine if they are null. To check whether arguments are null, pass the MI_FPARAM structure as the last argument in the C routine; then check the arguments by calling the mi_fp_argisnull() function.

    If you intend to return a null value from a function, you must call mi_fp_setreturnisnull() with MI_TRUE before the return statement. If you do not, you might receive an incorrect result or memory errors.

For code examples illustrating these and other DataBlade API coding tips, see the Informix Developer Network Web site, http://www.informix.com/idn.

For details on DataBlade API data types and routines, see the DataBlade API Programmer's Manual.




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