-RETCODE SQL_API SQLSetStmtOption (
- HSTMT hstmt,
- UWORD fOption,
- UDWORD vParam )
-{
- STMT_t FAR* pstmt = (STMT_t FAR*)hstmt;
- HPROC hproc;
- int sqlstat = en_00000;
- RETCODE retcode;
-
- if( hstmt == SQL_NULL_HSTMT
- || pstmt->hdbc == SQL_NULL_HDBC )
- {
- return SQL_INVALID_HANDLE;
- }
-
- /* check option */
- if(/* fOption < SQL_STMT_OPT_MIN || */
- fOption > SQL_STMT_OPT_MAX )
- {
- PUSHSQLERR ( pstmt->herr, en_S1092 );
-
- return SQL_ERROR;
- }
-
- if( fOption == SQL_CONCURRENCY
- || fOption == SQL_CURSOR_TYPE
- || fOption == SQL_SIMULATE_CURSOR
- || fOption == SQL_USE_BOOKMARKS )
- {
- if( pstmt->asyn_on != en_NullProc )
- {
- if( pstmt->prep_state )
- {
- sqlstat = en_S1011;
- }
- }
- else
- {
- switch( pstmt->state )
- {
- case en_stmt_prepared:
- sqlstat = en_S1011;
- break;
-
- case en_stmt_executed:
- case en_stmt_cursoropen:
- case en_stmt_fetched:
- case en_stmt_xfetched:
- sqlstat = en_24000;
- break;
-
- case en_stmt_needdata:
- case en_stmt_mustput:
- case en_stmt_canput:
- if( pstmt->prep_state )
- {
- sqlstat = en_S1011;
- }
- break;
-
- default:
- break;
- }
- }
- }
- else
- {
- if( pstmt->asyn_on != en_NullProc )
- {
- if( ! pstmt->prep_state )
- {
- sqlstat = en_S1010;
- }
- }
- else
- {
- if( pstmt->state >= en_stmt_needdata )
- {
- sqlstat = en_S1010;
- }
- }
- }
-
- if( sqlstat != en_00000 )
- {
- PUSHSQLERR ( pstmt->herr, sqlstat );
-
- return SQL_ERROR;
- }
-
- hproc = _iodbcdm_getproc( pstmt->hdbc, en_SetStmtOption );
-
- if( hproc == SQL_NULL_HPROC )
- {
- PUSHSQLERR ( pstmt->herr, en_IM001 );
-
- return SQL_ERROR;
- }
-
- CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_SetStmtOption, (
- pstmt->dhstmt, fOption, vParam ) )
-
-#if 0
- retcode = hproc ( pstmt->dhstmt, fOption, vParam );
-#endif