samuel.ferencik
2014-02-05 19:14:51 UTC
Hi,
Here's a patch for ctlib/cs.c:
--- src\src\ctlib\cs#1.c 2014-02-05 20:04:52.000000000 +-0100
+++ src\src\ctlib\cs.c 2014-02-05 19:47:01.000000000 +-0100
@@ -566,13 +566,13 @@
destdata = destvc->str;
}
tdsdump_log(TDS_DBG_FUNC, "converting type %d (%d bytes) to type = %d (%d bytes)\n",
src_type, src_len, desttype, destlen);
- if (!is_fixed_type(desttype) && (destlen <= 0)) {
+ if (!is_fixed_type(desttype) && !is_numeric_type(desttype) && (destlen <= 0)) {
return CS_FAIL;
}
dest = (unsigned char *) destdata;
/* many times we are asked to convert a data type to itself */
The change is in cs_convert(). When converting a string to SQL's numeric, the call sequence to_numeric() -> cs_convert() fails if destlen is unset. However, destlen is never needed for the conversion since the conversion is based on the precision & scale of the numeric type.
I came across this when analysing a test failure in Perl's DBD-Sybase test suite.
Any comments? Can I/should I make a merge request on gitorious?
Thanks,
Sam
_______________________________________________
This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.
For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.
_______________________________________________
Here's a patch for ctlib/cs.c:
--- src\src\ctlib\cs#1.c 2014-02-05 20:04:52.000000000 +-0100
+++ src\src\ctlib\cs.c 2014-02-05 19:47:01.000000000 +-0100
@@ -566,13 +566,13 @@
destdata = destvc->str;
}
tdsdump_log(TDS_DBG_FUNC, "converting type %d (%d bytes) to type = %d (%d bytes)\n",
src_type, src_len, desttype, destlen);
- if (!is_fixed_type(desttype) && (destlen <= 0)) {
+ if (!is_fixed_type(desttype) && !is_numeric_type(desttype) && (destlen <= 0)) {
return CS_FAIL;
}
dest = (unsigned char *) destdata;
/* many times we are asked to convert a data type to itself */
The change is in cs_convert(). When converting a string to SQL's numeric, the call sequence to_numeric() -> cs_convert() fails if destlen is unset. However, destlen is never needed for the conversion since the conversion is based on the precision & scale of the numeric type.
I came across this when analysing a test failure in Perl's DBD-Sybase test suite.
Any comments? Can I/should I make a merge request on gitorious?
Thanks,
Sam
_______________________________________________
This message is for information purposes only, it is not a recommendation, advice, offer or solicitation to buy or sell a product or service nor an official confirmation of any transaction. It is directed at persons who are professionals and is not intended for retail customer use. Intended for recipient only. This message is subject to the terms at: www.barclays.com/emaildisclaimer.
For important disclosures, please see: www.barclays.com/salesandtradingdisclaimer regarding market commentary from Barclays Sales and/or Trading, who are active market participants; and in respect of Barclays Research, including disclosures relating to specific issuers, please see http://publicresearch.barclays.com.
_______________________________________________