Variables that are used for binding must exist and be accessible when
OCI_Execute() is called.
In your example, n and n2 are local variable of method binda(). Thus, when
binda() return they do not exists and the program crashes as it attempts to
access non reachable memory.
When using internal allocation mode, you must pass null pointers to bind
functions.
Thus:
- when using external allocation mode (default), provide valid addresses
for the life time of a prepared statement (until it is freed or until it is
re-prepared)
- when using internal allocation mode, pass null pointers.
btw, OCILIB has moved to Github. Please use the Github tracker instead of
SF resources.
Variables that are used for binding must exist and be accessible when OCI_Execute() is called.
In your example, n and n2 are local variable of method binda(). Thus, when binda() return they do not exists and the program crashes as it attempts to access non reachable memory.
When using internal allocation mode, you must pass null pointers to bind functions.
Thus:
- when using external allocation mode (default), provide valid addresses for the life time of a prepared statement (until it is freed or until it is re-prepared)
- when using internal allocation mode, pass null pointers.
btw, OCILIB has moved to Github. Please use the Github tracker instead of SF resources.
thanks :)
Regards,
vincent
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
HI,
I am trying to bind some variable to the statement and this is my sample
coede below:
void binda( OCI_Statement st)
{
{
int n = 0,n2 =1;
OCI_BindInt(st,"res",&n);
OCI_BindInt(st,"p1",&n2);
}
}
int main(void)
{
OCI_Connection cn;
OCI_Statement st;
OCI_Resultset rs;
|OCI_ENV_CONTEXT))
return EXIT_FAILURE;
calling this function*/
after calling this function*/
}
please help me how to bind variable not on the stack.
Thanks
Hi,
Variables that are used for binding must exist and be accessible when
OCI_Execute() is called.
In your example, n and n2 are local variable of method binda(). Thus, when
binda() return they do not exists and the program crashes as it attempts to
access non reachable memory.
When using internal allocation mode, you must pass null pointers to bind
functions.
Thus:
- when using external allocation mode (default), provide valid addresses
for the life time of a prepared statement (until it is freed or until it is
re-prepared)
- when using internal allocation mode, pass null pointers.
btw, OCILIB has moved to Github. Please use the Github tracker instead of
SF resources.
thanks :)
Regards,
On Sun, Aug 23, 2015 at 3:46 PM, mch m-ch@users.sf.net wrote:
--
Vincent Rogier
Hi,
Variables that are used for binding must exist and be accessible when OCI_Execute() is called.
In your example, n and n2 are local variable of method binda(). Thus, when binda() return they do not exists and the program crashes as it attempts to access non reachable memory.
When using internal allocation mode, you must pass null pointers to bind functions.
Thus:
- when using external allocation mode (default), provide valid addresses for the life time of a prepared statement (until it is freed or until it is re-prepared)
- when using internal allocation mode, pass null pointers.
btw, OCILIB has moved to Github. Please use the Github tracker instead of SF resources.
thanks :)
Regards,
vincent