mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
Fix unhandled exception:
Force type int for ENUMs. Replace remaining longjmp. modified: storage/connect/array.cpp modified: storage/connect/colblk.cpp modified: storage/connect/connect.cc modified: storage/connect/filter.cpp modified: storage/connect/jdbconn.cpp modified: storage/connect/plgdbutl.cpp modified: storage/connect/tabdos.cpp modified: storage/connect/tabvir.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/value.cpp modified: storage/connect/xobject.cpp
This commit is contained in:
parent
f3452fcd84
commit
c51548d6b4
12 changed files with 45 additions and 45 deletions
|
@ -519,7 +519,7 @@ bool ARRAY::FilTest(PGLOBAL g, PVAL valp, OPVAL opc, int opm)
|
|||
|
||||
} else if (opc != OP_EXIST) {
|
||||
sprintf(g->Message, MSG(MISSING_ARG), opc);
|
||||
throw TYPE_ARRAY;
|
||||
throw (int)TYPE_ARRAY;
|
||||
} else // OP_EXIST
|
||||
return Nval > 0;
|
||||
|
||||
|
@ -681,14 +681,14 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
|
|||
{
|
||||
if (Vblp == NULL) {
|
||||
strcpy(g->Message, MSG(PREC_VBLP_NULL));
|
||||
throw TYPE_ARRAY;
|
||||
throw (int)TYPE_ARRAY;
|
||||
} // endif Vblp
|
||||
|
||||
bool was = Vblp->IsCi();
|
||||
|
||||
if (was && !p) {
|
||||
strcpy(g->Message, MSG(BAD_SET_CASE));
|
||||
throw TYPE_ARRAY;
|
||||
throw (int)TYPE_ARRAY;
|
||||
} // endif Vblp
|
||||
|
||||
if (was || !p)
|
||||
|
@ -699,7 +699,7 @@ void ARRAY::SetPrecision(PGLOBAL g, int p)
|
|||
if (!was && Type == TYPE_STRING)
|
||||
// Must be resorted to eliminate duplicate strings
|
||||
if (Sort(g))
|
||||
throw TYPE_ARRAY;
|
||||
throw (int)TYPE_ARRAY;
|
||||
|
||||
} // end of SetPrecision
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ int COLBLK::GetLengthEx(void)
|
|||
void COLBLK::ReadColumn(PGLOBAL g)
|
||||
{
|
||||
sprintf(g->Message, MSG(UNDEFINED_AM), "ReadColumn");
|
||||
throw TYPE_COLBLK;
|
||||
throw (int)TYPE_COLBLK;
|
||||
} // end of ReadColumn
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -208,7 +208,7 @@ void COLBLK::ReadColumn(PGLOBAL g)
|
|||
void COLBLK::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
sprintf(g->Message, MSG(UNDEFINED_AM), "WriteColumn");
|
||||
throw TYPE_COLBLK;
|
||||
throw (int)TYPE_COLBLK;
|
||||
} // end of WriteColumn
|
||||
|
||||
/***********************************************************************/
|
||||
|
@ -262,7 +262,7 @@ SPCBLK::SPCBLK(PCOLUMN cp)
|
|||
void SPCBLK::WriteColumn(PGLOBAL g)
|
||||
{
|
||||
sprintf(g->Message, MSG(SPCOL_READONLY), Name);
|
||||
throw TYPE_COLBLK;
|
||||
throw (int)TYPE_COLBLK;
|
||||
} // end of WriteColumn
|
||||
|
||||
/***********************************************************************/
|
||||
|
|
|
@ -188,7 +188,7 @@ PTDB CntGetTDB(PGLOBAL g, LPCSTR name, MODE mode, PHC h)
|
|||
PTDB tdbp;
|
||||
PTABLE tabp;
|
||||
PDBUSER dup = PlgGetUser(g);
|
||||
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over longjmp
|
||||
volatile PCATLG cat = (dup) ? dup->Catalog : NULL; // Safe over throw
|
||||
|
||||
if (trace)
|
||||
printf("CntGetTDB: name=%s mode=%d cat=%p\n", name, mode, cat);
|
||||
|
|
|
@ -94,7 +94,7 @@ BYTE OpBmp(PGLOBAL g, OPVAL opc)
|
|||
case OP_EXIST: bt = 0x00; break;
|
||||
default:
|
||||
sprintf(g->Message, MSG(BAD_FILTER_OP), opc);
|
||||
throw TYPE_ARRAY;
|
||||
throw (int)TYPE_ARRAY;
|
||||
} // endswitch opc
|
||||
|
||||
return bt;
|
||||
|
@ -1804,7 +1804,7 @@ PFIL PrepareFilter(PGLOBAL g, PFIL fp, bool having)
|
|||
break; // Remove eventual ending separator(s)
|
||||
|
||||
// if (fp->Convert(g, having))
|
||||
// throw TYPE_ARRAY;
|
||||
// (int)throw TYPE_ARRAY;
|
||||
|
||||
filp = fp;
|
||||
fp = fp->Next;
|
||||
|
@ -1837,7 +1837,7 @@ DllExport bool ApplyFilter(PGLOBAL g, PFIL filp)
|
|||
// return TRUE;
|
||||
|
||||
if (filp->Eval(g))
|
||||
throw TYPE_FILTER;
|
||||
throw (int)TYPE_FILTER;
|
||||
|
||||
if (trace > 1)
|
||||
htrc("PlugFilter filp=%p result=%d\n",
|
||||
|
|
|
@ -1215,7 +1215,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||
if (rank == 0)
|
||||
if (!name || (jn = env->NewStringUTF(name)) == nullptr) {
|
||||
sprintf(g->Message, "Fail to allocate jstring %s", SVP(name));
|
||||
throw TYPE_AM_JDBC;
|
||||
throw (int)TYPE_AM_JDBC;
|
||||
} // endif name
|
||||
|
||||
// Returns 666 is case of error
|
||||
|
@ -1223,7 +1223,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||
|
||||
if (Check((ctyp == 666) ? -1 : 1)) {
|
||||
sprintf(g->Message, "Getting ctyp: %s", Msg);
|
||||
throw TYPE_AM_JDBC;
|
||||
throw (int)TYPE_AM_JDBC;
|
||||
} // endif Check
|
||||
|
||||
if (val->GetNullable())
|
||||
|
@ -1334,7 +1334,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val)
|
|||
env->DeleteLocalRef(jn);
|
||||
|
||||
sprintf(g->Message, "SetColumnValue: %s rank=%d ctyp=%d", Msg, rank, (int)ctyp);
|
||||
throw TYPE_AM_JDBC;
|
||||
throw (int)TYPE_AM_JDBC;
|
||||
} // endif Check
|
||||
|
||||
if (rank == 0)
|
||||
|
|
|
@ -473,7 +473,7 @@ bool PlugEvalLike(PGLOBAL g, LPCSTR strg, LPCSTR pat, bool ci)
|
|||
tp = g->Message;
|
||||
else if (!(tp = new char[strlen(pat) + strlen(strg) + 2])) {
|
||||
strcpy(g->Message, MSG(NEW_RETURN_NULL));
|
||||
throw OP_LIKE;
|
||||
throw (int)OP_LIKE;
|
||||
} /* endif tp */
|
||||
|
||||
sp = tp + strlen(pat) + 1;
|
||||
|
@ -484,7 +484,7 @@ bool PlugEvalLike(PGLOBAL g, LPCSTR strg, LPCSTR pat, bool ci)
|
|||
tp = g->Message; /* Use this as temporary work space. */
|
||||
else if (!(tp = new char[strlen(pat) + 1])) {
|
||||
strcpy(g->Message, MSG(NEW_RETURN_NULL));
|
||||
throw OP_LIKE;
|
||||
throw (int)OP_LIKE;
|
||||
} /* endif tp */
|
||||
|
||||
strcpy(tp, pat); /* Make a copy to be worked into */
|
||||
|
|
|
@ -2736,7 +2736,7 @@ void DOSCOL::WriteColumn(PGLOBAL g)
|
|||
if (Value->GetBinValue(p, Long, Status)) {
|
||||
sprintf(g->Message, MSG(BIN_F_TOO_LONG),
|
||||
Name, Value->GetSize(), Long);
|
||||
longjmp(g->jumper[g->jump_level], 31);
|
||||
throw 31;
|
||||
} // endif
|
||||
|
||||
} // end of WriteColumn
|
||||
|
|
|
@ -1265,7 +1265,7 @@ char *MGOCOL::Mini(PGLOBAL g, const bson_t *bson, bool b)
|
|||
|
||||
if (i >= Long) {
|
||||
sprintf(g->Message, "Value too long for column %s", Name);
|
||||
throw(TYPE_AM_MGO);
|
||||
throw (int)TYPE_AM_MGO;
|
||||
} // endif i
|
||||
|
||||
Mbuf[k] = 0;
|
||||
|
@ -1351,7 +1351,7 @@ void MGOCOL::ReadColumn(PGLOBAL g)
|
|||
bson_destroy(doc);
|
||||
} else {
|
||||
//strcpy(g->Message, "bson_iter_array failed (data is null)");
|
||||
//throw(TYPE_AM_MGO);
|
||||
//throw (int)TYPE_AM_MGO;
|
||||
Value->Reset();
|
||||
} // endif data
|
||||
|
||||
|
|
|
@ -289,7 +289,7 @@ void VIRCOL::ReadColumn(PGLOBAL g)
|
|||
{
|
||||
// This should never be called
|
||||
sprintf(g->Message, "ReadColumn: Column %s is not virtual", Name);
|
||||
throw TYPE_COLBLK;
|
||||
throw (int)TYPE_COLBLK;
|
||||
} // end of ReadColumn
|
||||
|
||||
/* ---------------------------TDBVICL class -------------------------- */
|
||||
|
|
|
@ -1319,7 +1319,7 @@ void TDBXML::CloseDB(PGLOBAL g)
|
|||
Docp->CloseDoc(g, To_Xb);
|
||||
|
||||
// This causes a crash in Diagnostics_area::set_error_status
|
||||
// throw TYPE_AM_XML;
|
||||
// throw (int)TYPE_AM_XML;
|
||||
} // endif DumpDoc
|
||||
|
||||
} // endif Changed
|
||||
|
@ -1642,7 +1642,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
|
|||
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
||||
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
||||
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif type
|
||||
|
||||
// Get the Xname value from the XML file
|
||||
|
@ -1653,7 +1653,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
|
|||
PushWarning(g, Tdbp);
|
||||
break;
|
||||
default:
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endswitch
|
||||
|
||||
Value->SetValue_psz(Valbuf);
|
||||
|
@ -1704,7 +1704,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||
/* For columns having an Xpath, the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, Nod || Tdbp->Colname))
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
|
||||
/*********************************************************************/
|
||||
/* Null values are represented by no node. */
|
||||
|
@ -1776,7 +1776,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (ColNode == NULL) {
|
||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif ColNode
|
||||
|
||||
} // endif ColNode
|
||||
|
@ -1795,7 +1795,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (ValNode == NULL && AttNode == NULL) {
|
||||
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif ValNode
|
||||
|
||||
/*********************************************************************/
|
||||
|
@ -1805,7 +1805,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
|
@ -1855,7 +1855,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
|
|||
if (ValNode->GetType() != XML_ELEMENT_NODE &&
|
||||
ValNode->GetType() != XML_ATTRIBUTE_NODE) {
|
||||
sprintf(g->Message, MSG(BAD_VALNODE), ValNode->GetType(), Name);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif type
|
||||
|
||||
// Get the Xname value from the XML file
|
||||
|
@ -1866,7 +1866,7 @@ void XMULCOL::ReadColumn(PGLOBAL g)
|
|||
PushWarning(g, Tdbp);
|
||||
break;
|
||||
default:
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endswitch
|
||||
|
||||
if (!b) {
|
||||
|
@ -1941,7 +1941,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||
/* For columns having an Xpath, the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, Nod))
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
|
||||
/*********************************************************************/
|
||||
/* Find the column and value nodes to update or insert. */
|
||||
|
@ -1990,7 +1990,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (len > 1 && !Tdbp->Xpand) {
|
||||
sprintf(g->Message, MSG(BAD_VAL_UPDATE), Name);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} else
|
||||
ValNode = Nlx->GetItem(g, Tdbp->Nsub, Vxnp);
|
||||
|
||||
|
@ -2032,7 +2032,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (ColNode == NULL) {
|
||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif ColNode
|
||||
|
||||
} // endif ColNode
|
||||
|
@ -2051,8 +2051,8 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (ValNode == NULL && AttNode == NULL) {
|
||||
strcpy(g->Message, MSG(VAL_ALLOC_ERR));
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
} // endif ValNode
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif ValNode
|
||||
|
||||
/*********************************************************************/
|
||||
/* Get the string representation of Value according to column type. */
|
||||
|
@ -2061,7 +2061,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
|
@ -2093,7 +2093,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
|
|||
|
||||
if (Tdbp->Clist == NULL) {
|
||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif Clist
|
||||
|
||||
if ((ValNode = Tdbp->Clist->GetItem(g, Rank, Vxnp))) {
|
||||
|
@ -2105,7 +2105,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
|
|||
PushWarning(g, Tdbp);
|
||||
break;
|
||||
default:
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endswitch
|
||||
|
||||
Value->SetValue_psz(Valbuf);
|
||||
|
@ -2156,14 +2156,14 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
|||
/* For all columns the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, true))
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
|
||||
/*********************************************************************/
|
||||
/* Find the column and value nodes to update or insert. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->Clist == NULL) {
|
||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} // endif Clist
|
||||
|
||||
n = Tdbp->Clist->GetLength();
|
||||
|
@ -2188,7 +2188,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
|||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
throw TYPE_AM_XML;
|
||||
throw (int)TYPE_AM_XML;
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
|
|
|
@ -1451,7 +1451,7 @@ void TYPVAL<PSZ>::SetValue(uint n)
|
|||
|
||||
if (k > Len) {
|
||||
sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len);
|
||||
longjmp(g->jumper[g->jump_level], 138);
|
||||
throw 138;
|
||||
} else
|
||||
SetValue_psz(buf);
|
||||
|
||||
|
@ -1505,7 +1505,7 @@ void TYPVAL<PSZ>::SetValue(ulonglong n)
|
|||
|
||||
if (k > Len) {
|
||||
sprintf(g->Message, MSG(VALSTR_TOO_LONG), buf, Len);
|
||||
longjmp(g->jumper[g->jump_level], 138);
|
||||
throw 138;
|
||||
} else
|
||||
SetValue_psz(buf);
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ double XOBJECT::GetFloatValue(void)
|
|||
CONSTANT::CONSTANT(PGLOBAL g, void *value, short type)
|
||||
{
|
||||
if (!(Value = AllocateValue(g, value, (int)type)))
|
||||
throw TYPE_CONST;
|
||||
throw (int)TYPE_CONST;
|
||||
|
||||
Constant = true;
|
||||
} // end of CONSTANT constructor
|
||||
|
@ -95,7 +95,7 @@ CONSTANT::CONSTANT(PGLOBAL g, void *value, short type)
|
|||
CONSTANT::CONSTANT(PGLOBAL g, int n)
|
||||
{
|
||||
if (!(Value = AllocateValue(g, &n, TYPE_INT)))
|
||||
throw TYPE_CONST;
|
||||
throw (int)TYPE_CONST;
|
||||
|
||||
Constant = true;
|
||||
} // end of CONSTANT constructor
|
||||
|
@ -117,7 +117,7 @@ void CONSTANT::Convert(PGLOBAL g, int newtype)
|
|||
{
|
||||
if (Value->GetType() != newtype)
|
||||
if (!(Value = AllocateValue(g, Value, newtype)))
|
||||
throw TYPE_CONST;
|
||||
throw (int)TYPE_CONST;
|
||||
|
||||
} // end of Convert
|
||||
|
||||
|
|
Loading…
Reference in a new issue