Home » Developer & Programmer » Precompilers, OCI & OCCI » How to view SQLCODE value in Debuggin' Time (Pro*C/C++: Release 10.2.0.4.0)
How to view SQLCODE value in Debuggin' Time [message #446827] Wed, 10 March 2010 11:08
donato
Messages: 53
Registered: November 2007
Location: Barcelona, Spain
Member
Hi again people,

I'm using:
=> HP-UX B.11.31 U 9000/800 (tc).
=> Pro*C/C++: Release 10.2.0.4.0.
=> aCC: HP ANSI C++ B3910B A.03.85.
=> (WDB debugger) HP gdb 5.9 for PA-RISC 1.1 or 2.0 (narrow), HP-UX 11.00 and target hppa1.1-hp-hpux11.00. Copyright 1986 - 2001 Free Software Foundation, Inc. Hewlett-Packard Wildebeest 5.9 (based on GDB) is covered by the
GNU General Public License.

There is my simple program:
#include <sqlca.h>
#define SQLCODE		sqlca.sqlcode

int main(int argc, char **argv)
{
	EXEC SQL BEGIN DECLARE SECTION;
		char my_query[1000];
		char my_database[10];
		char my_ref[10];
		char my_user[10];
		char my_pass[10];
		long my_result;
	EXEC SQL END   DECLARE SECTION;

	strcpy(my_database, "TESTDB");
	strcpy(my_ref, "TESTDB");
	strcpy(my_user, "SCOTT");
	strcpy(my_pass, "TIGER");
	my_result = 999;

	EXEC SQL CONNECT :my_user IDENTIFIED BY :my_pass AT :my_ref USING :my_database;	
	printf("[TEST] CONNECT returns SQLCODE '%d'\n", SQLCODE);
	
	sprintf(my_query, "SELECT 1234 FROM DUAL");
	printf("[TEST] Query is '%s'\n", my_query);
	
	EXEC SQL AT :my_database PREPARE my_cursor_id from :my_query;
	printf("[TEST] PREPARE returns SQLCODE '%d'\n", SQLCODE);

	EXEC SQL AT :my_database DECLARE my_cursor CURSOR FOR my_cursor_id ;
	printf("[TEST] DECLARE returns SQLCODE '%d'\n", SQLCODE);

	EXEC SQL AT :my_database OPEN my_cursor; // USING :my_filter;
	printf("[TEST] OPEN    returns SQLCODE '%d'\n", SQLCODE);

	EXEC SQL AT :my_database FETCH my_cursor INTO :my_result; // INDICATOR :my_indicator;
	printf("[TEST] FETCH   returns SQLCODE '%d'\n", SQLCODE);
	
	printf("[TEST] FETCH   returns RESULT  '%d'\n", my_result);
	
	EXEC SQL AT :my_database close my_cursor;
	printf("[TEST] CLOSE   returns SQLCODE '%d'\n", SQLCODE);

	printf("[TEST] Done.\n", my_query);
	return 0;
}


Wich returns:
[TEST] CONNECT returns SQLCODE '0'
[TEST] Query is 'SELECT 1234 FROM DUAL'
[TEST] PREPARE returns SQLCODE '0'
[TEST] DECLARE returns SQLCODE '0'
[TEST] OPEN    returns SQLCODE '0'
[TEST] FETCH   returns SQLCODE '0'
[TEST] FETCH   returns RESULT  '1234'
[TEST] CLOSE   returns SQLCODE '0'
[TEST] Done.

Well, i can see SQLCODE values using printf() function (execution time).
But when i use WDB debugger, and i try to 'Watch' SQLCODE values, it says "No symbol SQLCODE in current context". Neither with "sqlca.sqlcode".

Any suggestion, please?

Thanks a lot!
Previous Topic: Variable Declarations in the DECLARE SECTION;
Next Topic: Calling Stored Procedure from a C program
Goto Forum:
  


Current Time: Thu Sep 29 09:02:09 CDT 2016

Total time taken to generate the page: 0.10169 seconds