Assigning text in an OCI String [message #163629] |
Fri, 17 March 2006 09:42 |
Herode
Messages: 12 Registered: February 2006 Location: Isère (France, 38)
|
Junior Member |
|
|
I've tried the sample code of Oracle's documentation. I had to make small changes, since the initial code does not compile... Unfortunately, the final code compiles, but does not work. The OCIString pointer points to a NULL string. Coul you tell me what I'm doing wrong ????
OCIString *vstring1 = (OCIString *)0;
char c_string[20];
sword status;
strcpy(c_string, "hello world");
ub4 lg = strlen(c_string);
/* Assign a text string to an OCIString */
status = OCIStringAssignText( m_pEnv, m_pErr, (text*) c_string, lg, &vstring1);
/* Memory for vstring1 is allocated as part of string assignment */
text* ptr = OCIStringPtr( m_pEnv, vstring1 );
After the call to OCIStringPtr, ptr == NULL.
NB : m_pEnv & m_pErr are allocated & valid
Regards,
C.
|
|
|