- STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
- HPROC hproc;
- RETCODE retcode;
-
- if( hstmt == SQL_NULL_HSTMT
- || pstmt->hdbc == SQL_NULL_HDBC )
- {
- return SQL_INVALID_HANDLE;
- }
-
- /* check state */
- if( pstmt->asyn_on == en_NullProc )
- {
- switch( pstmt->state )
- {
- case en_stmt_allocated:
- case en_stmt_prepared:
- return SQL_NO_DATA_FOUND;
-
- case en_stmt_needdata:
- case en_stmt_mustput:
- case en_stmt_canput:
- PUSHSQLERR ( pstmt->herr, en_S1010 );
- return SQL_ERROR;
-
- default:
- break;
- }
- }
- else if( pstmt->asyn_on != en_MoreResults )
- {
- PUSHSQLERR ( pstmt->herr, en_S1010 );
-
- return SQL_ERROR;
- }
-
- /* call driver */
- hproc = _iodbcdm_getproc( pstmt->hdbc, en_MoreResults );
-
- if( hproc == SQL_NULL_HPROC )
- {
- PUSHSQLERR ( pstmt->herr, en_IM001 );
-
- return SQL_ERROR;
- }
-
- CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_MoreResults, (pstmt->dhstmt) )
-
-#if 0
- retcode = hproc( pstmt->dhstmt );
-#endif
-
- /* state transition */
- if( pstmt->asyn_on == en_MoreResults )
- {
- switch( retcode )
- {
- case SQL_SUCCESS:
- case SQL_SUCCESS_WITH_INFO:
- case SQL_NO_DATA_FOUND:
- case SQL_ERROR:
- pstmt->asyn_on = en_NullProc;
- break;
-
- case SQL_STILL_EXECUTING:
- default:
- return retcode;
- }
- }
-
- switch( pstmt->state )
- {
- case en_stmt_allocated:
- case en_stmt_prepared:
- /* driver should return SQL_NO_DATA_FOUND */
- break;
-
- case en_stmt_executed:
- if( retcode == SQL_NO_DATA_FOUND )
- {
- if( pstmt->prep_state )
- {
- pstmt->state = en_stmt_prepared;
- }
- else
- {
- pstmt->state = en_stmt_allocated;
- }
- }
- else if( retcode == SQL_STILL_EXECUTING )
- {
- pstmt->asyn_on = en_MoreResults;
- }
- break;
-
- case en_stmt_cursoropen:
- case en_stmt_fetched:
- case en_stmt_xfetched:
- if( retcode == SQL_SUCCESS )
- {
- break;
- }
- else if( retcode == SQL_NO_DATA_FOUND )
- {
- if( pstmt->prep_state )
- {
- pstmt->state = en_stmt_prepared;
- }
- else
- {
- pstmt->state = en_stmt_allocated;
- }
- }
- else if( retcode == SQL_STILL_EXECUTING )
- {
- pstmt->asyn_on = en_MoreResults;
- }
- break;
-
- default:
- break;
- }
-
- return retcode;
+ STMT_t FAR *pstmt = (STMT_t FAR *) hstmt;
+ HPROC hproc;
+ RETCODE retcode;
+
+ if (hstmt == SQL_NULL_HSTMT
+ || pstmt->hdbc == SQL_NULL_HDBC)
+ {
+ return SQL_INVALID_HANDLE;
+ }
+
+ /* check state */
+ if (pstmt->asyn_on == en_NullProc)
+ {
+ switch (pstmt->state)
+ {
+ case en_stmt_allocated:
+ case en_stmt_prepared:
+ return SQL_NO_DATA_FOUND;
+
+ case en_stmt_needdata:
+ case en_stmt_mustput:
+ case en_stmt_canput:
+ PUSHSQLERR (pstmt->herr, en_S1010);
+ return SQL_ERROR;
+
+ default:
+ break;
+ }
+ }
+ else if (pstmt->asyn_on != en_MoreResults)
+ {
+ PUSHSQLERR (pstmt->herr, en_S1010);
+
+ return SQL_ERROR;
+ }
+
+ /* call driver */
+ hproc = _iodbcdm_getproc (pstmt->hdbc, en_MoreResults);
+
+ if (hproc == SQL_NULL_HPROC)
+ {
+ PUSHSQLERR (pstmt->herr, en_IM001);
+
+ return SQL_ERROR;
+ }
+
+ CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_MoreResults,
+ (pstmt->dhstmt))
+
+ /* state transition */
+ if (pstmt->asyn_on == en_MoreResults)
+ {
+ switch (retcode)
+ {
+ case SQL_SUCCESS:
+ case SQL_SUCCESS_WITH_INFO:
+ case SQL_NO_DATA_FOUND:
+ case SQL_ERROR:
+ pstmt->asyn_on = en_NullProc;
+ break;
+
+ case SQL_STILL_EXECUTING:
+ default:
+ return retcode;
+ }
+ }
+
+ switch (pstmt->state)
+ {
+ case en_stmt_allocated:
+ case en_stmt_prepared:
+ /* driver should return SQL_NO_DATA_FOUND */
+ break;
+
+ case en_stmt_executed:
+ if (retcode == SQL_NO_DATA_FOUND)
+ {
+ if (pstmt->prep_state)
+ {
+ pstmt->state = en_stmt_prepared;
+ }
+ else
+ {
+ pstmt->state = en_stmt_allocated;
+ }
+ }
+ else if (retcode == SQL_STILL_EXECUTING)
+ {
+ pstmt->asyn_on = en_MoreResults;
+ }
+ break;
+
+ case en_stmt_cursoropen:
+ case en_stmt_fetched:
+ case en_stmt_xfetched:
+ if (retcode == SQL_SUCCESS)
+ {
+ break;
+ }
+ else if (retcode == SQL_NO_DATA_FOUND)
+ {
+ if (pstmt->prep_state)
+ {
+ pstmt->state = en_stmt_prepared;
+ }
+ else
+ {
+ pstmt->state = en_stmt_allocated;
+ }
+ }
+ else if (retcode == SQL_STILL_EXECUTING)
+ {
+ pstmt->asyn_on = en_MoreResults;
+ }
+ break;
+
+ default:
+ break;
+ }
+
+ return retcode;