mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Fix wrong value of JSON column
When null and the column is NOT NULL the value was not reset. modified: storage/connect/tabjson.cpp Fix converting bstr_t string to set error message modified: storage/connect/domdoc.cpp Fix MDEV-12768: -Wformat-overflow compile warnings modified: storage/connect/global.h modified: storage/connect/jsonudf.cpp modified: storage/connect/plugutil.cpp modified: storage/connect/tabvct.cpp Typo (in external_lock) modified: storage/connect/ha_connect.cc Remove some warnings modified: storage/connect/odbconn.cpp modified: storage/connect/tabmysql.cpp Add MEM_RESERVE flag to virtualAlloc modified: storage/connect/plgdbutl.cpp Fix MDEV-12573: Accept=1 may show incorrect value for NULL column in CONNECT TBL modified: storage/connect/tabutil.cpp Fix wrong setting of key size when greater than 2G modified: storage/connect/xindex.cpp Fixing MDEV-12149: compile errors on Windows with /Zc:strictStrings Introduce typedef PCSZ and replace PSZ by it where it matters All done on CONNECT but compile still fails because of an included system file modified: storage/connect/array.cpp modified: storage/connect/catalog.h modified: storage/connect/colblk.cpp modified: storage/connect/colblk.h modified: storage/connect/connect.cc modified: storage/connect/domdoc.cpp modified: storage/connect/domdoc.h modified: storage/connect/filamdbf.cpp modified: storage/connect/filamdbf.h modified: storage/connect/filamfix.cpp modified: storage/connect/filamgz.cpp modified: storage/connect/filamtxt.h modified: storage/connect/filamvct.cpp modified: storage/connect/filamvct.h modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h modified: storage/connect/ha_connect.cc modified: storage/connect/ha_connect.h modified: storage/connect/jdbccat.h modified: storage/connect/jdbconn.cpp modified: storage/connect/jdbconn.h modified: storage/connect/json.cpp modified: storage/connect/json.h modified: storage/connect/jsonudf.cpp modified: storage/connect/jsonudf.h modified: storage/connect/libdoc.cpp modified: storage/connect/macutil.cpp modified: storage/connect/myconn.cpp modified: storage/connect/myutil.cpp modified: storage/connect/myutil.h modified: storage/connect/odbccat.h modified: storage/connect/odbconn.cpp modified: storage/connect/odbconn.h modified: storage/connect/os.h modified: storage/connect/plgdbsem.h modified: storage/connect/plgdbutl.cpp modified: storage/connect/plgxml.cpp modified: storage/connect/plgxml.h modified: storage/connect/plugutil.cpp modified: storage/connect/preparse.h modified: storage/connect/reldef.cpp modified: storage/connect/reldef.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabext.cpp modified: storage/connect/tabext.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfix.h modified: storage/connect/tabfmt.cpp modified: storage/connect/tabfmt.h modified: storage/connect/tabjdbc.cpp modified: storage/connect/tabjdbc.h modified: storage/connect/tabjson.cpp modified: storage/connect/tabjson.h modified: storage/connect/table.cpp modified: storage/connect/tabmac.cpp modified: storage/connect/tabmul.cpp modified: storage/connect/tabmul.h modified: storage/connect/tabmysql.cpp modified: storage/connect/tabmysql.h modified: storage/connect/tabodbc.cpp modified: storage/connect/tabodbc.h modified: storage/connect/tabpivot.cpp modified: storage/connect/tabpivot.h modified: storage/connect/tabsys.cpp modified: storage/connect/tabsys.h modified: storage/connect/tabutil.cpp modified: storage/connect/tabutil.h modified: storage/connect/tabvir.cpp modified: storage/connect/tabvir.h modified: storage/connect/tabwmi.cpp modified: storage/connect/tabwmi.h modified: storage/connect/tabxml.cpp modified: storage/connect/tabxml.h modified: storage/connect/tabzip.cpp modified: storage/connect/tabzip.h modified: storage/connect/valblk.cpp modified: storage/connect/valblk.h modified: storage/connect/value.cpp modified: storage/connect/value.h modified: storage/connect/xindex.cpp modified: storage/connect/xobject.cpp modified: storage/connect/xobject.h modified: storage/connect/xtable.h Fix MDEV-12603 Insert replaces values in ZIP file modified: storage/connect/filamzip.cpp modified: storage/connect/filamzip.h Fix MDEV-12686 Handle null in json Fix MDEV-12688 Insert does not handle type TINYINT modified: storage/connect/json.cpp modified: storage/connect/tabjson.cpp Fix MDEV-12653 Cannot add index for ZIP CONNECT table modified: storage/connect/filamzip.cpp modified: storage/connect/ha_connect.cc modified: storage/connect/tabdos.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/xindex.cpp
This commit is contained in:
@@ -118,10 +118,11 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
||||
static XFLD fldtyp[] = {FLD_NAME, FLD_TYPE, FLD_TYPENAME, FLD_PREC,
|
||||
FLD_LENGTH, FLD_SCALE, FLD_NULL, FLD_FORMAT};
|
||||
static unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0};
|
||||
char *fn, *op, colname[65], fmt[129], buf[512];
|
||||
char colname[65], fmt[129], buf[512];
|
||||
int i, j, lvl, n = 0;
|
||||
int ncol = sizeof(buftyp) / sizeof(int);
|
||||
bool ok = true;
|
||||
PCSZ fn, op;
|
||||
PXCL xcol, xcp, fxcp = NULL, pxcp = NULL;
|
||||
PLVL *lvlp, vp;
|
||||
PXNODE node = NULL;
|
||||
@@ -161,7 +162,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
||||
if (!(tdp->Database = SetPath(g, db)))
|
||||
return NULL;
|
||||
|
||||
tdp->Tabname = tab;
|
||||
tdp->Tabname = tab;
|
||||
tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false);
|
||||
tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
|
||||
|
||||
@@ -362,7 +363,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
|
||||
|
||||
skipit:
|
||||
if (trace)
|
||||
htrc("CSVColumns: n=%d len=%d\n", n, length[0]);
|
||||
htrc("XMLColumns: n=%d len=%d\n", n, length[0]);
|
||||
|
||||
/*********************************************************************/
|
||||
/* Allocate the structures used to refer to the result set. */
|
||||
@@ -451,7 +452,8 @@ XMLDEF::XMLDEF(void)
|
||||
/***********************************************************************/
|
||||
bool XMLDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
|
||||
{
|
||||
char *defrow, *defcol, buf[10];
|
||||
PCSZ defrow, defcol;
|
||||
char buf[10];
|
||||
|
||||
Fn = GetStringCatInfo(g, "Filename", NULL);
|
||||
Encoding = GetStringCatInfo(g, "Encoding", "UTF-8");
|
||||
@@ -1317,11 +1319,7 @@ void TDBXML::CloseDB(PGLOBAL g)
|
||||
Docp->CloseDoc(g, To_Xb);
|
||||
|
||||
// This causes a crash in Diagnostics_area::set_error_status
|
||||
//#if defined(USE_TRY)
|
||||
// throw TYPE_AM_XML;
|
||||
//#else // !USE_TRY
|
||||
// longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
//#endif // !USE_TRY
|
||||
} // endif DumpDoc
|
||||
|
||||
} // endif Changed
|
||||
@@ -1364,8 +1362,8 @@ void TDBXML::CloseDB(PGLOBAL g)
|
||||
/***********************************************************************/
|
||||
/* XMLCOL public constructor. */
|
||||
/***********************************************************************/
|
||||
XMLCOL::XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PSZ am)
|
||||
: COLBLK(cdp, tdbp, i)
|
||||
XMLCOL::XMLCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am)
|
||||
: COLBLK(cdp, tdbp, i)
|
||||
{
|
||||
if (cprec) {
|
||||
Next = cprec->GetNext();
|
||||
@@ -1644,11 +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);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endif type
|
||||
|
||||
// Get the Xname value from the XML file
|
||||
@@ -1659,11 +1653,7 @@ void XMLCOL::ReadColumn(PGLOBAL g)
|
||||
PushWarning(g, Tdbp);
|
||||
break;
|
||||
default:
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endswitch
|
||||
|
||||
Value->SetValue_psz(Valbuf);
|
||||
@@ -1714,11 +1704,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
||||
/* For columns having an Xpath, the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, Nod || Tdbp->Colname))
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
|
||||
/*********************************************************************/
|
||||
/* Null values are represented by no node. */
|
||||
@@ -1790,15 +1776,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (ColNode == NULL) {
|
||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
#endif // !USE_TRY
|
||||
} // endif ColNode
|
||||
|
||||
} // endif ColNode
|
||||
@@ -1827,11 +1805,7 @@ void XMLCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
@@ -1881,11 +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);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endif type
|
||||
|
||||
// Get the Xname value from the XML file
|
||||
@@ -1971,11 +1941,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
||||
/* For columns having an Xpath, the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, Nod))
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
|
||||
/*********************************************************************/
|
||||
/* Find the column and value nodes to update or insert. */
|
||||
@@ -2024,11 +1990,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (len > 1 && !Tdbp->Xpand) {
|
||||
sprintf(g->Message, MSG(BAD_VAL_UPDATE), Name);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} else
|
||||
ValNode = Nlx->GetItem(g, Tdbp->Nsub, Vxnp);
|
||||
|
||||
@@ -2070,11 +2032,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (ColNode == NULL) {
|
||||
strcpy(g->Message, MSG(COL_ALLOC_ERR));
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endif ColNode
|
||||
|
||||
} // endif ColNode
|
||||
@@ -2103,11 +2061,7 @@ void XMULCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
@@ -2139,11 +2093,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
|
||||
|
||||
if (Tdbp->Clist == NULL) {
|
||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endif Clist
|
||||
|
||||
if ((ValNode = Tdbp->Clist->GetItem(g, Rank, Vxnp))) {
|
||||
@@ -2155,11 +2105,7 @@ void XPOSCOL::ReadColumn(PGLOBAL g)
|
||||
PushWarning(g, Tdbp);
|
||||
break;
|
||||
default:
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endswitch
|
||||
|
||||
Value->SetValue_psz(Valbuf);
|
||||
@@ -2210,22 +2156,14 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
||||
/* For all columns the Clist must be updated. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->CheckRow(g, true))
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
|
||||
/*********************************************************************/
|
||||
/* Find the column and value nodes to update or insert. */
|
||||
/*********************************************************************/
|
||||
if (Tdbp->Clist == NULL) {
|
||||
strcpy(g->Message, MSG(MIS_TAG_LIST));
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} // endif Clist
|
||||
|
||||
n = Tdbp->Clist->GetLength();
|
||||
@@ -2250,11 +2188,7 @@ void XPOSCOL::WriteColumn(PGLOBAL g)
|
||||
|
||||
if (strlen(p) > (unsigned)Long) {
|
||||
sprintf(g->Message, MSG(VALUE_TOO_LONG), p, Name, Long);
|
||||
#if defined(USE_TRY)
|
||||
throw TYPE_AM_XML;
|
||||
#else // !USE_TRY
|
||||
longjmp(g->jumper[g->jump_level], TYPE_AM_XML);
|
||||
#endif // !USE_TRY
|
||||
} else
|
||||
strcpy(Valbuf, p);
|
||||
|
||||
|
Reference in New Issue
Block a user