I have a simple program that reads data from a Database, I am using ODBC, but I want to save the data or a row in an Array. I have it saved in an SQLPOINTER col[50]. How can I return the entire array? Is it possible? NB, I do not want to print the data in the array, I simply just want the values in the Array(I have that already), and return the entire array so that who ever calls the function has the data that they queried from the Database. Can anyone offer any advise? I am sort of a newbie so please have a little patience :-) Thank you very much. The function that I have is:
SQLPOINTER ColPtrArray[50]
SQLPOINTER db_getData(SQLHSTMT handle)
{
retcode = SQLFetch(handle);
CHECK_ERROR(retcode, "SQLFetch()", handle, SQL_HANDLE_STMT);
if(retcode == SQL_SUCCESS)
{
printf("\nSQL_SUCCESS\n");
return ColPtrArray;
}
exit:
printf("JJJ");
}
Can the return work? How can the caller handle the array that is returned? When SQLFETCH is executed, the array gets populated with the values of the table. This function, i did not include. Yes, not all paths return a value. Thanks for pointing that out.