[freetds] Affected Rows with FreeTDS and DBI

Glen Malley glen at gmo.jp
Wed Aug 6 16:41:32 EDT 2003


Hi James, thanks for responding.
I've attached a TDSDUMP of my test, it's basically just performing an
update on a single, known entry. I'm by no means clear on the meaning
of most of the stuff in the dump, but it does seem to say "Number of
rows" is always 0 at each step in the process.

I'd appreciate any comments you or anyone else have on this.
Thanks.

James K. Lowden wrote:

> On Tue, 05 Aug 2003 12:42:18 +0900, Glen Malley <glen at gmo.jp> wrote:
> 
>>I'm using the latest versions of FreeTDS, Perl, DBI, etc. to
>>communicate with MSSQL 7 servers.
>>My issue is this, after "execute"-ing an UPDATE in a manner to which
>>I know there will be a non-zero number of rows affected, I am
>>checking $sth->rows and the $result of the execution, and finding
>>them to be 0 and 0E0 respectively. I've used trace and not seen
>>the affected rows value being tossed about anywhere at all, so I can
>>only assume it's simply nowhere to be found.
>>I tested this with extremely minimal code, merely doing an update to
>>all entries in a test table, so I know there should always be affected
>>rows.
> 
> 
> Glen, 
> 
> Welcome to the project.  I think this feature works or can be made to.  
> 
> Could we see a TDSDUMP log of your "minimal" test?  There should be
> indications in there of a call to ct_res_info() with type CS_ROW_COUNT,
> indicating rows affected.  If the count is -1, it means we think the
> server marked the "rows affected" field of the TDS_DONE_TOKEN packet as
> invalid. 
> 
> I assume you mean 0.61 of FreeTDS and 1.00 of DBD::Sybase.  
> 
> --jkl

-------------- next part --------------
Starting log file with debug level 99.
2003-08-06 08:52:40.719214 iconv will convert client-side data to the "" character set
2003-08-06 08:52:40.719686 Connecting addr 192.168.38.75 port 1433 with TDS version 4.2
Sending packet @ 2003-08-06 08:52:40.722852

<...snip...>

0140  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
0150  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
0160  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
0170  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
0180  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
0190  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
01a0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
01b0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
01c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |........ ........|
01d0  00 09 04 02 00 00 43 54  2d 4c 69 62 72 61 72 79   |......CT -Library|
01e0  0a 00 00 00 00 00 0d 11  75 73 5f 65 6e 67 6c 69   |........ us_engli|
01f0  73 68 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |sh...... ........|


Sending packet @ 2003-08-06 08:52:40.723321
0000  02 01 00 4c 00 00 00 00  00 00 00 00 00 00 0a 00   |...L.... ........|
0010  00 00 00 00 00 00 00 00  00 00 00 00 00 69 73 6f   |........ .....iso|
0020  5f 31 00 00 00 00 00 00  00 00 00 00 00 00 00 00   |_1...... ........|
0030  00 00 00 00 00 00 00 00  00 00 00 05 01 35 31 32   |........ .....512|
0040  00 00 00 03 00 00 00 00  00 00 00 00               |........ ....|


2003-08-06 08:52:40.723410 inside tds_process_login_tokens()
Received header @ 2003-08-06 08:52:40.937937
0000  04 01 00 98 00 00 00 00                            |........|


Received packet @ 2003-08-06 08:52:40.937977
0000  e3 12 00 01 09 64 62 5f  4f 66 66 69 63 65 06 6d   |.....db_ Office.m|
0010  61 73 74 65 72 ab 42 00  45 16 00 00 02 00 2e 00   |aster.B. E.......|
0020  c3 de 2d c0 cd de 2d bd  20 ba dd c3 b7 bd c4 82   |..-...-.  .......|
0030  f0 20 27 64 62 5f 4f 66  66 69 63 65 27 20 82 c9   |. 'db_Of fice' ..|
0040  95 cf 8d 58 82 b5 82 dc  82 b5 82 bd 81 42 08 54   |...X.... .....B.T|
0050  45 53 54 2d 53 51 4c 00  00 00 ad 1e 00 01 04 02   |EST-SQL. ........|
0060  00 00 14 4d 69 63 72 6f  73 6f 66 74 20 53 51 4c   |...Micro soft SQL|
0070  20 53 65 72 76 65 72 5f  06 32 ff e3 09 00 04 03   | Server_ .2......|
0080  35 31 32 03 35 31 32 fd  00 00 00 00 00 00 00 00   |512.512. ........|


