Commit f53ad74c authored by Olivier Bertrand's avatar Olivier Bertrand

- 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
parent 385dbaea
...@@ -183,7 +183,7 @@ ulong ha_connect::num= 0; ...@@ -183,7 +183,7 @@ ulong ha_connect::num= 0;
//int DTVAL::Shift= 0; //int DTVAL::Shift= 0;
static PCONNECT GetUser(THD *thd, PCONNECT xp); 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, static handler *connect_create_handler(handlerton *hton,
TABLE_SHARE *table, TABLE_SHARE *table,
...@@ -556,7 +556,7 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp) ...@@ -556,7 +556,7 @@ static PCONNECT GetUser(THD *thd, PCONNECT xp)
/****************************************************************************/ /****************************************************************************/
/* Get the global pointer of the user of this handler. */ /* 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); lxp= GetUser(thd, lxp);
return (lxp) ? lxp->g : NULL; return (lxp) ? lxp->g : NULL;
...@@ -3822,7 +3822,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -3822,7 +3822,8 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
TABTYPE ttp= TAB_UNDEF; TABTYPE ttp= TAB_UNDEF;
PQRYRES qrp= NULL; PQRYRES qrp= NULL;
PCOLRES crp; PCOLRES crp;
PGLOBAL g= GetPlug(thd, NULL); PCONNECT xp= NULL;
PGLOBAL g= GetPlug(thd, xp);
PTOS topt= table_s->option_struct; PTOS topt= table_s->option_struct;
#if defined(NEW_WAY) #if defined(NEW_WAY)
//CHARSET_INFO *cs; //CHARSET_INFO *cs;
......
...@@ -296,7 +296,7 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type) ...@@ -296,7 +296,7 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type)
valp = new(g) TYPVAL<longlong>(*(longlong*)value, TYPE_BIGINT); valp = new(g) TYPVAL<longlong>(*(longlong*)value, TYPE_BIGINT);
break; break;
case TYPE_FLOAT: case TYPE_FLOAT:
valp = new(g) TYPVAL<double>(*(double *)value, TYPE_FLOAT); valp = new(g) TYPVAL<double>(*(double *)value, TYPE_FLOAT, 2);
break; break;
case TYPE_TINY: case TYPE_TINY:
valp = new(g) TYPVAL<char>(*(char *)value, TYPE_TINY); valp = new(g) TYPVAL<char>(*(char *)value, TYPE_TINY);
...@@ -326,31 +326,31 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, PSZ fmt) ...@@ -326,31 +326,31 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, PSZ fmt)
break; break;
case TYPE_INT: case TYPE_INT:
if (prec) if (prec)
valp = new(g) TYPVAL<uint>((uint)0, TYPE_INT, true); valp = new(g) TYPVAL<uint>((uint)0, TYPE_INT, 0, true);
else else
valp = new(g) TYPVAL<int>((int)0, TYPE_INT); valp = new(g) TYPVAL<int>((int)0, TYPE_INT);
break; break;
case TYPE_BIGINT: case TYPE_BIGINT:
if (prec) if (prec)
valp = new(g) TYPVAL<ulonglong>((ulonglong)0, TYPE_BIGINT, true); valp = new(g) TYPVAL<ulonglong>((ulonglong)0, TYPE_BIGINT, 0, true);
else else
valp = new(g) TYPVAL<longlong>((longlong)0, TYPE_BIGINT); valp = new(g) TYPVAL<longlong>((longlong)0, TYPE_BIGINT);
break; break;
case TYPE_SHORT: case TYPE_SHORT:
if (prec) if (prec)
valp = new(g) TYPVAL<ushort>((ushort)0, TYPE_SHORT, true); valp = new(g) TYPVAL<ushort>((ushort)0, TYPE_SHORT, 0, true);
else else
valp = new(g) TYPVAL<short>((short)0, TYPE_SHORT); valp = new(g) TYPVAL<short>((short)0, TYPE_SHORT);
break; break;
case TYPE_FLOAT: case TYPE_FLOAT:
valp = new(g) TYPVAL<double>(0.0, prec, TYPE_FLOAT); valp = new(g) TYPVAL<double>(0.0, TYPE_FLOAT, prec);
break; break;
case TYPE_TINY: case TYPE_TINY:
if (prec) if (prec)
valp = new(g) TYPVAL<uchar>((uchar)0, TYPE_TINY, true); valp = new(g) TYPVAL<uchar>((uchar)0, TYPE_TINY, 0, true);
else else
valp = new(g) TYPVAL<char>((char)0, TYPE_TINY); valp = new(g) TYPVAL<char>((char)0, TYPE_TINY);
...@@ -387,21 +387,23 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) ...@@ -387,21 +387,23 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
break; break;
case TYPE_SHORT: case TYPE_SHORT:
if (un) if (un)
valp = new(g) TYPVAL<ushort>(valp->GetUShortValue(), TYPE_SHORT, true); valp = new(g) TYPVAL<ushort>(valp->GetUShortValue(),
TYPE_SHORT, 0, true);
else else
valp = new(g) TYPVAL<short>(valp->GetShortValue(), TYPE_SHORT); valp = new(g) TYPVAL<short>(valp->GetShortValue(), TYPE_SHORT);
break; break;
case TYPE_INT: case TYPE_INT:
if (un) if (un)
valp = new(g) TYPVAL<uint>(valp->GetUIntValue(), TYPE_INT, true); valp = new(g) TYPVAL<uint>(valp->GetUIntValue(), TYPE_INT, 0, true);
else else
valp = new(g) TYPVAL<int>(valp->GetIntValue(), TYPE_INT); valp = new(g) TYPVAL<int>(valp->GetIntValue(), TYPE_INT);
break; break;
case TYPE_BIGINT: case TYPE_BIGINT:
if (un) if (un)
valp = new(g) TYPVAL<ulonglong>(valp->GetUBigintValue(), TYPE_BIGINT, true); valp = new(g) TYPVAL<ulonglong>(valp->GetUBigintValue(),
TYPE_BIGINT, 0, true);
else else
valp = new(g) TYPVAL<longlong>(valp->GetBigintValue(), TYPE_BIGINT); valp = new(g) TYPVAL<longlong>(valp->GetBigintValue(), TYPE_BIGINT);
...@@ -410,11 +412,13 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) ...@@ -410,11 +412,13 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns)
valp = new(g) DTVAL(g, valp->GetIntValue()); valp = new(g) DTVAL(g, valp->GetIntValue());
break; break;
case TYPE_FLOAT: case TYPE_FLOAT:
valp = new(g) TYPVAL<double>(valp->GetFloatValue(), TYPE_FLOAT); valp = new(g) TYPVAL<double>(valp->GetFloatValue(), TYPE_FLOAT,
valp->GetValPrec());
break; break;
case TYPE_TINY: case TYPE_TINY:
if (un) if (un)
valp = new(g) TYPVAL<uchar>(valp->GetUTinyValue(), TYPE_TINY, true); valp = new(g) TYPVAL<uchar>(valp->GetUTinyValue(),
TYPE_TINY, 0, true);
else else
valp = new(g) TYPVAL<char>(valp->GetTinyValue(), TYPE_TINY); valp = new(g) TYPVAL<char>(valp->GetTinyValue(), TYPE_TINY);
...@@ -582,7 +586,7 @@ void TYPVAL<TYPE>::SetValue_char(char *p, int n) ...@@ -582,7 +586,7 @@ void TYPVAL<TYPE>::SetValue_char(char *p, int n)
} // endswitch *p } // endswitch *p
if (minus && Tval) if (minus && Tval)
Tval = - (signed)Tval; Tval = (-(signed)Tval) ? -(signed)Tval : Tval;
if (trace > 1) if (trace > 1)
htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"), htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment