freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
[freetds] BUG? SQL_LONGVARCHAR parameter fails with long data
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: TDS Development Group <freetds AT lists.ibiblio.org>
- Subject: [freetds] BUG? SQL_LONGVARCHAR parameter fails with long data
- Date: Thu, 24 Jul 2008 18:37:53 -0400
I'm trying to send the contents of a file as a parameter to a stored
procedure using latest DBD::ODBC and CVS HEAD. I can send COPYING.LIB
(25,265 bytes). I cannot send ChangeLog-2004 (99,533 bytes). The script
aborts without an error.
To test, I'm using samples/odbc_rpc.pl. (The argument can have the form
":FILE:filename".) My procedure is on SQL Server 2000 and looks like
this:
CREATE proc xmltest @input text
as
select datalength(@input) as 'nbytes received'
I'm binding to SQL_LONGVARCHAR. I tried binding to SQL_BINARY and
SQL_BLOB, but got errors (about "rebinding", go figure). I don't know if
there's a hard limit to SQL_LONGVARCHAR.
If someone can get this to work for "large" files, or tell me why it
can't, I'd be grateful. I suspect it's an error in FreeTDS, although I
haven't been able to find it.
--jkl
P.S. You might ask why anyone would want to do this. Sending XML text as
a parameter lets you use Microsoft's groovy XML parser to convert your
tagged data into tabular data. If you're loading a database, it saves
having a target BCP table for every XML file you ever receive.
P.P.S: the last 30 lines of the TDSDUMP log follow:
$ tail -30 dump
odbc.c:1451:_SQLAllocStmt(0x81d8400, 0x8200c10)
odbc.c:4166:SQLGetStmtAttr(0x81fb700, 10010, 0xbfbfec7c, 4, 0x0)
odbc.c:4166:SQLGetStmtAttr(0x81fb700, 10011, 0xbfbfec7c, 4, 0x0)
odbc.c:4166:SQLGetStmtAttr(0x81fb700, 10012, 0xbfbfec7c, 4, 0x0)
odbc.c:4166:SQLGetStmtAttr(0x81fb700, 10013, 0xbfbfec7c, 4, 0x0)
odbc.c:4211:SQLPrepare(0x81fb700, {? = call xmltest (?)}, 22)
odbc.c:3932:SQLFreeStmt(0x81fb700, 3)
odbc.c:3853:_SQLFreeStmt(0x81fb700, 3, 0)
odbc.c:1272:SQLBindParameter(0x81fb700, 1, 2, 1, 12, 27, 1, 0x81fcca0, 27,
0x80519b0)
odbc.c:1173:_SQLBindParameter(0x81fb700, 1, 2, 1, 12, 27, 1, 0x81fcca0,
27, 0x80519b0)
odbc.c:1272:SQLBindParameter(0x81fb700, 2, 1, 1, -1, 99533, 32767,
0x817ef00, 99533, 0x817ef30)
odbc.c:1173:_SQLBindParameter(0x81fb700, 2, 1, 1, -1, 99533, 32767,
0x817ef00, 99533, 0x817ef30)
odbc.c:3296:SQLExecute(0x81fb700)
sql2tds.c:150:type=-1
sql2tds.c:156:trace
odbc.c:5930:SQLParamData(0x81fb700, 0xbfbfef00) [param_num 2,
param_data_called = 0]
odbc.c:5973:SQLPutData(0x81fb700, 0x82ff000, 99533)
prepare_query.c:257:continue_parse_prepared_query with parameter 2
odbc.c:5930:SQLParamData(0x81fb700, 0xbfbfef00) [param_num 2,
param_data_called = 1]
error.c:611:SQLGetDiagRec(3, 0x81fb700, 1, 0xbfbfe910, 0xbfbfe908,
0xbfbfe920, 512, 0xbfbfe90c)
odbc.c:4636:SQLGetConnectOption(0x81d8400, 102, 0xbfbfef08)
odbc.c:4551:_SQLGetConnectAttr(0x81d8400, 102, 0xbfbfef08, 256, 0x0)
odbc.c:2057:SQLDisconnect(0x81d8400)
odbc.c:3853:_SQLFreeStmt(0x81fb700, 1, 1)
mem.c:563:tds_free_all_results()
util.c:162:Changed query state from IDLE to DEAD
odbc.c:3764:SQLFreeHandle(2, 0x0x81d8400)
odbc.c:3790:_SQLFreeConnect(0x81d8400)
odbc.c:3764:SQLFreeHandle(1, 0x0x8202880)
odbc.c:3828:_SQLFreeEnv(0x8202880)
-
[freetds] BUG? SQL_LONGVARCHAR parameter fails with long data,
James K. Lowden, 07/24/2008
- Re: [freetds] BUG? SQL_LONGVARCHAR parameter fails with long data, James K. Lowden, 07/28/2008
Archive powered by MHonArc 2.6.24.