freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Peter Deacon <peterd AT iea-software.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: RE: [freetds] SQLExec still succeeds too much
- Date: Tue, 1 Apr 2003 10:09:05 -0800 (Pacific Standard Time)
On Tue, 1 Apr 2003, ZIGLIO Frediano wrote:
> Some about the patch
> diff -ur \freetds_bak\src/tds/token.c ./tds/token.c
> --- \freetds_bak\src/tds/token.c Sun Mar 30 20:52:39 2003
> +++ ./tds/token.c Tue Apr 1 01:35:03 2003
> @@ -424,7 +424,12 @@
> for (;;) {
>
> marker = tds_get_byte(tds);
> tdsdump_log(TDS_DBG_INFO1, "%L processing result tokens.
> marker is %x(%s)\n", marker, _tds_token_name(marker));
> +
> + if (IS_TDSDEAD(tds)) {
> + *result_type = TDS_CMD_FAIL;
> + return TDS_FAIL;
> + }
>
> switch (marker) {
> case TDS7_RESULT_TOKEN:
> @@ -509,7 +514,8 @@
> return TDS_SUCCEED;
> break;
> default:
> if (tds_process_default_tokens(tds, marker) ==
> TDS_FAIL) {
> + *result_type = TDS_CMD_FAIL;
> return TDS_FAIL;
> }
> break;
> @@ -559,8 +565,11 @@
> while (1) {
>
> marker = tds_get_byte(tds);
> tdsdump_log(TDS_DBG_INFO1, "%L processing row tokens.
> marker is %x(%s)\n", marker, _tds_token_name(marker));
>
> + if (IS_TDSDEAD(tds))
> + return TDS_FAIL;
> +
> switch (marker) {
> case TDS_RESULT_TOKEN:
> case TDS7_RESULT_TOKEN:
> @@ -645,7 +654,11 @@
> while(tds->state != TDS_COMPLETED) {
>
> marker = tds_get_byte(tds);
> tdsdump_log(TDS_DBG_INFO1, "%L processing trailing tokens.
> marker is %x(%s)\n", marker, _tds_token_name(marker));
> +
> + if (IS_TDSDEAD(tds))
> + return TDS_FAIL;
> +
> switch (marker) {
> case TDS_DONE_TOKEN:
> case TDS_DONEPROC_TOKEN:
> Setting result_type before sending TDS_FAIL is not useful. Returning
> TDS_FAIL mean a conversation error or a packet error (garbage from server)
> while result_type == TDS_CMD_FAIL and TDS_SUCCEED mean last command fail.
Your right... I remember result_type being garbage inside the
select somehow so I just added result to the default... Don't see how
that could have been.
All of this IS_TDSDEAD checking was to get around a problem where
tds_process_result_tokens would loop forever on TDS_ROW_TOKEN, but that
was just something I caused while playing around.
The real problem is pretty simple in _SQLExecute the final else should
return SQL_ERROR instead of result (SQL_SUCCESS by default)
} else {
tdsdump_log(TDS_DBG_INFO1, "SQLExecute: bad results\n");
- return result;
+ return SQL_ERROR;
:)
Have Fun!
Peter
-
[freetds] SQLExec still succeeds too much,
Peter Deacon, 04/01/2003
- <Possible follow-up(s)>
-
RE: [freetds] SQLExec still succeeds too much,
ZIGLIO Frediano, 04/01/2003
- RE: [freetds] SQLExec still succeeds too much, Peter Deacon, 04/01/2003
- RE: [freetds] SQLExec still succeeds too much, ZIGLIO Frediano, 04/02/2003
Archive powered by MHonArc 2.6.24.