Re: Problem witch OCI ofen()

From: Mike Smith <zmes40_at_hou.amoco.com>
Date: Fri, 29 Apr 1994 13:09:04 CDT
Message-ID: <1994Apr29.130904.25501_at_amoco.com>


In article <2pqnvi$mpn_at_nz12.rz.uni-karlsruhe.de>, helberg_at_lodsun1.lod.uni-karlsruhe.de (Thomas Helberg) writes:
>Hello,
>I'm trying to use the OCI functions V1.1(?) with ORACLE V6.0.36 within a C++
>program. Everything is working fine. Only with the ofen() function a problem arise.
>If I try to fetch more than 35 rows by one call - as in the sample program below-
>I get a segmentation fault or floating exception.
>
>Any ideas or hints ?
>
>#include <iostream.h>
>
>#include "database.h"
>#include "util.h"
>
>extern "C" {
> int ofetch(CursorDef*);
> int olon(CursorDef*, char*, int, char*, int, int);
> int ologof(CursorDef*);
> int odsc(CursorDef*, int, short*, short*, short*, \
> short*, char*, short*, short*);
> int oclose(CursorDef*);
> int ofen(CursorDef*, int);
> int oopen(CursorDef*, CursorDef*, char*,int, int, char*, int);
> int odefin(CursorDef*, int, int*, int, int, int, short*, char*, \
> int, int, short*, short*);
> int osql3(CursorDef*, char*, int);
> int oexec(CursorDef*);
>
>}
>extern const char* Name;
>char* Passwd;
>
>CursorDef LDA;
>
>int main()
>{
> static CursorDef cursor;
> static short ind_a[100];
> static int grp_id[100];
> short rl,rc;
> olon(&LDA,Name,-1,Passwd,-1,-1);
> oopen(&cursor,&LDA,(char*)0,-1,-1,(char*)0,-1);
> osql3(&cursor,(char*)"select gruppen_id from archiv_site where sitename_p =1",\
> -1);
> odefin(&cursor,1,(int*)grp_id,sizeof(int),3,-1,ind_a,(char*)0,-1,-1,&rl,&rc); oexec(&cursor);
> ofen(&cursor,100);
> for ( int i=0; i<100 ; i++)
> cout << grp_id[i] << " " ;
> cout << endl << flush;
> .....
>
>Thanks in advance
>
>Thomas

The problem is in the odefin call, the rl and rc parameters need to be arrays of size 100 since your ofen call is retrieving upto 100 rows. Received on Fri Apr 29 1994 - 20:09:04 CEST

Original text of this message