Re: C++ OCI calls

From: Ted A McFadden <madmax_at_world.std.com>
Date: Thu, 13 Oct 1994 13:51:02 GMT
Message-ID: <CxM6H2.7C_at_world.std.com>


dataware_at_world.std.com (Dataware Solutions) writes:

>I'm trying to convert a few PRO*C programs to C++ using OCI what is
>the best way to call the OCI functions? Can they be embedded right
>in the C++ code or do they have to be in a C compiled module? ...

We wrapped the OCI functions in C++ classes. Just remember to put an:
 extern "C" {
}
 around the ORACLE OCI declarations.

The c++ classes declarations looked something like:

class OracleLogOn {
...
};

class OracleCursor {
public:
 OracleCursor();
 ~OracleCursor();
 int Open(OracleLogon *connectLogOn,char *userID=NULL);  int Cancel();

 int Close();
 int Fetch(WORD numberOfRows=1);
 int Parse(const char *strmt,unsigned int delayParse,..
 ...
private:
 OracleLogon *fConnection;	// cursor's logon
 Cda_Def fCursorDataArea;	// oracle defined cursor
 ...
};

and the implementations (simple wrappers)...

int OracleCursor::Fetch(WORD numberOfRows){

        return oefn(&fCursorDataArea,numberOfRows); }

This has worked well for us.

Ted McFadden
CSTI Inc.
madmax_at_world.std.com Received on Thu Oct 13 1994 - 14:51:02 CET

Original text of this message