Logo Search packages:      
Sourcecode: freetds version File versions

int tds_process_default_tokens ( TDSSOCKET *  tds,
int  marker 
)

tds_process_default_tokens() is a catch all function that is called to process tokens not known to other tds_process_* routines

Definition at line 84 of file token.c.

References tds_get_int(), tds_get_n(), tds_get_smallint(), tds_process_default_tokens(), and tds_process_end().

Referenced by tds_process_cancel(), tds_process_default_tokens(), tds_process_login_tokens(), tds_process_result_tokens(), and tds_process_row_tokens().

{
      int tok_size;
      int done_flags;

      tdsdump_log(TDS_DBG_FUNC, "%L inside tds_process_default_tokens() marker is %x(%s)\n", marker, _tds_token_name(marker));

      if (IS_TDSDEAD(tds)) {
            tdsdump_log(TDS_DBG_FUNC, "%L leaving tds_process_default_tokens() connection dead\n");
            tds->state = TDS_DEAD;
            return TDS_FAIL;
      }

      switch (marker) {
      case TDS_AUTH_TOKEN:
            tds_process_auth(tds);
            break;
      case TDS_ENVCHANGE_TOKEN:
            tds_process_env_chg(tds);
            break;
      case TDS_DONE_TOKEN:
      case TDS_DONEPROC_TOKEN:
      case TDS_DONEINPROC_TOKEN:
            tds_process_end(tds, marker, &done_flags);
            if (!(done_flags & TDS_DONE_MORE_RESULTS)) {
                  tdsdump_log(TDS_DBG_FUNC, "%L inside tds_process_default_tokens() setting state to COMPLETED\n");
                  tds->state = TDS_COMPLETED;
            }
            break;
      case TDS_PROCID_TOKEN:
            tds_get_n(tds, NULL, 8);
            break;
      case TDS_RETURNSTATUS_TOKEN:
            tds->has_status = 1;
            tds->ret_status = tds_get_int(tds);
            break;
      case TDS_ERROR_TOKEN:
      case TDS_INFO_TOKEN:
      case TDS_EED_TOKEN:
            tds_process_msg(tds, marker);
            break;
      case TDS_CAPABILITY_TOKEN:
            /* TODO split two part of capability and use it */
            tok_size = tds_get_smallint(tds);
            tds_get_n(tds, tds->capabilities, tok_size > TDS_MAX_CAPABILITY ? TDS_MAX_CAPABILITY : tok_size);
            break;
            /* PARAM_TOKEN can be returned inserting text in db, to return new timestamp */
      case TDS_PARAM_TOKEN:
            tds_unget_byte(tds);
            tds_process_param_result_tokens(tds);
            break;
      case TDS7_RESULT_TOKEN:
            tds7_process_result(tds);
            break;
      case TDS_RESULT_TOKEN:
            tds_process_result(tds);
            break;
      case TDS_COLNAME_TOKEN:
            tds_process_col_name(tds);
            break;
      case TDS_COLFMT_TOKEN:
            tds_process_col_fmt(tds);
            break;
      case TDS_ROW_TOKEN:
            tds_process_row(tds);
            break;
      case TDS5_PARAMFMT_TOKEN:
            /* store discarded parameters in param_info, not in old dynamic */
            tds->cur_dyn = NULL;
            tds_process_dyn_result(tds);
            break;
      case TDS5_PARAMS_TOKEN:
            /* save params */
            tds_process_params_result_token(tds);
            break;
      case TDS5_DYNAMIC_TOKEN:
      case TDS_LOGINACK_TOKEN:
      case TDS_ORDERBY_TOKEN:
      case TDS_CONTROL_TOKEN:
      case TDS_TABNAME_TOKEN: /* used for FOR BROWSE query */
      case TDS_COLINFO_TOKEN:
            tdsdump_log(TDS_DBG_WARN, "eating token %d\n", marker);
            tds_get_n(tds, NULL, tds_get_smallint(tds));
            break;
      case TDS_ORDERBY2_TOKEN:
            tdsdump_log(TDS_DBG_WARN, "eating token %d\n", marker);
            tds_get_n(tds, NULL, tds_get_int(tds));
            break;
      default:
            if (IS_TDSDEAD(tds))
                  tds->state = TDS_DEAD;
            /* TODO perhaps is best to close this connection... */
            tdsdump_log(TDS_DBG_ERROR, "Unknown marker: %d(%x)!!\n", marker, (unsigned char) marker);
            return TDS_FAIL;
      }
      return TDS_SUCCEED;
}


Generated by  Doxygen 1.6.0   Back to index