solidDB Help : Programming : solidDB ODBC API : Calling functions
  
Calling functions
This topic provides information about how programs call functions in the ODBC driver.
Header files and function prototypes
If your program calls functions in the ODBC driver, your program must include the ODBC header files. These files define the ODBC functions, and the data types and constants that are used with ODBC functions. The header files are not solidDB-specific; they are standard header files provided by Microsoft. The solidDB ODBC driver (like any ODBC driver) implements the functions that are specified in these header files.
ASCII and Unicode
ODBC drivers come in two types: ASCII and Unicode. The ASCII driver supports only ASCII character sets. The Unicode driver supports both the Unicode and the ASCII character sets.
For details on driver, API, and SQL conformance levels, see "Introduction to ODBC" in the Microsoft ODBC Programmer's Reference.
Using the ODBC driver manager
An application might link directly to the solidDB ODBC driver, or the application might link to an ODBC driver manager.
On Windows systems, the driver manager is required if applications that connect to the solidDB server use OLE DB or ADO APIs, or you use database tools that require the driver manager, such as Microsoft Access, FoxPro, or Crystal Reports. In most other cases, you can link to the ODBC driver directly, instead of linking to the driver manager.
On Windows systems, Microsoft supplies the driver manager, and you link to the driver manager import library (ODBC32.LIB) to gain access to the driver manager.
On other platforms, you can link to the driver manager of another vendor. For example, on Linux systems, you can use unixODBC, see Using unixODBC driver manager.
For basic application steps that occur whenever an application calls an ODBC function and details on calling ODBC functions, see "Introduction to ODBC" in the Microsoft ODBC Programmer Reference.
Data types
For information about SQL data types that are supported by the solidDB server, see ODBC: Data types.
The header files from Microsoft provide information about C‑language data types that are used by your client program. To transfer data between the application program and the database server, you must use appropriate types. For example, on most 32-bit platforms, the C-language "int" data type corresponds to the SQL data type "INT". The C-language "float" data type corresponds to the SQL "REAL" data type.
Scalar functions
Scalar functions return a value for each row. For example, the absolute value scalar function takes a numeric column as an argument and returns the absolute value of each value in the column. Scalar functions are invoked with the following ODBC escape sequence:
{fn scalar-function}
Note The starting and ending characters are the curly bracket characters, not parentheses.
For a list of scalar functions and a more complete example of their usage, see ODBC: Scalar functions.
solidDB native scalar functions
The solidDB server provides the following native scalar functions, which cannot be invoked by using the ODBC escape sequence.
CURRENT_CATALOG() - returns a WVARCHAR string that contains the current active catalog name. This name is the same as ODBC scalar function {fn DATABASE()}.
LOGIN_CATALOG() - returns a WVARCHAR string that contains the login catalog for the connected user (currently, the login catalog is the same as the system catalog).
CURRENT_SCHEMA() - returns a WVARCHAR string that contains the current active schema name.
Function return codes
When an application calls a function, the driver executes the function and returns a predefined code. These return codes indicate success, warning, or failure status. The return codes are:
SQL_SUCCESS
SQL_SUCCESS_WITH_INFO
SQL_NO_DATA_FOUND
SQL_ERROR
SQL_INVALID_HANDLE
SQL_STILL_EXECUTING
SQL_NEED_DATA
If the function returns SQL_SUCCESS_WITH_INFO or SQL_ERROR, the application can call SQLError to retrieve additional information about the error.
Go up to
solidDB ODBC API