- 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 argument value */
- if( rgbValue == NULL
- && ( cbValue != SQL_DEFAULT_PARAM
- && cbValue != SQL_NULL_DATA ) )
- {
- PUSHSQLERR ( pstmt->herr, en_S1009 );
-
- return SQL_ERROR;
- }
-
- /* check state */
- if( pstmt->asyn_on == en_NullProc )
- {
- if( pstmt->state <= en_stmt_xfetched )
- {
- PUSHSQLERR( pstmt->herr, en_S1010 );
-
- return SQL_ERROR;
- }
- }
- else if( pstmt->asyn_on != en_PutData )
- {
- PUSHSQLERR ( pstmt->herr, en_S1010 );
-
- return SQL_ERROR;
- }
-
- /* call driver */
- hproc = _iodbcdm_getproc( pstmt->hdbc, en_PutData );
-
- if( hproc == SQL_NULL_HPROC )
- {
- PUSHSQLERR ( pstmt->herr, en_IM001 );
-
- return SQL_ERROR;
- }
-
- CALL_DRIVER ( pstmt->hdbc, retcode, hproc, en_PutData, (
- pstmt->dhstmt, rgbValue, cbValue ) )
-
-#if 0
- retcode = hproc(pstmt->dhstmt, rgbValue, cbValue );
-#endif
-
- /* state transition */
- if( pstmt->asyn_on == en_PutData )
- {
- switch( retcode )
- {
- case SQL_SUCCESS:
- case SQL_SUCCESS_WITH_INFO:
- case SQL_ERROR:
- pstmt->asyn_on = en_NullProc;
- break;
-
- case SQL_STILL_EXECUTING:
- default:
- return retcode;
- }
- }
-
- /* must in mustput or canput states */
- switch( retcode )
- {
- case SQL_SUCCESS:
- case SQL_SUCCESS_WITH_INFO:
- pstmt->state = en_stmt_canput;
- break;
-
- case SQL_ERROR:
- switch( pstmt->need_on )
- {
- case en_ExecDirect:
- pstmt->state = en_stmt_allocated;
- pstmt->need_on = en_NullProc;
- break;
-
- case en_Execute:
- if( pstmt->prep_state )
- {
- pstmt->state = en_stmt_prepared;
- pstmt->need_on = en_NullProc;
- }
- break;
-
- case en_SetPos:
- /* Is this possible ???? */
- pstmt->state = en_stmt_xfetched;
- break;
-
- default:
- break;
- }
- break;
-
- case SQL_STILL_EXECUTING:
- pstmt->asyn_on = en_PutData;
- 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 argument value */
+ if (rgbValue == NULL &&
+ (cbValue != SQL_DEFAULT_PARAM && cbValue != SQL_NULL_DATA))
+ {
+ PUSHSQLERR (pstmt->herr, en_S1009);
+
+ return SQL_ERROR;
+ }
+
+ /* check state */
+ if (pstmt->asyn_on == en_NullProc)
+ {
+ if (pstmt->state <= en_stmt_xfetched)
+ {
+ PUSHSQLERR (pstmt->herr, en_S1010);
+
+ return SQL_ERROR;
+ }
+ }
+ else if (pstmt->asyn_on != en_PutData)
+ {
+ PUSHSQLERR (pstmt->herr, en_S1010);
+
+ return SQL_ERROR;
+ }
+
+ /* call driver */
+ hproc = _iodbcdm_getproc (pstmt->hdbc, en_PutData);
+
+ if (hproc == SQL_NULL_HPROC)
+ {
+ PUSHSQLERR (pstmt->herr, en_IM001);
+
+ return SQL_ERROR;
+ }
+
+ CALL_DRIVER (pstmt->hdbc, retcode, hproc, en_PutData,
+ (pstmt->dhstmt, rgbValue, cbValue))
+
+ /* state transition */
+ if (pstmt->asyn_on == en_PutData)
+ {
+ switch (retcode)
+ {
+ case SQL_SUCCESS:
+ case SQL_SUCCESS_WITH_INFO:
+ case SQL_ERROR:
+ pstmt->asyn_on = en_NullProc;
+ break;
+
+ case SQL_STILL_EXECUTING:
+ default:
+ return retcode;
+ }
+ }
+
+ /* must in mustput or canput states */
+ switch (retcode)
+ {
+ case SQL_SUCCESS:
+ case SQL_SUCCESS_WITH_INFO:
+ pstmt->state = en_stmt_canput;
+ break;
+
+ case SQL_ERROR:
+ switch (pstmt->need_on)
+ {
+ case en_ExecDirect:
+ pstmt->state = en_stmt_allocated;
+ pstmt->need_on = en_NullProc;
+ break;
+
+ case en_Execute:
+ if (pstmt->prep_state)
+ {
+ pstmt->state = en_stmt_prepared;
+ pstmt->need_on = en_NullProc;
+ }
+ break;
+
+ case en_SetPos:
+ /* Is this possible ???? */
+ pstmt->state = en_stmt_xfetched;
+ break;
+
+ default:
+ break;
+ }
+ break;
+
+ case SQL_STILL_EXECUTING:
+ pstmt->asyn_on = en_PutData;
+ break;
+
+ default:
+ break;
+ }
+
+ return retcode;