Skip to Content.
Sympa Menu

freetds - RE: [freetds] tds_submit_query allways returns TDS_SUCCEED

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "James Reed" <t519008_new AT hotmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: RE: [freetds] tds_submit_query allways returns TDS_SUCCEED
  • Date: Mon, 20 Oct 2003 13:27:51 +0000

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


From: "ZIGLIO Frediano" <Frediano.Ziglio AT vodafone.com>
Reply-To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
Subject: RE: [freetds] tds_submit_query allways returns TDS_SUCCEED
Date: Mon, 20 Oct 2003 11:27:16 +0200

>
> Hi
>
> I am new to freeTDS (which is a really great package by the
> way!!!) I have
> just put together a simple test program using some of the
> stuff from the
> unittests catalog. It seems that I allways get TDS_SUCCEED
> back from the
> tds_submit_query. I am guessing I must be doing something
> wrong since it
> seems freeTDS is so well tested. I have a database with a
> table="test" that
> I am testing with. If I change the INSERT to "INSERT INTO
> crap VALUES
> ('%s')" then I still get TDS_SUCCEED,,,,and I dont have a
> table named crap
> ;)
>
> Thanks
> James
>
> P.S. I am running on a Solaris system and my database is a MS SQL 7.0
> database.
>

It's absolutely normal. tds_submit_query just send query to database and
return failure only for communication problems. After calling
tds_submit_query you should read results. In results you will see an
error message and an error done.

freddy77
_______________________________________________
FreeTDS mailing list
FreeTDS AT lists.ibiblio.org
http://lists.ibiblio.org/mailman/listinfo/freetds

_________________________________________________________________
MSN Foto http://www.msn.no/foto Fest dine digitale minner til papir





Archive powered by MHonArc 2.6.24.

Top of Page