2003-08-06 08:52:40.938077 inside tds_process_default_tokens() marker is e3(ENVCHANGE)
2003-08-06 08:52:40.938157 inside tds_process_default_tokens() marker is ab(INFO)
2003-08-06 08:52:40.938208 inside tds_process_default_tokens() marker is e3(ENVCHANGE)
2003-08-06 08:52:40.938234 inside tds_process_default_tokens() marker is fd(DONE)
2003-08-06 08:52:40.938263 inside tds_process_end() more_results = 0, was_cancelled = 0 
2003-08-06 08:52:40.938287 inside tds_process_default_tokens() setting state to COMPLETED
Sending packet @ 2003-08-06 08:52:40.938358
0000  01 01 00 15 00 00 00 00  73 65 6c 65 63 74 20 40   |........ select @|
0010  40 73 70 69 64                                     |@spid|


Received header @ 2003-08-06 08:52:40.942242
0000  04 01 00 22 00 00 00 00                            |..."....|


Received packet @ 2003-08-06 08:52:40.942277
0000  a0 01 00 00 a1 06 00 06  00 00 00 26 02 d1 02 0c   |........ ...&....|
0010  00 fd 10 00 c1 00 01 00  00 00                     |........ ..|


2003-08-06 08:52:40.942311 processing result tokens.  marker is  a0(COLNAME)
2003-08-06 08:52:40.942355 processing result tokens.  marker is  a1(COLFMT)
2003-08-06 08:52:40.942393 processing result. type = 38(integer-null), varint_size 1
2003-08-06 08:52:40.942436 processing row tokens.  marker is  d1(ROW)
2003-08-06 08:52:40.942459 processing row.  column is 0 varint size = 1
2003-08-06 08:52:40.942480 processing row.  column size is 2 
2003-08-06 08:52:40.942509 clearing column 0 NULL bit
2003-08-06 08:52:40.942530 processing row tokens.  marker is  fd(DONE)
2003-08-06 08:52:40.942551 inside tds_process_end() more_results = 0, was_cancelled = 0 
2003-08-06 08:52:40.942574 inside tds_process_result_tokens() state is COMPLETED
2003-08-06 08:52:40.942595 leaving tds_process_login_tokens() returning 1
Sending packet @ 2003-08-06 08:52:40.942637
0000  01 01 00 1b 00 00 00 00  73 65 74 20 74 65 78 74   |........ set text|
0010  73 69 7a 65 20 36 34 35  31 32 20                  |size 645 12 |


Received header @ 2003-08-06 08:52:40.945862
0000  04 01 00 11 00 00 00 00                            |........|


Received packet @ 2003-08-06 08:52:40.945905
0000  fd 00 00 be 00 00 00 00  00                        |........ .|


2003-08-06 08:52:40.945931 processing result tokens.  marker is  fd(DONE)
2003-08-06 08:52:40.945953 inside tds_process_end() more_results = 0, was_cancelled = 0 
2003-08-06 08:52:40.945975 inside tds_process_result_tokens() state is COMPLETED
2003-08-06 08:52:40.946015 leaving ct_connect() returning 1
2003-08-06 08:52:40.946039 inside ct_options() action = CS_GET option = 7
2003-08-06 08:52:40.946060 ct_option: UNIMPLEMENTED 7
2003-08-06 08:52:40.946866 inside ct_cmd_alloc()
2003-08-06 08:52:40.946940 inside ct_command()
2003-08-06 08:52:40.946962 inside ct_send()
Sending packet @ 2003-08-06 08:52:40.946990
0000  01 01 00 51 00 00 00 00  55 50 44 41 54 45 20 64   |...Q.... UPDATE d|
0010  62 5f 52 61 64 69 75 73  41 63 63 6f 75 6e 74 2e   |b_Radius Account.|
0020  64 62 6f 2e 52 61 64 69  75 73 41 63 63 6f 75 6e   |dbo.Radi usAccoun|
0030  74 20 53 45 54 20 53 74  61 74 75 73 3d 30 20 57   |t SET St atus=0 W|
0040  48 45 52 45 20 55 49 44  20 3d 20 31 36 36 30 31   |HERE UID  = 16601|
0050  39                                                 |9|


