- if( retcode != SQL_SUCCESS
- && retcode != SQL_SUCCESS_WITH_INFO )
- {
- return retcode;
- }
- }
-
- /*
- * Now, either driver's odbc call was successed or
- * driver has not been loaded yet. In the first case, we
- * need flip flag for(such as access_mode, autocommit, ...)
- * for our finit state machine. While in the second case,
- * we need save option values(such as current_qualifier, ...)
- * for delaied setting. So, ...
- */
-
- /* No matter what state we are(i.e. allocated or connected, ..)
- * we need to flip the flag.
- */
- switch( fOption )
- {
- case SQL_ACCESS_MODE:
- pdbc->access_mode = vParam;
- break;
-
- case SQL_AUTOCOMMIT:
- pdbc->autocommit = vParam;
- break;
- }
-
- /* state transition */
- if( pdbc->state != en_dbc_allocated )
- {
- return retcode;
- }
-
- /* Only 'allocated' state is possible here, and we need to
- * save the options for delaied setting.
- */
- switch( fOption )
- {
- case SQL_CURRENT_QUALIFIER:
- if( pdbc->current_qualifier != NULL )
- {
- MEM_FREE ( pdbc->current_qualifier );
- }
-
- if( vParam == 0UL )
- {
- pdbc->current_qualifier = NULL;
-
- break;
- }
-
- pdbc->current_qualifier
- = (char FAR*)MEM_ALLOC (
- STRLEN (vParam) + 1 );
-
- if( pdbc->current_qualifier == NULL )
- {
- PUSHSQLERR ( pdbc->herr, en_S1001 );
- return SQL_ERROR;
- }
-
- STRCPY ( pdbc->current_qualifier, vParam );
- break;
-
- case SQL_LOGIN_TIMEOUT:
- pdbc->login_timeout = vParam;
- break;
-
- case SQL_ODBC_CURSORS:
- pdbc->odbc_cursors = vParam;
- break;
-
- case SQL_PACKET_SIZE:
- pdbc->packet_size = vParam;
- break;
-
- case SQL_QUIET_MODE:
- pdbc->quiet_mode = vParam;
- break;
-
- case SQL_TXN_ISOLATION:
- pdbc->txn_isolation = vParam;
- break;
-
- default:
- /* Since we didn't save the option value for delaied
- * setting, we should raise an error here.
- */
- break;
- }
-
- return retcode;
+ {
+ fclose (pdbc->tstm);
+ }
+ }
+ pdbc->tstm = NULL;
+ pdbc->trace = 0;
+ break;
+
+ default:
+ PUSHSQLERR (pdbc->herr, en_S1009);
+ retcode = SQL_ERROR;
+ }
+
+ if (sqlstat != en_00000)
+ {
+ PUSHSQLERR (pdbc->herr, sqlstat);
+ }
+
+ return retcode;
+ }
+
+ if (fOption == SQL_OPT_TRACEFILE)
+ /* Tracing file can be set before and after connect
+ * and only meaningful for driver manager.
+ */
+ {
+ if (vParam == 0UL || ((char FAR *) vParam)[0] == 0)
+ {
+ PUSHSQLERR (pdbc->herr, en_S1009);
+
+ return SQL_ERROR;
+ }
+
+ if (pdbc->tfile && STREQ (pdbc->tfile, vParam))
+ {
+ return SQL_SUCCESS;
+ }
+
+ if (pdbc->trace)
+ {
+ PUSHSQLERR (pdbc->herr, en_IM014);
+
+ return SQL_ERROR;
+ }
+
+ if (pdbc->tfile)
+ {
+ MEM_FREE (pdbc->tfile);
+ }
+
+ pdbc->tfile = (char FAR *) MEM_ALLOC (1 + STRLEN (vParam));
+
+ if (pdbc->tfile == NULL)
+ {
+ PUSHSQLERR (pdbc->herr, en_S1001);
+
+ return SQL_ERROR;
+ }
+
+ STRCPY (pdbc->tfile, vParam);
+
+ return SQL_SUCCESS;
+ }
+
+ if (pdbc->state != en_dbc_allocated)
+ {
+ /* If already connected, then, driver's odbc call
+ * will be invoked. Otherwise, we only save the options
+ * and delay the setting process until the connection
+ * been established.
+ */
+ hproc = _iodbcdm_getproc (hdbc, en_SetConnectOption);
+
+ if (hproc == SQL_NULL_HPROC)
+ {
+ PUSHSQLERR (pdbc->herr, en_IM001);
+
+ return SQL_ERROR;
+ }
+
+ CALL_DRIVER (hdbc, retcode, hproc, en_SetConnectOption,
+ (pdbc->dhdbc, fOption, vParam))
+
+ if (retcode != SQL_SUCCESS && retcode != SQL_SUCCESS_WITH_INFO)
+ {
+ return retcode;
+ }
+ }
+
+ /*
+ * Now, either driver's odbc call was successed or
+ * driver has not been loaded yet. In the first case, we
+ * need flip flag for(such as access_mode, autocommit, ...)
+ * for our finit state machine. While in the second case,
+ * we need save option values(such as current_qualifier, ...)
+ * for delaied setting. So, ...
+ */
+
+ /* No matter what state we are(i.e. allocated or connected, ..)
+ * we need to flip the flag.
+ */
+ switch (fOption)
+ {
+ case SQL_ACCESS_MODE:
+ pdbc->access_mode = vParam;
+ break;
+
+ case SQL_AUTOCOMMIT:
+ pdbc->autocommit = vParam;
+ break;
+ }
+
+ /* state transition */
+ if (pdbc->state != en_dbc_allocated)
+ {
+ return retcode;
+ }
+
+ /* Only 'allocated' state is possible here, and we need to
+ * save the options for delaied setting.
+ */
+ switch (fOption)
+ {
+ case SQL_CURRENT_QUALIFIER:
+ if (pdbc->current_qualifier != NULL)
+ {
+ MEM_FREE (pdbc->current_qualifier);
+ }
+
+ if (vParam == 0UL)
+ {
+ pdbc->current_qualifier = NULL;
+
+ break;
+ }
+
+ pdbc->current_qualifier
+ = (char FAR *) MEM_ALLOC (
+ STRLEN (vParam) + 1);
+
+ if (pdbc->current_qualifier == NULL)
+ {
+ PUSHSQLERR (pdbc->herr, en_S1001);
+ return SQL_ERROR;
+ }
+
+ STRCPY (pdbc->current_qualifier, vParam);
+ break;
+
+ case SQL_LOGIN_TIMEOUT:
+ pdbc->login_timeout = vParam;
+ break;
+
+ case SQL_ODBC_CURSORS:
+ pdbc->odbc_cursors = vParam;
+ break;
+
+ case SQL_PACKET_SIZE:
+ pdbc->packet_size = vParam;
+ break;
+
+ case SQL_QUIET_MODE:
+ pdbc->quiet_mode = vParam;
+ break;
+
+ case SQL_TXN_ISOLATION:
+ pdbc->txn_isolation = vParam;
+ break;
+
+ default:
+ /* Since we didn't save the option value for delaied
+ * setting, we should raise an error here.
+ */
+ break;
+ }
+
+ return retcode;