Re-try: Passing host arrays to subroutines: Pro*C
From: Denis M. Goddard <d.m.goddard_at_cummins.com>
Date: 1997/01/08
Message-ID: <32D337D9.42E0_at_cummins.com>#1/1
Date: 1997/01/08
Message-ID: <32D337D9.42E0_at_cummins.com>#1/1
OOpps, the bottom of my post got cut.
Here's the whole story (I hope):
What I want to do is:
common_oracle_functions.h:
/* --- function prototype --- */
/* function populates fetched_rows host array */
/* and returns sqlca.sqlerrd[2] */
int Fetch_Data ( char *arg1, ... /* modify selection logic, etc. */ VARCHAR *fetched_rows /* ???? populate this */ );
===
specific_application_program.c:
/* Declare Host Array */
EXEC SQL BEGIN DECLARE SECTION;
VARCHAR DB_Rows [ 50 ] [ 256 ]; /* at most 50 VARCHAR values */
EXEC SQL END DECLARE SECTION;
[Quoted] num_rows = Fetch_Data ( "Foo",
&DB_Rows /* ??? is this close to correct ??? */ );
for (i=0;i<num_rows;i++) {
printf ("%s\n", DB_Rows[i].arr );
}
Received on Wed Jan 08 1997 - 00:00:00 CET