freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
RE: [freetds] tds_submit_query allways returns TDS_SUCCEED
- From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
- To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] tds_submit_query allways returns TDS_SUCCEED
- Date: Mon, 20 Oct 2003 15:32:20 +0200
> Thanks for the reply but I am still not sure I understand.
> Do you mean I
> should use tds_process_result_tokens? I looked at the test
> t0004.c in the
> unittest catalog and found the following:
>
> rc = try_tds_login(&login, &tds, __FILE__, verbose);
> if (rc != TDS_SUCCEED) {
> fprintf(stderr, "try_tds_login() failed\n");
> return 1;
> }
>
> /* do not check error here, if TABLE is not create this
> give error */
> rc = run_query(tds, "DROP TABLE #longquerytest");
> rc = run_query(tds, "CREATE TABLE #longquerytest (name
> varchar(255))");
> if (rc != TDS_SUCCEED) {
> return 1;
> }
> rc = run_query(tds, "INSERT #longquerytest (name) VALUES
> ('incorrect')");
> if (rc != TDS_SUCCEED) {
> return 1;
> }
> rc = run_query(tds, "INSERT #longquerytest (name) VALUES
> ('correct')");
> if (rc != TDS_SUCCEED) {
> return 1;
> }
>
>
> Her the return code is always checked for TDS_SUCCEED. The
> tds_process_result_tokens only seems to be used to get the
> values from a
> select.
>
> rc = tds_submit_query(tds, long_query);
> while ((rc = tds_process_result_tokens(tds, &result_type)) ==
> TDS_SUCCEED) {
> switch (result_type) {
> case TDS_ROWFMT_RESULT:
>
> I tried to call tds_process_result_tokens after my INSERT but
> there wasn't
> any result tokens to get.
>
> Thanks again for the help!
> James
>
Simply first you send your query with tds_submit_query than you get
results with tds_process_result_tokens. Results can be rows, parameters,
done and others. For messages you must set proper handler in TDSSOCKET
(libTDS will call your functions), they are not returned as results.
freddy77
-
[freetds] tds_submit_query allways returns TDS_SUCCEED,
James Reed, 10/20/2003
- <Possible follow-up(s)>
- RE: [freetds] tds_submit_query allways returns TDS_SUCCEED, ZIGLIO Frediano, 10/20/2003
- RE: [freetds] tds_submit_query allways returns TDS_SUCCEED, James Reed, 10/20/2003
- RE: [freetds] tds_submit_query allways returns TDS_SUCCEED, ZIGLIO Frediano, 10/20/2003
- RE: [freetds] tds_submit_query allways returns TDS_SUCCEED, Lowden, James K, 10/20/2003
- RE: [freetds] tds_submit_query allways returns TDS_SUCCEED, James Reed, 10/21/2003
Archive powered by MHonArc 2.6.24.