Author: mjevans
Date: Wed Nov 25 09:05:29 2009
New Revision: 13608
Modified:
dbi/trunk/DBI.xs
Log:
In sql_type_case_svpv:
the wrong flags argument is checked after calling grok_number. This means
numerics don't work
if none of the grok_number tests apply don't set cast_ok dependent on
whether we are doing DBIstcg_STRICT because this is handled at the end
causes wrong return for numerics which cannot be cast
Modified: dbi/trunk/DBI.xs
==============================================================================
--- dbi/trunk/DBI.xs (original)
+++ dbi/trunk/DBI.xs Wed Nov 25 09:05:29 2009
@@ -1772,20 +1772,20 @@
uv = 0;
grok_flags = grok_number(SvPVX(sv), SvCUR(sv), &uv);
cast_ok = 1;
- if (flags == IS_NUMBER_IN_UV) { /* +ve int */
+ if (grok_flags == IS_NUMBER_IN_UV) { /* +ve int */
if (uv <= IV_MAX) /* prefer IV over UV */
sv_2iv(sv);
else sv_2uv(sv);
}
- else if (flags == (IS_NUMBER_IN_UV | IS_NUMBER_NEG)
+ else if (grok_flags == (IS_NUMBER_IN_UV | IS_NUMBER_NEG)
&& uv <= IV_MAX
) {
sv_2iv(sv);
}
- else if (flags) { /* is numeric */
+ else if (grok_flags) { /* is numeric */
sv_2nv(sv);
}
- else if (flags & DBIstcf_STRICT)
+ else
cast_ok = 0;
break;