Skip to Content.
Sympa Menu

freetds - [freetds] issue with prepared statement queries from a Mac OS X client to SQL Server 2005

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Nick Davis <nick.davis AT vidoop.com>
  • To: "freetds AT lists.ibiblio.org" <freetds AT lists.ibiblio.org>
  • Subject: [freetds] issue with prepared statement queries from a Mac OS X client to SQL Server 2005
  • Date: Mon, 13 Oct 2008 12:33:43 -0500

Hello,

I'm using FreeTDS 0.82 on a Mac OS X Leopard machine to run some prepared statements against our SQL Server 2005 database. The query with the issue is:

SELECT COUNT(*) from tbl WHERE tbl_id = ?

Whenever I run the application, I receive the following error with the query:

SQLSTATE = 420000
Native Error Code = 402
[FreeTDS][SQL Server]The data types varchar and text are incompatible in the equal to operator.

However, tbl_id is of type VARCHAR(36) in the database, not TEXT.

I've attached a relevant section of the freetds dump file that may help shed some light on the issue. Let me know if any other details would be helpful.

Thanks,

Nick Davis


token.c:495:tds_process_tokens(0xe41340, 0xbffff3a4, 0xbffff3a0, 0x100)
util.c:162:Changed query state from PENDING to READING
net.c:592:Received header
0000 04 01 01 46 00 39 01 00- |...F.9..|

net.c:671:Received packet
0000 aa b6 00 92 01 00 00 01-10 4a 00 54 00 68 00 65 |........ .J.T.h.e|
0010 00 20 00 64 00 61 00 74-00 61 00 20 00 74 00 79 |. .d.a.t .a. .t.y|
0020 00 70 00 65 00 73 00 20-00 76 00 61 00 72 00 63 |.p.e.s. .v.a.r.c|
0030 00 68 00 61 00 72 00 20-00 61 00 6e 00 64 00 20 |.h.a.r. .a.n.d. |
0040 00 74 00 65 00 78 00 74-00 20 00 61 00 72 00 65 |.t.e.x.t . .a.r.e|
0050 00 20 00 69 00 6e 00 63-00 6f 00 6d 00 70 00 61 |. .i.n.c .o.m.p.a|
0060 00 74 00 69 00 62 00 6c-00 65 00 20 00 69 00 6e |.t.i.b.l .e. .i.n|
0070 00 20 00 74 00 68 00 65-00 20 00 65 00 71 00 75 |. .t.h.e . .e.q.u|
0080 00 61 00 6c 00 20 00 74-00 6f 00 20 00 6f 00 70 |.a.l. .t .o. .o.p|
0090 00 65 00 72 00 61 00 74-00 6f 00 72 00 2e 00 0b |.e.r.a.t .o.r....|
00a0 57 00 43 00 2d 00 54 00-45 00 53 00 54 00 2d 00 |W.C.-.T. E.S.T.-.|
00b0 57 00 49 00 4e 00 00 01-00 aa 68 00 f4 1f 00 00 |W.I.N... ..h.....|
00c0 01 10 23 00 53 00 74 00-61 00 74 00 65 00 6d 00 |..#.S.t. a.t.e.m.|
00d0 65 00 6e 00 74 00 28 00-73 00 29 00 20 00 63 00 |e.n.t.(. s.). .c.|
00e0 6f 00 75 00 6c 00 64 00-20 00 6e 00 6f 00 74 00 |o.u.l.d. .n.o.t.|
00f0 20 00 62 00 65 00 20 00-70 00 72 00 65 00 70 00 | .b.e. . p.r.e.p.|
0100 61 00 72 00 65 00 64 00-2e 00 0b 57 00 43 00 2d |a.r.e.d. ...W.C.-|
0110 00 54 00 45 00 53 00 54-00 2d 00 57 00 49 00 4e |.T.E.S.T .-.W.I.N|
0120 00 00 01 00 79 f4 1f 00-00 ac 09 00 00 01 00 00 |....y... ........|
0130 00 00 26 04 00 fe 02 00-e0 00 00 00 00 00 |..&..... ......|

token.c:510:processing result tokens. marker is aa(ERROR)
token.c:108:tds_process_default_tokens() marker is aa(ERROR)
token.c:2451:tds_process_msg() reading message from server
token.c:2516:tds_process_msg() calling client msg handler
odbc.c:2032:msgno 402 20003
token.c:2529:tds_process_msg() returning TDS_SUCCEED
token.c:510:processing result tokens. marker is aa(ERROR)
token.c:108:tds_process_default_tokens() marker is aa(ERROR)
token.c:2451:tds_process_msg() reading message from server
token.c:2516:tds_process_msg() calling client msg handler
odbc.c:2032:msgno 8180 20003
token.c:2529:tds_process_msg() returning TDS_SUCCEED
token.c:510:processing result tokens. marker is 79(RETURNSTATUS)
token.c:510:processing result tokens. marker is ac(PARAM)
token.c:567:processing parameters for sp 11
token.c:569:calling tds_process_param_result
token.c:1198:tds_process_param_result(0xe41340, 0xbffff350)
token.c:1596:processing result. type = 38(integer-null), varint_size 1
token.c:1617:processing result. column_size 4
token.c:1915:tds_get_data: type 38, varint size 1
token.c:1975:tds_get_data(): wire column size is -1
token.c:573:1 hidden return parameters
token.c:510:processing result tokens. marker is fe(DONEPROC)
token.c:2201:tds_process_end: more_results = 0
was_cancelled = 0
error = 1
done_count_valid = 0
token.c:2217:tds_process_end() state set to TDS_IDLE
util.c:162:Changed query state from READING to IDLE
token.c:2232: rows_affected = 0
util.c:110:logic error: cannot change query state from IDLE to PENDING
token.c:495:tds_process_tokens(0xe41340, 0xbffff3a4, 0xbffff3a0, 0x100)
token.c:498:tds_process_tokens() state is COMPLETED



Archive powered by MHonArc 2.6.24.

Top of Page