Hi all,
We are using MySQL 4.0.21 with MyODBC connectivity. We are getting a crash when attempting to perform batch fetch using SQLFetchScroll() funciton. Since the function is a generic one for which we have defined a global variable (a two dimentional void* array to hold the field values for multiple rows as void *ResultSet[MAX_FIELDS][MAX_ROWS]) and binding the columns to the result set array by allocating enough memory and typecasting to the coresponding type. Then we execute the statement and tries to retrieves values using fetchscroll funciton.We are getting a crash here. We have tried even without using the void pointer and using the appropriate data type array instead. Still we observed the crash. Can anyobody help us in identifying the root cause. The source code is attached below. Regards, Narasimha int ExecuteBatchFetchStatement(char *sqlStmt, int iViewIndex,int dbConnectionID,int numRows) { tupleFldDesc_t *tupleFldDesc; SQLHSTMT hstmt; SQLRETURN retcode; SQLINTEGER intArr1[100],intArr2[100]; SQLCHAR charArr[100][21]; int iCount,NumberOfRows,dataTypeSize; //, size; void *fieldType=NULL; SQLSMALLINT datType; NumberOfRows = 100; retcode = SQLAllocHandle(SQL_HANDLE_STMT, hdbcArray[dbConnectionID], &hstmt); if (!(retcode == SQL_SUCCESS || retcode == SQL_SUCCESS_WITH_INFO)) return FALSE; SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_BIND_TYPE, SQL_BIND_BY_COLUMN, 0); SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_ARRAY_SIZE, &NumberOfRows, 0); SQLSetStmtAttr(hstmt, SQL_ATTR_ROW_STATUS_PTR, rowStatusArray, 0); SQLSetStmtAttr(hstmt, SQL_ATTR_ROWS_FETCHED_PTR, &numRowsFetched, 0); SQLBindCol(hstmt, 1, SQL_C_SLONG,&intArr1,0, fieldSizeArray[iCount]); SQLBindCol(hstmt, 2, SQL_C_SLONG,&intArr2,0, fieldSizeArray[iCount]); SQLBindCol(hstmt, 3, SQL_C_CHAR,charArr,21, fieldSizeArray[iCount]); strcpy(sqlStmt,"SELECT a.ID, a.TYPE, a.NAME FROM COMPONENT a ORDER BY a.NAME LIMIT 1;"); retcode = SQLExecDirect(hstmt,(SQLCHAR *)sqlStmt, strlen(sqlStmt)); if (retcode == SQL_ERROR || retcode == SQL_INVALID_HANDLE || retcode == SQL_NEED_DATA || retcode == SQL_NO_DATA_FOUND) return FALSE; retcode = SQLFetchScroll(hstmt,SQL_FETCH_NEXT,0); -->Observed crash here while ((retcode = SQLFetchScroll(hstmt,SQL_FETCH_NEXT,0)) != SQL_NO_DATA) iCount++; SQLCloseCursor(hstmt); SQLFreeHandle(SQL_HANDLE_STMT, hstmt); return TRUE; } Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments.