Subject: | failure converting to numeric |
exec.t has been failing with
cs_convert failed (to_numeric(3.2))
...
st execute failed: Server message number=8016 severity=16 state=52 line=1
server=LDNDCM05936V05B\LF4_MAIN2_DEV text=The incoming tabular data stream
(TDS) remote procedure call (RPC) protocol stream is incorrect. Parameter 3
("@three"): Data type 0x6C has an invalid data length or metadata length.
This is with FreeTDS 0.91.
I've debugged into it and found an issue which I reported to FreeTDS:
http://lists.ibiblio.org/pipermail/freetds/2014q1/028818.html. However, Frediano
pointed out [http://lists.ibiblio.org/pipermail/freetds/2014q1/028819.html] that
the documentation for cs_convert()
[http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.mainframeconnect_12.6.occprc/html/occprc/X12978.htm]
prescribes that destfmt.maxlen be equal to 35 for conversions to numeric. In
other words, it's DBD-Sybase who is in the wrong here, most likely.
In the end, Frediano is fixing this in FreeTDS itself
[http://lists.ibiblio.org/pipermail/freetds/2014q1/028822.html] but I believe
this still deserves a fix in DBD-Sybase as well - if only so that DBD-Sybase
works with FreeTDS 0.91 (Frediano's fix is only in the git repo, not released).
Here's a patch:
--- dbdimp#1.c 2014-02-10 10:15:13.000000000 +-0100
+++ dbdimp.c 2014-02-10 10:15:07.000000000 +-0100
@@ -5058,12 +5058,13 @@
}
}
}
}
}
}
+ datafmt->maxlength = 35;
if (cs_convert(context, &srcfmt, str, datafmt, &mn, &reslen) != CS_SUCCEED)
warn("cs_convert failed (to_numeric(%s))", str);
if (reslen == CS_UNUSED)
warn("conversion failed: to_numeric(%s)", str);