开发者

Using a NULL pointer with OCIAQDeq()

开发者 https://www.devze.com 2023-03-08 03:55 出处:网络
In the documentation for OCIAQDeq() it states: The application may choose to pass NULL for payload the first time

In the documentation for OCIAQDeq() it states:

The application may choose to pass NULL for payload the first time OCIAQDeq() is called, and let the OCI alloc开发者_运维技巧ate the memory for the payload. It can then use a pointer to that previously allocated memory in subsequent calls to OCIAQDeq().

Does anyone have an example of how to use this feature? If I pass in NULL, where do I subsequently get the pointer from? Thanks!


This piece of the documentation refers to the payload parameter of the function which is a double pointer: dvoid ** according to the following

  • http://files.edin.dk/php/win32/dev/php_build/include/oci805/OCIAP.H

Since it's a double pointer the allocated buffer will be passed back to the caller via the parameter passed in. For example

dvoid* pBuffer = NULL;
OCIAQDec(..., &pBuffer, ...);

Because NULL is passed the function will allocate a buffer and store it into the pBuffer value which can be later re-used

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号