Re: [Orclib-users] How to pass OCILIB connection to a function in C
Open source C and C++ library for accessing Oracle Databases
Brought to you by:
vince_del_paris
|
From: <mod...@co...> - 2012-04-10 16:16:55
|
Nevermind... I got it working by declaring
OCI_Connection *cn;
OCI_Statement *st;
in the header file. Then I declared in the main() file as global variables:
OCI_Connection *cn = NULL; /* file scope, external linkage */
OCI_Statement *st = NULL; /* file scope, external linkage */
The OCILIB connection is now seen by all functions and all files used by the program.
----- Original Message -----
From: mod...@co...
To: "vincent rogier" <vin...@ya...>
Cc: orc...@li...
Sent: Tuesday, April 10, 2012 8:04:29 AM
Subject: [Orclib-users] How to pass OCILIB connection to a function in C?
Hello, If I'm using OCILIB in the main function, such as:
int main (void)
{
OCI_Connection *cn;
OCI_Statement *st;
...
OCI_Initialize(NULL, NULL, OCI_ENV_DEFAULT);
OCI_EnableWarnings(TRUE);
cn = OCI_ConnectionCreate(...);
st = OCI_StatementCreate(cn);
...
my_function(...);
}
When I create a new function, my_function, how do I pass the existing OCILIB connection into my_function for use? I want to avoid opening a new connection in my_function if it is not necessary.
For example, I'd like to pass *cn and *st above into my_function.
------------------------------------------------------------------------------
Better than sec? Nothing is better than sec when it comes to
monitoring Big Data applications. Try Boundary one-second
resolution app monitoring today. Free.
http://p.sf.net/sfu/Boundary-dev2dev
_______________________________________________
Orclib-users mailing list
Orc...@li...
https://lists.sourceforge.net/lists/listinfo/orclib-users
|