Skip to Content.
Sympa Menu

freetds - RE: [freetds] New BUG: update/delete returns -1 insteadofcorrecta ffected rows on Merge Publication on MSSQL 2000 SP3a

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Lowden, James K" <LowdenJK AT bernstein.com>
  • To: 'FreeTDS Development Group' <freetds AT lists.ibiblio.org>
  • Subject: RE: [freetds] New BUG: update/delete returns -1 insteadofcorrecta ffected rows on Merge Publication on MSSQL 2000 SP3a
  • Date: Fri, 9 Jan 2004 14:35:06 -0500

> From: ZIGLIO Frediano [mailto:Frediano.Ziglio AT vodafone.com]
> Sent: January 9, 2004 12:11 PM
>
> > > > The bad one, freetds.log.debug:
> > > >
> > > > Received packet @ 2004-01-08 19:52:58.992128
> > > > 0000 ff <= TDS_DONEINPROC
> > > > 01 00 <= 0x0010, done count valid
> > > > c0 00 <= transaction state 0x00c0 ?? (OK....)
> > > > 00 00 00 00 <= zero rows affected
> > > >
> > >
> > > 0x01 is just more coming without row. In ODBC I ignore this
> > > token (as MS does)
> >
> > OK, I think you're referring to the packet below, not above?
>
> No, 01 00 -> 0x01 -> no row count.

oh-one, one-oh. Why are you being so fussy?

Thanks for pointing that out. The rest of the packets make better sense to
me now.

> > > > 79 <= TDS_RETURNSTATUS
> > > > 00 00 00 00 <= procedure returned zero
> > > >
> > > > 0020 fd <= TDS_DONE
> > > > 10 00 <= 0x0010, done count valid
> > > > c5 00 <= transaction state ??
> > > > 00 00 00 00 <= zero rows affected
> > > >
> > >
> > > 0xC5 is update, our statement and 0 rows are returned. So 0
> > would be
> > > returned by ODBC.
> >
> > Am I to understand that this update statement affected no
> > rows? The "good
> > log" update affected 1 row.
> >
>
> However server return 0 rows... perhaps during the test you did
> something wrong... I hope the server return valid informations... I
> don't have any workaround for this case :)

I think you know this, but just to be clear: "rows affected" doesn't mean
"rows returned". If you insert 10 rows, you should see 10 rows affected
(and none returned):

$ sqsh -S$S -U$U -P$P
sqsh-2.1 Copyright (C) 1995-2001 Scott C. Gray
...
1> select id into #ids from sysobjects
2> delete #ids where id % 2 = 0
3> update #ids set id = id / 5
4> select count(*), id from #ids group by id having count(*) > 1
5> go
(176 rows affected)
(89 rows affected)
(87 rows affected)
id
----------- -----------
2 0
2 4

(2 rows affected)

The server response packet:

Received packet @ 14:21:16.384647
0000 fd 11 00 c2 00 b0 00 00-00 fd 11 00 c4 00 59 00 |........ ......Y.|
0010 00 00 fd 11 00 c5 00 57-00 00 00 81 02 00 00 00 |.......W ........|
0020 09 00 26 04 00 00 00 08-00 38 02 69 00 64 00 d1 |..&..... .8.i.d..|
0030 04 02 00 00 00 00 00 00-00 d1 04 02 00 00 00 04 |........ ........|
0040 00 00 00 fd 10 00 c1 00-02 00 00 00 |........ ....|

processing result tokens. marker is fd(DONE)
tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
rows_affected = 176
ct_results() process_result_tokens returned 1 (type 4052)
ct_results() results state = 0
ct_results()
ct_res_info()
ct_res_info(): Number of rows is 176
ct_results()
processing result tokens. marker is fd(DONE)
tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
rows_affected = 89
ct_results() process_result_tokens returned 1 (type 4052)
ct_results() results state = 0
ct_results()
ct_res_info()
ct_res_info(): Number of rows is 89
ct_results()
processing result tokens. marker is fd(DONE)
tds_process_end: more_results = 1
was_cancelled = 0
error = 0
done_count_valid = 1
rows_affected = 87
ct_results() process_result_tokens returned 1 (type 4052)
ct_results() results state = 0
ct_results()
ct_res_info()
ct_res_info(): Number of rows is 87
ct_results()
processing result tokens. marker is 81(TDS7_RESULT)

So, when his log says the update affected zero rows, it doesn't mean no rows
were returned. It means the update statement found no rows meeting the
WHERE criteria.

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and
confidential information and is intended only for the use of the person(s)
named above. If you are not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, any
review, dissemination, distribution or duplication of this communication is
strictly prohibited. If you are not the intended recipient, please contact
the sender immediately by reply e-mail and destroy all copies of the original
message. Please note that we do not accept account orders and/or instructions
by e-mail, and therefore will not be responsible for carrying out such orders
and/or instructions.





  • RE: [freetds] New BUG: update/delete returns -1 insteadofcorrecta ffected rows on Merge Publication on MSSQL 2000 SP3a, Lowden, James K, 01/09/2004

Archive powered by MHonArc 2.6.24.

Top of Page