Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

SQLCA structure [Table of Contents] SQLSTATE structure

Open Client Client-Library/C Reference Manual

[-] Chapter 2 Topics
[-] Client-Library and SQL Structures
[-] SQLCODE structure

SQLCODE structure

A SQLCODE structure is used in conjunction with ct_diag to retrieve Client-Library and server error and informational message codes.

An application must declare a SQLCODE structure as a long integer.

Client-Library always sets SQLCODE and the sqlcode field of the SQLCA structure identically.

Mapping server messages to SQLCODE

A server message number is mapped to a SQLCODE of 0 if it has a severity of 0.

Other server messages may also be mapped to a SQLCODE of 0.

Server message numbers are inverted before being placed into SQLCODE. This ensures that SQLCODE is negative if an error has occurred.

For a list of server messages, execute the Transact-SQL statement:

select * from sysmessages

Mapping Client-Library messages to SQLCODE

The Client-Library message "No rows affected" is mapped to a SQLCODE of 100.

Client-Library messages with CS_SV_INFORM severities are mapped to a SQLCODE of 0.

Other Client-Library messages may also be mapped to a SQLCODE of 0.

Client-Library message numbers are inverted before being placed into SQLCODE. This ensures that SQLCODE is negative if an error has occurred.

See "Client-Library message numbers".


SQLCA structure [Table of Contents] SQLSTATE structure