Informix-ESQL/C Programmer's Manual
Chapter 11: Exception Handling
Home
Contents
Index
Master Index
New Book
In This Chapter
Proper database management requires that you know whether the database server successfully processes your SQL
statements as you intend. If a query fails and you do not know it, you might display meaningless data to the user. A more serious consequence might be that you update a customer account to show a payment of $100, and the update fails without your knowledge. The account is now incorrect.
To handle such error situations, your ESQL/C program must check that every SQL statement executes as you intend. This chapter discusses the following exception-handling topics:
How to interpret the diagnostic information that the database server presents after it executes an SQL statement
How to use the
SQLSTATE
variable and the
GET DIAGNOSTICS
statement to check for runtime errors and warnings that your ESQL/C program might generate
How to use the
SQLCODE
variable and the SQL Communications Area (
sqlca
) to check for runtime errors and warnings that your ESQL/C program might generate
How to choose an exception-handling strategy that consistently handles errors and warnings in your ESQL/C programs
How to use the
rgetlmsg()
and
rgetmsg()
library functions to retrieve the message text that is associated with a given Informix error number
The end of this chapter presents an annotated example program that is called
getdiag
. The
getdiag
sample program demonstrates how to handle exceptions with the
SQLSTATE
variable and the
GET DIAGNOSTICS
statement.
Informix-ESQL/C Programmer's Manual
, version 9.1
Copyright © 1998, Informix Software, Inc. All rights reserved.