I want help on the sequence of calls after SQLDBC_ResultSet_bindColumn to retrieve the data from the bound columns.
I am working with the HOTEL.CITY table which has 3 columns: Below is main section of my code. When I use the SQLDBC_ResultSet_getObject function inside the while loop everything works fine and i get the result of seeing all the columns on my screen. But this works even without doing the SQLDBC_ResultSet_bindColumn.
So, my question is after we do the bind, what sequence of call am i supposed to do next to achieve the same result. I assume we don't have to call "SQLDBC_ResultSet_getObject" as before.
Kindly Help......
char *stmtstr = "SELECT ZIP,NAME,STATE from HOTEL.CITY";
rc = SQLDBC_PreparedStatement_prepare(stmt, stmtstr, strlen(stmtstr),encodAsciiType );
rc = SQLDBC_PreparedStatement_executeASCII(stmt);
SQLDBC_ResultSet *result;
result = SQLDBC_PreparedStatement_getResultSet(stmt);
char szString[30];
SQLDBC_Length ind;
char szString2[40];
SQLDBC_Length ind2;
char szString3[30];
SQLDBC_Length ind3;
SQLDBC_HostType htype = SQLDBC_HOSTTYPE_ASCII;
SQLDBC_ResultSet_bindColumn(result, 1, htype, szString, &ind, sizeof(szString), SQLDBC_TRUE);
SQLDBC_ResultSet_bindColumn(result, 2, htype, szString2, &ind2, sizeof(szString2), SQLDBC_TRUE);
SQLDBC_ResultSet_bindColumn(result, 3, htype, szString3, &ind3, sizeof(szString3), SQLDBC_TRUE);
int RowNum = 1;
while ( (rc = SQLDBC_ResultSet_next(result)) == SQLDBC_OK) {
rc = SQLDBC_ResultSet_getObject(result, 1, SQLDBC_HOSTTYPE_ASCII, szString,&ind, sizeof(szString),SQLDBC_TRUE);
printf("%s\n", szString);
rc = SQLDBC_ResultSet_getObject(result, 2, SQLDBC_HOSTTYPE_ASCII, szString2,&ind2, sizeof(szString2),SQLDBC_TRUE);
printf("%s\n", szString2);
rc = SQLDBC_ResultSet_getObject(result, 3, SQLDBC_HOSTTYPE_ASCII, szString3,&ind3, sizeof(szString3),SQLDBC_TRUE);
printf("%s\n", szString3);
}
Regards
Raja