01-13-2003 04:06 PM
01-14-2003 10:28 AM
12-09-2006 10:05 PM
Hi,
I am new to CVI and SQL Toolkit. My background is Database programming.
I am working on this project where I am helping our CVI development team to use a Oracle Procedure that returns a "stream" of ASCII text as the output value. The output value can be from 2000 to 3000 characters long (will contain newline \n characters as well)
My problem is: The CVI SQL toolkit code is unable to read the output param...
We are using DBGetParamChar to read the output params.
The code uses DBPrepaerSQL and DBExecutePreparedSQL and finally DBClosePreparedSQL - before reading the output params.
The code goes as follows:
resCode = DBSetAttributeDefault(hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
hstmt = DBPrepareSQL (hdbc, "GETSTRING");
resCode = DBSetAttributeDefault(hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_UNKNOWN);
resCode = DBCreateParamChar(hstmt, "strInput1", DB_PARAM_INPUT, "", 100);
resCode = DBCreateParamChar(hstmt, "strInput2", DB_PARAM_INPUT, "", 100);
resCode = DBCreateParamChar(hstmt, "strReturn", DB_PARAM_OUTPUT, "", 4000);
resCode = DBExecutePreparedSQL(hstmt);
resCode = DBClosePreparedSQL(hstmt);
//Reading output params
resCode = DBGetParamCharBuffer(hstmt, 2, &strReturn, 4000, "");
>>>>Here I get a -2 as the resCode and the value in the strReturn is NULL..I am using everything the CVI manual says, but does not seem to work. Something is missing in myside or the manuals are wrong...
The procedure takes 2 input param and 1 output param. Logging in the procedure shows that the CVI SQL Toolkit's code is making a call the procedure and passing the params and the database is returning the output - (per my logging within the Proc.) The procedure does not error out per the Error handler logs. I have a test code to test the proc via a Web Page and the output is produced.
Any help will be highly appreciated.
Thanks,
Raj
12-11-2006 12:39 PM
Guys Please help us solve this problem...
Oracle Procedure that returns a "stream" of ASCII text as the output value. The output value can be from 2000 to 3000 characters long (will contain newline \n characters as well)
My problem is: The CVI SQL toolkit code is unable to read the output param...
We are using DBGetParamChar to read the output params.
The code uses DBPrepaerSQL and DBExecutePreparedSQL and finally DBClosePreparedSQL - before reading the output params.
The code goes as follows:
resCode = DBSetAttributeDefault(hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_STORED_PROC);
hstmt = DBPrepareSQL (hdbc, "GETSTRING");
resCode = DBSetAttributeDefault(hdbc, ATTR_DB_COMMAND_TYPE, DB_COMMAND_UNKNOWN);
resCode = DBCreateParamChar(hstmt, "strInput1", DB_PARAM_INPUT, "", 100);
resCode = DBCreateParamChar(hstmt, "strInput2", DB_PARAM_INPUT, "", 100);
resCode = DBCreateParamChar(hstmt, "strReturn", DB_PARAM_OUTPUT, "", 4000);
resCode = DBExecutePreparedSQL(hstmt);
resCode = DBClosePreparedSQL(hstmt);
//Reading output params
resCode = DBGetParamCharBuffer(hstmt, 2, &strReturn, 4000, "");
>>>>Here I get a -2 as the resCode and the value in the strReturn is NULL..I am using everything the CVI manual says, but does not seem to work. Something is missing in myside or the manuals are wrong...
The procedure takes 2 input param and 1 output param. Logging in the procedure shows that the CVI SQL Toolkit's code is making a call the procedure and passing the params and the database is returning the output - (per my logging within the Proc.) The procedure does not error out per the Error handler logs. I have a test code to test the proc via a Web Page and the output is produced.
Any help will be highly appreciated.
Thanks,
12-11-2006 07:02 PM
12-12-2006 08:42 AM
Howdy skykeeper,
I had one thought that might relate to your problem. The DBGetParamCharBuffer function takes in a char[] data type and so I believe your last statement should go without the &. For example, I think it should say:
ResCode = DBGetParamCharBuffer(hstmt, 2, strReturn, 4000, "");
Hope this helps!
Best Regards,
12-12-2006 09:39 AM