Commit 8721d20f authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix MDEV-7879 by adding a test in all SetValue_pval function to return when valp == this.

- Fix MDEV-7840 by making proper datetime constant in ha_connect::CheckCond on a second place.
parent daa8b6b5
......@@ -2714,7 +2714,12 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, AMT tty, Item *cond)
case MYSQL_TYPE_DATETIME:
if (tty == TYPE_AM_ODBC) {
strcat(body, "{ts '");
strcat(strncat(body, res->ptr(), res->length()), "'}");
strncat(body, res->ptr(), res->length());
if (res->length() < 19)
strcat(body, "1970-01-01 00:00:00" + res->length());
strcat(body, "'}");
break;
} // endif ODBC
......
......@@ -627,13 +627,16 @@ int TYPVAL<double>::GetValLen(void)
template <class TYPE>
bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype)
{
if (chktype && Type != valp->GetType())
return true;
if (valp != this) {
if (chktype && Type != valp->GetType())
return true;
if (!(Null = valp->IsNull() && Nullable))
Tval = GetTypedValue(valp);
else
Reset();
if (!(Null = valp->IsNull() && Nullable))
Tval = GetTypedValue(valp);
else
Reset();
} // endif valp
return false;
} // end of SetValue
......@@ -1319,15 +1322,18 @@ ulonglong TYPVAL<PSZ>::GetUBigintValue(void)
/***********************************************************************/
bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
{
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
return true;
if (valp != this) {
if (chktype && (valp->GetType() != Type || valp->GetSize() > Len))
return true;
char buf[64];
char buf[64];
if (!(Null = valp->IsNull() && Nullable))
strncpy(Strp, valp->GetCharString(buf), Len);
else
Reset();
if (!(Null = valp->IsNull() && Nullable))
strncpy(Strp, valp->GetCharString(buf), Len);
else
Reset();
} // endif valp
return false;
} // end of SetValue_pval
......@@ -2063,18 +2069,21 @@ double BINVAL::GetFloatValue(void)
/***********************************************************************/
bool BINVAL::SetValue_pval(PVAL valp, bool chktype)
{
if (chktype && (valp->GetType() != Type || valp->GetSize() > Clen))
return true;
bool rc = false;
if (!(Null = valp->IsNull() && Nullable)) {
if ((rc = (Len = valp->GetSize()) > Clen))
Len = Clen;
if (valp != this) {
if (chktype && (valp->GetType() != Type || valp->GetSize() > Clen))
return true;
memcpy(Binp, valp->GetTo_Val(), Len);
} else
Reset();
if (!(Null = valp->IsNull() && Nullable)) {
if ((rc = (Len = valp->GetSize()) > Clen))
Len = Clen;
memcpy(Binp, valp->GetTo_Val(), Len);
} else
Reset();
} // endif valp
return rc;
} // end of SetValue_pval
......@@ -2629,21 +2638,24 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval)
/***********************************************************************/
bool DTVAL::SetValue_pval(PVAL valp, bool chktype)
{
if (chktype && Type != valp->GetType())
return true;
if (valp != this) {
if (chktype && Type != valp->GetType())
return true;
if (!(Null = valp->IsNull() && Nullable)) {
if (Pdtp && !valp->IsTypeNum()) {
int ndv;
int dval[6];
if (!(Null = valp->IsNull() && Nullable)) {
if (Pdtp && !valp->IsTypeNum()) {
int ndv;
int dval[6];
ndv = ExtractDate(valp->GetCharValue(), Pdtp, DefYear, dval);
MakeDate(NULL, dval, ndv);
} else
Tval = valp->GetIntValue();
ndv = ExtractDate(valp->GetCharValue(), Pdtp, DefYear, dval);
MakeDate(NULL, dval, ndv);
} else
Tval = valp->GetIntValue();
Reset();
} else
Reset();
} // endif valp
return false;
} // end of SetValue
......
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