mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Fix MDEV-6802 in a clean way.
Add an union in the PARM structure to contain int values Use a cast to ptrdiff_t in MAPFAM/MXPFAM::InitDelete required by some compilers modified: storage/connect/array.cpp storage/connect/filamap.cpp storage/connect/filamtxt.cpp storage/connect/global.h - Suppress some GCC warnings modified: storage/connect/array.cpp storage/connect/filter.cpp storage/connect/tabdos.cpp storage/connect/tabmysql.cpp storage/connect/value.cpp
This commit is contained in:
@@ -130,7 +130,7 @@ PARRAY MakeValueArray(PGLOBAL g, PPARM pp)
|
|||||||
break;
|
break;
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
// Integer stored inside pp->Value
|
// Integer stored inside pp->Value
|
||||||
par->AddValue(g, (int)(uintptr_t)parmp->Value);
|
par->AddValue(g, parmp->Intval);
|
||||||
break;
|
break;
|
||||||
} // endswitch valtyp
|
} // endswitch valtyp
|
||||||
|
|
||||||
@@ -609,13 +609,13 @@ int ARRAY::Convert(PGLOBAL g, int k, PVAL vp)
|
|||||||
|
|
||||||
Size = Nval;
|
Size = Nval;
|
||||||
Nval = 0;
|
Nval = 0;
|
||||||
Vblp = Valblk->Allocate(g, Type, Len, 0, Size);
|
Vblp = Valblk->Allocate(g, Type, Len, prec, Size);
|
||||||
|
|
||||||
if (!Valblk->GetMemp())
|
if (!Valblk->GetMemp())
|
||||||
// The error message was built by PlgDBalloc
|
// The error message was built by PlgDBalloc
|
||||||
return TYPE_ERROR;
|
return TYPE_ERROR;
|
||||||
else
|
else
|
||||||
Value = AllocateValue(g, Type, Len, 0, NULL);
|
Value = AllocateValue(g, Type, Len, prec, NULL);
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
/* Converting STRING to DATE can be done according to date format. */
|
/* Converting STRING to DATE can be done according to date format. */
|
||||||
|
@@ -30,7 +30,6 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif // !UNIX
|
#endif // !UNIX
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdint.h> // for uintprt_h
|
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
@@ -291,8 +290,8 @@ bool MAPFAM::RecordPos(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MAPFAM::InitDelete(PGLOBAL g, int fpos, int spos)
|
int MAPFAM::InitDelete(PGLOBAL g, int fpos, int spos)
|
||||||
{
|
{
|
||||||
Fpos = Memory + (uintptr_t)fpos;
|
Fpos = Memory + (ptrdiff_t)fpos;
|
||||||
Mempos = Memory + (uintptr_t)spos;
|
Mempos = Memory + (ptrdiff_t)spos;
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
} // end of InitDelete
|
} // end of InitDelete
|
||||||
|
|
||||||
@@ -686,7 +685,7 @@ bool MPXFAM::SetPos(PGLOBAL g, int pos)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int MPXFAM::InitDelete(PGLOBAL g, int fpos, int spos)
|
int MPXFAM::InitDelete(PGLOBAL g, int fpos, int spos)
|
||||||
{
|
{
|
||||||
Fpos = Memory + Headlen + (uintptr_t)fpos * Lrecl;
|
Fpos = Memory + Headlen + (ptrdiff_t)fpos * Lrecl;
|
||||||
Mempos = Fpos + Lrecl;
|
Mempos = Fpos + Lrecl;
|
||||||
return RC_OK;
|
return RC_OK;
|
||||||
} // end of InitDelete
|
} // end of InitDelete
|
||||||
|
@@ -287,7 +287,7 @@ bool TXTFAM::AddListValue(PGLOBAL g, int type, void *val, PPARM *top)
|
|||||||
// *((int*)pp->Value) = *((int*)val);
|
// *((int*)pp->Value) = *((int*)val);
|
||||||
// break;
|
// break;
|
||||||
case TYPE_VOID:
|
case TYPE_VOID:
|
||||||
pp->Value = (void*)*(int*)val;
|
pp->Intval = *(int*)val;
|
||||||
break;
|
break;
|
||||||
// case TYPE_STRING:
|
// case TYPE_STRING:
|
||||||
// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
|
// pp->Value = PlugSubAlloc(g, NULL, strlen((char*)val) + 1);
|
||||||
|
@@ -63,7 +63,7 @@ static PPARM MakeParm(PGLOBAL g, PXOB xp)
|
|||||||
} // end of MakeParm
|
} // end of MakeParm
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Routines called externally by FILTER function. */
|
/* Routines called internally/externally by FILTER functions. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
|
bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
|
||||||
//bool ReadSubQuery(PGLOBAL, PSUBQ);
|
//bool ReadSubQuery(PGLOBAL, PSUBQ);
|
||||||
@@ -72,6 +72,32 @@ bool PlugEvalLike(PGLOBAL, LPCSTR, LPCSTR, bool);
|
|||||||
BYTE OpBmp(PGLOBAL g, OPVAL opc);
|
BYTE OpBmp(PGLOBAL g, OPVAL opc);
|
||||||
PARRAY MakeValueArray(PGLOBAL g, PPARM pp);
|
PARRAY MakeValueArray(PGLOBAL g, PPARM pp);
|
||||||
|
|
||||||
|
/***********************************************************************/
|
||||||
|
/* Returns the bitmap representing the conditions that must not be */
|
||||||
|
/* met when returning from TestValue for a given operator. */
|
||||||
|
/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */
|
||||||
|
/***********************************************************************/
|
||||||
|
BYTE OpBmp(PGLOBAL g, OPVAL opc)
|
||||||
|
{
|
||||||
|
BYTE bt;
|
||||||
|
|
||||||
|
switch (opc) {
|
||||||
|
case OP_IN:
|
||||||
|
case OP_EQ: bt = 0x06; break;
|
||||||
|
case OP_NE: bt = 0x01; break;
|
||||||
|
case OP_GT: bt = 0x03; break;
|
||||||
|
case OP_GE: bt = 0x02; break;
|
||||||
|
case OP_LT: bt = 0x05; break;
|
||||||
|
case OP_LE: bt = 0x04; break;
|
||||||
|
case OP_EXIST: bt = 0x00; break;
|
||||||
|
default:
|
||||||
|
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
||||||
|
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
||||||
|
} // endswitch opc
|
||||||
|
|
||||||
|
return bt;
|
||||||
|
} // end of OpBmp
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Routines called externally by CondFilter. */
|
/* Routines called externally by CondFilter. */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -205,7 +205,10 @@ typedef struct _activity { /* Describes activity and language */
|
|||||||
|
|
||||||
/*---------------- UNIT ?????????? VERSION ? ----------------------*/
|
/*---------------- UNIT ?????????? VERSION ? ----------------------*/
|
||||||
typedef struct _parm {
|
typedef struct _parm {
|
||||||
|
union {
|
||||||
void *Value;
|
void *Value;
|
||||||
|
int Intval;
|
||||||
|
}; // end union
|
||||||
short Type, Domain;
|
short Type, Domain;
|
||||||
PPARM Next;
|
PPARM Next;
|
||||||
} PARM;
|
} PARM;
|
||||||
|
@@ -322,7 +322,7 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode)
|
|||||||
&& mode == MODE_UPDATE) &&
|
&& mode == MODE_UPDATE) &&
|
||||||
!(tmp == TMP_FORCE &&
|
!(tmp == TMP_FORCE &&
|
||||||
(mode == MODE_UPDATE || mode == MODE_DELETE));
|
(mode == MODE_UPDATE || mode == MODE_DELETE));
|
||||||
PTXF txfp;
|
PTXF txfp = NULL;
|
||||||
PTDBASE tdbp;
|
PTDBASE tdbp;
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@@ -574,7 +574,7 @@ int TDBDOS::ResetTableOpt(PGLOBAL g, bool dop, bool dox)
|
|||||||
int TDBDOS::MakeBlockValues(PGLOBAL g)
|
int TDBDOS::MakeBlockValues(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int i, lg, nrec, rc, n = 0;
|
int i, lg, nrec, rc, n = 0;
|
||||||
int curnum, curblk, block, last, savndv, savnbm;
|
int curnum, curblk, block, savndv, savnbm;
|
||||||
void *savmin, *savmax;
|
void *savmin, *savmax;
|
||||||
bool blocked, xdb2 = false;
|
bool blocked, xdb2 = false;
|
||||||
//POOLHEADER save;
|
//POOLHEADER save;
|
||||||
@@ -611,7 +611,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
|
|||||||
// to Rows+1 by unblocked variable length table access methods.
|
// to Rows+1 by unblocked variable length table access methods.
|
||||||
curblk = -1;
|
curblk = -1;
|
||||||
curnum = nrec - 1;
|
curnum = nrec - 1;
|
||||||
last = 0;
|
//last = 0;
|
||||||
Txfp->Block = block; // This is useful mainly for
|
Txfp->Block = block; // This is useful mainly for
|
||||||
Txfp->CurBlk = curblk; // blocked tables (ZLBFAM), for
|
Txfp->CurBlk = curblk; // blocked tables (ZLBFAM), for
|
||||||
Txfp->CurNum = curnum; // others it is just to be clean.
|
Txfp->CurNum = curnum; // others it is just to be clean.
|
||||||
@@ -742,7 +742,7 @@ int TDBDOS::MakeBlockValues(PGLOBAL g)
|
|||||||
Txfp->BlkPos[curblk] = Txfp->GetPos();
|
Txfp->BlkPos[curblk] = Txfp->GetPos();
|
||||||
} // endif CurNum
|
} // endif CurNum
|
||||||
|
|
||||||
last = curnum + 1; // curnum is zero based
|
// last = curnum + 1; // curnum is zero based
|
||||||
Txfp->CurBlk = curblk; // Used in COLDOS::SetMinMax
|
Txfp->CurBlk = curblk; // Used in COLDOS::SetMinMax
|
||||||
Txfp->CurNum = curnum; // Used in COLDOS::SetMinMax
|
Txfp->CurNum = curnum; // Used in COLDOS::SetMinMax
|
||||||
} // endif blocked
|
} // endif blocked
|
||||||
@@ -1351,7 +1351,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
|
|||||||
//int i, n1, n2, ctype = TYPE_ERROR, n = 0, type[2] = {0,0};
|
//int i, n1, n2, ctype = TYPE_ERROR, n = 0, type[2] = {0,0};
|
||||||
//bool conv = false, xdb2 = false, ok = false, b[2];
|
//bool conv = false, xdb2 = false, ok = false, b[2];
|
||||||
//PXOB *xarg1, *xarg2 = NULL, xp[2];
|
//PXOB *xarg1, *xarg2 = NULL, xp[2];
|
||||||
int i, ctype = TYPE_ERROR, n = 0, type[2] = {0,0};
|
int i, n = 0, type[2] = {0,0};
|
||||||
bool conv = false, xdb2 = false, ok = false;
|
bool conv = false, xdb2 = false, ok = false;
|
||||||
PXOB *xarg2 = NULL, xp[2];
|
PXOB *xarg2 = NULL, xp[2];
|
||||||
PCOL colp;
|
PCOL colp;
|
||||||
@@ -1363,7 +1363,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
|
|||||||
switch (arg[i]->GetType()) {
|
switch (arg[i]->GetType()) {
|
||||||
case TYPE_CONST:
|
case TYPE_CONST:
|
||||||
type[i] = 1;
|
type[i] = 1;
|
||||||
ctype = arg[i]->GetResultType();
|
// ctype = arg[i]->GetResultType();
|
||||||
break;
|
break;
|
||||||
case TYPE_COLBLK:
|
case TYPE_COLBLK:
|
||||||
conv = cnv[i];
|
conv = cnv[i];
|
||||||
@@ -1388,7 +1388,7 @@ PBF TDBDOS::CheckBlockFilari(PGLOBAL g, PXOB *arg, int op, bool *cnv)
|
|||||||
// correlated subquery, it has a constant value during
|
// correlated subquery, it has a constant value during
|
||||||
// each execution of the subquery.
|
// each execution of the subquery.
|
||||||
type[i] = 1;
|
type[i] = 1;
|
||||||
ctype = arg[i]->GetResultType();
|
// ctype = arg[i]->GetResultType();
|
||||||
} // endif this
|
} // endif this
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@@ -888,6 +888,7 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
|
|||||||
} else if (Mode == MODE_INSERT) {
|
} else if (Mode == MODE_INSERT) {
|
||||||
if (Srcdef) {
|
if (Srcdef) {
|
||||||
strcpy(g->Message, "No insert into anonym views");
|
strcpy(g->Message, "No insert into anonym views");
|
||||||
|
Myc.Close();
|
||||||
return true;
|
return true;
|
||||||
} // endif Srcdef
|
} // endif Srcdef
|
||||||
|
|
||||||
@@ -906,12 +907,12 @@ bool TDBMYSQL::OpenDB(PGLOBAL g)
|
|||||||
} // endif MakeInsert
|
} // endif MakeInsert
|
||||||
|
|
||||||
if (m_Rc != RC_FX) {
|
if (m_Rc != RC_FX) {
|
||||||
int rc;
|
|
||||||
char cmd[64];
|
char cmd[64];
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", Tabname);
|
sprintf(cmd, "ALTER TABLE `%s` DISABLE KEYS", Tabname);
|
||||||
rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines
|
|
||||||
|
m_Rc = Myc.ExecSQL(g, cmd, &w); // may fail for some engines
|
||||||
} // endif m_Rc
|
} // endif m_Rc
|
||||||
|
|
||||||
} else
|
} else
|
||||||
|
@@ -91,32 +91,6 @@ PSZ strlwr(PSZ s);
|
|||||||
}
|
}
|
||||||
#endif // !WIN32
|
#endif // !WIN32
|
||||||
|
|
||||||
/***********************************************************************/
|
|
||||||
/* Returns the bitmap representing the conditions that must not be */
|
|
||||||
/* met when returning from TestValue for a given operator. */
|
|
||||||
/* Bit one is EQ, bit 2 is LT, and bit 3 is GT. */
|
|
||||||
/***********************************************************************/
|
|
||||||
BYTE OpBmp(PGLOBAL g, OPVAL opc)
|
|
||||||
{
|
|
||||||
BYTE bt;
|
|
||||||
|
|
||||||
switch (opc) {
|
|
||||||
case OP_IN:
|
|
||||||
case OP_EQ: bt = 0x06; break;
|
|
||||||
case OP_NE: bt = 0x01; break;
|
|
||||||
case OP_GT: bt = 0x03; break;
|
|
||||||
case OP_GE: bt = 0x02; break;
|
|
||||||
case OP_LT: bt = 0x05; break;
|
|
||||||
case OP_LE: bt = 0x04; break;
|
|
||||||
case OP_EXIST: bt = 0x00; break;
|
|
||||||
default:
|
|
||||||
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
|
||||||
longjmp(g->jumper[g->jump_level], TYPE_ARRAY);
|
|
||||||
} // endswitch opc
|
|
||||||
|
|
||||||
return bt;
|
|
||||||
} // end of OpBmp
|
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
/* Get a long long number from its character representation. */
|
/* Get a long long number from its character representation. */
|
||||||
/* IN p: Pointer to the numeric string */
|
/* IN p: Pointer to the numeric string */
|
||||||
|
Reference in New Issue
Block a user