[freetds] FreeTDS not giving any results

James Andrewartha jandrewartha at ccgs.wa.edu.au
Fri Sep 6 05:05:58 EDT 2013


Hi,

I have a python script that uses pymssql 1.0.2, that in turn uses
FreeTDS 0.91, connecting to a MSSQL 2008 server. It used to work, but
now I don't get any results. The FreeTDS log (below) show the data is
received, but it's not processed for some reason. I did some code diving
and printf debugging, and dblib.c sets the results_state to empty
because of a TDS_COMPUTEFMT_RESULT (line 4698 in dbsqlok). Does anyone
know why this is happening?

16:30:57.256987 4051 (dblib.c:1312):dbcmd(0x98f1b20, SELECT top 50
ContactEmail FROM uvMerge_Current_Students_ICT_CCGS)
16:30:57.256993 4051 (dblib.c:1319):dbcmd() bufsz = 11
16:30:57.256999 4051 (dblib.c:5882):dbfreebuf(0x98f1b20)
16:30:57.257005 4051 (dblib.c:1369):dbsqlexec(0x98f1b20)
16:30:57.257011 4051 (dblib.c:6862):dbsqlsend(0x98f1b20)
16:30:57.257016 4051 (mem.c:615):tds_free_all_results()
16:30:57.257022 4051 (util.c:156):Changed query state from IDLE to QUERYING
16:30:57.257028 4051 (write.c:140):tds_put_string converting 65 bytes of
"SELECT top 50 ContactEmail FROM uvMerge_Current_Students_ICT_CCGS"
16:30:57.257036 4051 (write.c:168):tds_put_string wrote 130 bytes
16:30:57.257042 4051 (util.c:156):Changed query state from QUERYING to
PENDING
16:30:57.257048 4051 (net.c:741):Sending packet
0000 01 01 00 8a 00 00 01 00-53 00 45 00 4c 00 45 00 |........ S.E.L.E.|
0010 43 00 54 00 20 00 74 00-6f 00 70 00 20 00 35 00 |C.T. .t. o.p. .5.|
0020 30 00 20 00 43 00 6f 00-6e 00 74 00 61 00 63 00 |0. .C.o. n.t.a.c.|
0030 74 00 45 00 6d 00 61 00-69 00 6c 00 20 00 46 00 |t.E.m.a. i.l. .F.|
0040 52 00 4f 00 4d 00 20 00-75 00 76 00 4d 00 65 00 |R.O.M. . u.v.M.e.|
0050 72 00 67 00 65 00 5f 00-43 00 75 00 72 00 72 00 |r.g.e._. C.u.r.r.|
0060 65 00 6e 00 74 00 5f 00-53 00 74 00 75 00 64 00 |e.n.t._. S.t.u.d.|
0070 65 00 6e 00 74 00 73 00-5f 00 49 00 43 00 54 00 |e.n.t.s. _.I.C.T.|
0080 5f 00 43 00 43 00 47 00-53 00                   |_.C.C.G. S.|

16:30:57.257113 4051 (dblib.c:4639):dbsqlok(0x98f1b20)
16:30:57.257151 4051 (dblib.c:4669):dbsqlok() not done, calling
tds_process_tokens()
16:30:57.257157 4051 (token.c:540):tds_process_tokens(0x9908c08,
0xbfc77b58, 0xbfc77b5c, 0x6914)
16:30:57.257164 4051 (util.c:156):Changed query state from PENDING to
READING
16:30:57.849904 4051 (net.c:555):Received header
0000 04 01 05 10 00 ad 01 00-                        |........|

16:30:57.850048 4051 (net.c:609):Received packet
0000 04 01 05 10 00 ad 01 00-81 01 00 00 00 20 00 a7 |........ ..... ..|
0010 c9 00 0c 43 00 6f 00 6e-00 74 00 61 00 63 00 74 |...C.o.n .t.a.c.t|
0020 00 45 00 6d 00 61 00 69-00 6c 00 d1 16 00 62 69 |.E.m.a.i .l....bi|
**data removed**
0500 2e 63 6f 6d 2e 61 75 fd-10 00 c1 00 32 00 00 00 |.com.au. ....2...|

16:30:57.850466 4051 (token.c:555):processing result tokens.  marker is
 81(TDS7_RESULT)
16:30:57.850480 4051 (token.c:1515):processing TDS7 result metadata.
16:30:57.850487 4051 (mem.c:615):tds_free_all_results()
16:30:57.850500 4051 (token.c:1540):set current_results (1 column) to
tds->res_info
16:30:57.850506 4051 (token.c:1547):setting up 1 columns
16:30:57.850513 4051 (token.c:3420):adjust_character_column_size:
        Server charset: CP1252
        Server column_size: 201
        Client charset: ISO-8859-1
        Client column_size: 201
16:30:57.850524 4051 (token.c:1486):tds7_get_data_info:
        colname = ContactEmail (12 bytes)
        type = 39 (varchar)
        server's type = 167 (xvarchar)
        column_varint_size = 2
        column_size = 201 (201 on server)
16:30:57.850531 4051 (token.c:1556): name                 size/wsize
  type/wtype      utype
16:30:57.850537 4051 (token.c:1557): --------------------
--------------- --------------- -------
16:30:57.850543 4051 (token.c:1567): ContactEmail             201/201
       39/167           0
16:30:57.850551 4051 (util.c:156):Changed query state from READING to
PENDING
16:30:57.850559 4051 (dblib.c:4700):dbsqlok() found result token
16:30:57.850567 4051 (dblib.c:1813):dbnumcols(0x98f1b20)
16:30:57.850573 4051 (dblib.c:2761):dbcount(0x98f1b20)
16:30:57.850579 4051 (dblib.c:1813):dbnumcols(0x98f1b20)
16:30:57.850586 4051 (dblib.c:1839):dbcolname(0x98f1b20, 1)
16:30:57.850593 4051 (dblib.c:2831):dbcoltype(0x98f1b20, 1)
16:30:57.850841 4051 (dblib.c:2018):dbnextrow(0x98f1b20)
16:30:57.850854 4051 (dblib.c:2031):dbnextrow() dbresults_state = 1
(_DB_RES_RESULTSET_EMPTY)
16:30:57.850861 4051 (dblib.c:2036):leaving dbnextrow() returning -2
(NO_MORE_ROWS)
16:30:57.850867 4051 (dblib.c:2761):dbcount(0x98f1b20)
16:31:20.183588 4051 (dblib.c:1443):dbclose(0x98f1b20)
16:31:20.183730 4051 (dblib.c:258):dblib_del_connection(0xb702e400,
0x9908c08)
16:31:20.183742 4051 (mem.c:615):tds_free_all_results()
16:31:20.183801 4051 (util.c:156):Changed query state from PENDING to DEAD
16:31:20.183820 4051 (dblib.c:305):dblib_release_tds_ctx(1)
16:31:20.183829 4051 (dblib.c:5882):dbfreebuf(0x98f1b20)

Thanks,

-- 
James Andrewartha
Network & Projects Engineer
Christ Church Grammar School
Claremont, Western Australia
Ph. (08) 9442 1757
Mob. 0424 160 877


More information about the FreeTDS mailing list