Pro*C/C++ question

From: Robert J. Rubin <rubin_at_no-spam-istation.com>
Date: Fri, 2 Jul 1999 08:45:37 -0500
Message-ID: <bn3f3.771$Bk7.4735_at_dfw-read.news.verio.net>



I am using Pro*C (on NT) with the following options:

    proc MODE=ANSI CODE=CPP PARSE=PARTIAL THREADS=YES $(InputPath)

Question first, followed by background below: Everything is working exactly as I'd like (so far). But it seems to contradict the Oracle documentation. Am I exploiting a "bug" that may fixed in a future release?

Background:
[From Pro*C/C++ Precompiler Programmer's Guide (8.1.5): Chapter 9: Handling Runtime Errors]



"If you do not declare SQLSTATE [when MODE=ANSI]:

"You must declare SQLCODE inside or outside the Declare Section. The Oracle
Server returns a status code to SQLCODE after every SQL operation.

"Declaring the SQLCA is optional. If you declare the SQLCA, Oracle returns
status codes to SQLCODE and the SQLCA. "


I don't declare SQLCODE or SQLSTATE. The generated code does not reference SQLCODE at all (nor have I declared one). That's just fine with me because I'm using threads and have already got the following C++ code in each of my functions:

struct sqlca& sqlca = *(pointer to thread specific sqlca);

The generated code for the EXEC SQL statements includes:

    sqlstm.sqlest = (unsigned char *)&sqlca;

so everthing looks fine...and it seems to works.

At one point in playing with proc, it was generating code like:

    sqlstm.sqlest = (unsigned char *)&SQLCODE; But it's not doing that now (and I can't reproduce it again). I'm glad it's not doing that because then it would not use the specific sqlca struct that I pass into the function.

Thought?

Thanks,

    -Robert

--
Robert J. Rubin
istation.com

rubin_at_no-spam.istation.com
Received on Fri Jul 02 1999 - 15:45:37 CEST

Original text of this message