Logo Search packages:      
Sourcecode: freetds version File versions

int tds_process_simple_query ( TDSSOCKET *  tds,
TDS_INT *  result_type 
)

Process results for simple query as "SET TEXTSIZE" or "USE dbname" If you issue a statement that return some results all results are discarded. This function was written for avoiding calls to tds_process_default_tokens directly (causing some problem like query error ignoring or other) All results are readed until idle state or severe failure (do not stop for statement failure).

Parameters:
result_type hold results type (only TDS_CMD_SUCCEED or TDS_CMD_FAIL should return)
Returns:
see tds_process_result_tokens for results (TDS_NO_MORE_RESULTS is never returned)

Definition at line 624 of file token.c.

References tds_process_result_tokens(), tds_process_row_tokens(), and tds_process_simple_query().

Referenced by tds_connect(), and tds_process_simple_query().

{
TDS_INT result = TDS_CMD_SUCCEED;
TDS_INT res_type;
TDS_INT rowtype;
int tdsret;

      *result_type = TDS_CMD_FAIL;
      for (;;) {
            switch (tdsret=tds_process_result_tokens(tds, &res_type)) {
            case TDS_SUCCEED:
                  switch (res_type) {
                  case TDS_ROW_RESULT:
                  case TDS_COMPUTE_RESULT:
                        /* discard all this information */
                        while ((tdsret=tds_process_row_tokens(tds, &rowtype, NULL)) == TDS_SUCCEED)
                              ;
                        
                        if (tdsret == TDS_FAIL)
                              return TDS_FAIL;

                        break;

                  case TDS_CMD_DONE:
                        break;

                  /* some command went wrong */
                  case TDS_CMD_FAIL:
                        result = TDS_CMD_FAIL;
                        break;


                  /* ignore */
                  case TDS_COMPUTEFMT_RESULT:
                  case TDS_ROWFMT_RESULT:
                  case TDS_DESCRIBE_RESULT:
                  case TDS_STATUS_RESULT:
                  case TDS_PARAM_RESULT:
                  default:
                        break;
                  }
                  break;

            case TDS_NO_MORE_RESULTS:
                  *result_type = result;
                  return TDS_SUCCEED;

            default:
                  return tdsret;
                  break;
            }
      }
}


Generated by  Doxygen 1.6.0   Back to index