2003-08-06 08:52:40.947162 ct_send() succeeded
2003-08-06 08:52:40.947183 inside ct_results()
Received header @ 2003-08-06 08:52:40.965843
0000  04 01 00 47 00 00 00 00                            |...G....|


Received packet @ 2003-08-06 08:52:40.965880
0000  ff 45 00 d4 00 00 00 00  00 ff 55 00 c1 00 01 00   |.E...... ..U.....|
0010  00 00 ff 55 00 c1 00 01  00 00 00 ff 45 00 c0 00   |...U.... ....E...|
0020  00 00 00 00 ff 55 00 c5  00 01 00 00 00 ff 45 00   |.....U.. ......E.|
0030  d5 00 00 00 00 00 fd 10  00 c5 00 01 00 00 00      |........ .......|


2003-08-06 08:52:40.965932 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.965955 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.965978 inside ct_results() process_result_tokens returned 1 (type 4047) 
2003-08-06 08:52:40.966057 inside ct_res_info()
2003-08-06 08:52:40.966077 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966096 inside ct_results()
2003-08-06 08:52:40.966115 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.966136 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.966158 inside ct_results() process_result_tokens returned 1 (type 4046) 
2003-08-06 08:52:40.966180 inside ct_res_info()
2003-08-06 08:52:40.966198 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966217 inside ct_results()
2003-08-06 08:52:40.966236 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.966256 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.966278 inside ct_results() process_result_tokens returned 1 (type 4046) 
2003-08-06 08:52:40.966300 inside ct_res_info()
2003-08-06 08:52:40.966319 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966338 inside ct_results()
2003-08-06 08:52:40.966356 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.966395 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.966418 inside ct_results() process_result_tokens returned 1 (type 4047) 
2003-08-06 08:52:40.966440 inside ct_res_info()
2003-08-06 08:52:40.966458 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966478 inside ct_results()
2003-08-06 08:52:40.966496 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.966517 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.966539 inside ct_results() process_result_tokens returned 1 (type 4046) 
2003-08-06 08:52:40.966561 inside ct_res_info()
2003-08-06 08:52:40.966579 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966599 inside ct_results()
2003-08-06 08:52:40.966617 processing result tokens.  marker is  ff(DONEINPROC)
2003-08-06 08:52:40.966638 inside tds_process_end() more_results = 1, was_cancelled = 0 
2003-08-06 08:52:40.966660 inside ct_results() process_result_tokens returned 1 (type 4047) 
2003-08-06 08:52:40.966689 inside ct_res_info()
2003-08-06 08:52:40.966708 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966728 inside ct_results()
2003-08-06 08:52:40.966746 processing result tokens.  marker is  fd(DONE)
2003-08-06 08:52:40.966767 inside tds_process_end() more_results = 0, was_cancelled = 0 
2003-08-06 08:52:40.966789 inside ct_results() process_result_tokens returned 1 (type 4046) 
2003-08-06 08:52:40.966810 inside ct_res_info()
2003-08-06 08:52:40.966829 ct_res_info(): Number of rows is 0
2003-08-06 08:52:40.966848 inside ct_results()
2003-08-06 08:52:40.966867 inside tds_process_result_tokens() state is COMPLETED
2003-08-06 08:52:40.966886 inside ct_results() process_result_tokens returned 2 (type 4046) 
2003-08-06 08:52:40.967089 inside ct_cancel()
Sending packet @ 2003-08-06 08:52:40.967150
0000  06 01 00 08 00 00 00 00                            |........|


Received header @ 2003-08-06 08:52:40.970163
0000  04 01 00 11 00 00 00 00                            |........|


Received packet @ 2003-08-06 08:52:40.970208
0000  fd 20 00 00 00 00 00 00  00                        |. ...... .|


2003-08-06 08:52:40.970234 inside tds_process_end() more_results = 0, was_cancelled = 1 
2003-08-06 08:52:40.970269 inside ct_close()
2003-08-06 08:52:40.970436 inside ct_con_drop()


More information about the FreeTDS mailing list