From f53ad74cd1f307c368b0ccd114278a4beaec8b6e Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 28 Nov 2013 01:25:39 +0100 Subject: [PATCH] - Fix some wrong changes preparing for unsigned data types modified: storage/connect/ha_connect.cc storage/connect/value.cpp - Fix the way GetPlug works (was not updating xp) modified: storage/connect/ha_connect.cc --- storage/connect/ha_connect.cc | 7 ++++--- storage/connect/value.cpp | 28 ++++++++++++++++------------ 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 414a4ee3443..3232d12af27 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -183,7 +183,7 @@ ulong ha_connect::num= 0; //int DTVAL::Shift= 0; static PCONNECT GetUser(THD *thd, PCONNECT xp); -static PGLOBAL GetPlug(THD *thd, PCONNECT lxp); +static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp); static handler *connect_create_handler(handlerton *hton, TABLE_SHARE *table, @@ -556,7 +556,7 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp) /****************************************************************************/ /* Get the global pointer of the user of this handler. */ /****************************************************************************/ -static PGLOBAL GetPlug(THD *thd, PCONNECT lxp) +static PGLOBAL GetPlug(THD *thd, PCONNECT& lxp) { lxp= GetUser(thd, lxp); return (lxp) ? lxp->g : NULL; @@ -3822,7 +3822,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, TABTYPE ttp= TAB_UNDEF; PQRYRES qrp= NULL; PCOLRES crp; - PGLOBAL g= GetPlug(thd, NULL); + PCONNECT xp= NULL; + PGLOBAL g= GetPlug(thd, xp); PTOS topt= table_s->option_struct; #if defined(NEW_WAY) //CHARSET_INFO *cs; diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index 3a10a04aa1a..077df346459 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -296,7 +296,7 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type) valp = new(g) TYPVAL(*(longlong*)value, TYPE_BIGINT); break; case TYPE_FLOAT: - valp = new(g) TYPVAL(*(double *)value, TYPE_FLOAT); + valp = new(g) TYPVAL(*(double *)value, TYPE_FLOAT, 2); break; case TYPE_TINY: valp = new(g) TYPVAL(*(char *)value, TYPE_TINY); @@ -326,31 +326,31 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, PSZ fmt) break; case TYPE_INT: if (prec) - valp = new(g) TYPVAL((uint)0, TYPE_INT, true); + valp = new(g) TYPVAL((uint)0, TYPE_INT, 0, true); else valp = new(g) TYPVAL((int)0, TYPE_INT); break; case TYPE_BIGINT: if (prec) - valp = new(g) TYPVAL((ulonglong)0, TYPE_BIGINT, true); + valp = new(g) TYPVAL((ulonglong)0, TYPE_BIGINT, 0, true); else valp = new(g) TYPVAL((longlong)0, TYPE_BIGINT); break; case TYPE_SHORT: if (prec) - valp = new(g) TYPVAL((ushort)0, TYPE_SHORT, true); + valp = new(g) TYPVAL((ushort)0, TYPE_SHORT, 0, true); else valp = new(g) TYPVAL((short)0, TYPE_SHORT); break; case TYPE_FLOAT: - valp = new(g) TYPVAL(0.0, prec, TYPE_FLOAT); + valp = new(g) TYPVAL(0.0, TYPE_FLOAT, prec); break; case TYPE_TINY: if (prec) - valp = new(g) TYPVAL((uchar)0, TYPE_TINY, true); + valp = new(g) TYPVAL((uchar)0, TYPE_TINY, 0, true); else valp = new(g) TYPVAL((char)0, TYPE_TINY); @@ -387,21 +387,23 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) break; case TYPE_SHORT: if (un) - valp = new(g) TYPVAL(valp->GetUShortValue(), TYPE_SHORT, true); + valp = new(g) TYPVAL(valp->GetUShortValue(), + TYPE_SHORT, 0, true); else valp = new(g) TYPVAL(valp->GetShortValue(), TYPE_SHORT); break; case TYPE_INT: if (un) - valp = new(g) TYPVAL(valp->GetUIntValue(), TYPE_INT, true); + valp = new(g) TYPVAL(valp->GetUIntValue(), TYPE_INT, 0, true); else valp = new(g) TYPVAL(valp->GetIntValue(), TYPE_INT); break; case TYPE_BIGINT: if (un) - valp = new(g) TYPVAL(valp->GetUBigintValue(), TYPE_BIGINT, true); + valp = new(g) TYPVAL(valp->GetUBigintValue(), + TYPE_BIGINT, 0, true); else valp = new(g) TYPVAL(valp->GetBigintValue(), TYPE_BIGINT); @@ -410,11 +412,13 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) valp = new(g) DTVAL(g, valp->GetIntValue()); break; case TYPE_FLOAT: - valp = new(g) TYPVAL(valp->GetFloatValue(), TYPE_FLOAT); + valp = new(g) TYPVAL(valp->GetFloatValue(), TYPE_FLOAT, + valp->GetValPrec()); break; case TYPE_TINY: if (un) - valp = new(g) TYPVAL(valp->GetUTinyValue(), TYPE_TINY, true); + valp = new(g) TYPVAL(valp->GetUTinyValue(), + TYPE_TINY, 0, true); else valp = new(g) TYPVAL(valp->GetTinyValue(), TYPE_TINY); @@ -582,7 +586,7 @@ void TYPVAL::SetValue_char(char *p, int n) } // endswitch *p if (minus && Tval) - Tval = - (signed)Tval; + Tval = (-(signed)Tval) ? -(signed)Tval : Tval; if (trace > 1) htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"),