summaryrefslogtreecommitdiff
path: root/storage/connect/valblk.cpp
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2017-05-11 21:57:21 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2017-05-11 21:57:21 +0200
commit1c88b9a8d3200bdf554ece09316cacf2146877ee (patch)
tree9e19a4dcc5079412870b83bf7473b0cb8bf1670f /storage/connect/valblk.cpp
parent531698e0da307943dff5ee6830a241d6829345cd (diff)
downloadmariadb-git-1c88b9a8d3200bdf554ece09316cacf2146877ee.tar.gz
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
Diffstat (limited to 'storage/connect/valblk.cpp')
-rw-r--r--storage/connect/valblk.cpp58
1 files changed, 11 insertions, 47 deletions
diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp
index 4331962e0ad..5b98f3eb425 100644
--- a/storage/connect/valblk.cpp
+++ b/storage/connect/valblk.cpp
@@ -1,5 +1,5 @@
/************ Valblk C++ Functions Source Code File (.CPP) *************/
-/* Name: VALBLK.CPP Version 2.2 */
+/* Name: VALBLK.CPP Version 2.3 */
/* */
/* (C) Copyright to the author Olivier BERTRAND 2005-2017 */
/* */
@@ -138,18 +138,14 @@ PSZ VALBLK::GetCharValue(int)
assert(g);
sprintf(g->Message, MSG(NO_CHAR_FROM), Type);
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
return NULL;
} // end of GetCharValue
/***********************************************************************/
/* Set format so formatted dates can be converted on input. */
/***********************************************************************/
-bool VALBLK::SetFormat(PGLOBAL g, PSZ, int, int)
+bool VALBLK::SetFormat(PGLOBAL g, PCSZ, int, int)
{
sprintf(g->Message, MSG(NO_DATE_FMT), Type);
return true;
@@ -210,11 +206,7 @@ void VALBLK::ChkIndx(int n)
if (n < 0 || n >= Nval) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_VALBLK_INDX));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif n
} // end of ChkIndx
@@ -224,11 +216,7 @@ void VALBLK::ChkTyp(PVAL v)
if (Check && (Type != v->GetType() || Unsigned != v->IsUnsigned())) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Type
} // end of ChkTyp
@@ -238,11 +226,7 @@ void VALBLK::ChkTyp(PVBLK vb)
if (Check && (Type != vb->GetType() || Unsigned != vb->IsUnsigned())) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(VALTYPE_NOMATCH));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Type
} // end of ChkTyp
@@ -351,18 +335,14 @@ uchar TYPBLK<uchar>::GetTypedValue(PVAL valp)
/* Set one value in a block from a zero terminated string. */
/***********************************************************************/
template <class TYPE>
-void TYPBLK<TYPE>::SetValue(PSZ p, int n)
+void TYPBLK<TYPE>::SetValue(PCSZ p, int n)
{
ChkIndx(n);
if (Check) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_SET_STRING));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Check
bool minus;
@@ -405,18 +385,14 @@ template <>
ulonglong TYPBLK<ulonglong>::MaxVal(void) {return ULONGLONG_MAX;}
template <>
-void TYPBLK<double>::SetValue(PSZ p, int n)
+void TYPBLK<double>::SetValue(PCSZ p, int n)
{
ChkIndx(n);
if (Check) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BAD_SET_STRING));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Check
Typp[n] = atof(p);
@@ -427,7 +403,7 @@ void TYPBLK<double>::SetValue(PSZ p, int n)
/* Set one value in a block from an array of characters. */
/***********************************************************************/
template <class TYPE>
-void TYPBLK<TYPE>::SetValue(char *sp, uint len, int n)
+void TYPBLK<TYPE>::SetValue(PCSZ sp, uint len, int n)
{
PGLOBAL& g = Global;
PSZ spz = (PSZ)PlugSubAlloc(g, NULL, 0); // Temporary
@@ -802,7 +778,7 @@ void CHRBLK::SetValue(PVAL valp, int n)
/***********************************************************************/
/* Set one value in a block from a zero terminated string. */
/***********************************************************************/
-void CHRBLK::SetValue(PSZ sp, int n)
+void CHRBLK::SetValue(PCSZ sp, int n)
{
uint len = (sp) ? strlen(sp) : 0;
SetValue(sp, len, n);
@@ -811,7 +787,7 @@ void CHRBLK::SetValue(PSZ sp, int n)
/***********************************************************************/
/* Set one value in a block from an array of characters. */
/***********************************************************************/
-void CHRBLK::SetValue(char *sp, uint len, int n)
+void CHRBLK::SetValue(const char *sp, uint len, int n)
{
char *p = Chrp + n * Long;
@@ -819,11 +795,7 @@ void CHRBLK::SetValue(char *sp, uint len, int n)
if (Check && (signed)len > Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(SET_STR_TRUNC));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Check
#endif // _DEBUG
@@ -851,11 +823,7 @@ void CHRBLK::SetValue(PVBLK pv, int n1, int n2)
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Type
if (!(b = pv->IsNull(n2)))
@@ -906,11 +874,7 @@ void CHRBLK::SetValues(PVBLK pv, int k, int n)
if (Type != pv->GetType() || Long != ((CHRBLK*)pv)->Long) {
PGLOBAL& g = Global;
strcpy(g->Message, MSG(BLKTYPLEN_MISM));
-#if defined(USE_TRY)
throw Type;
-#else // !USE_TRY
- longjmp(g->jumper[g->jump_level], Type);
-#endif // !USE_TRY
} // endif Type
#endif // _DEBUG
char *p = ((CHRBLK*)pv)->Chrp;
@@ -1188,7 +1152,7 @@ void STRBLK::SetValue(PVAL valp, int n)
/***********************************************************************/
/* Set one value in a block from a zero terminated string. */
/***********************************************************************/
-void STRBLK::SetValue(PSZ p, int n)
+void STRBLK::SetValue(PCSZ p, int n)
{
if (p) {
if (!Sorted || !n || !Strp[n-1] || strcmp(p, Strp[n-1]))
@@ -1204,7 +1168,7 @@ void STRBLK::SetValue(PSZ p, int n)
/***********************************************************************/
/* Set one value in a block from an array of characters. */
/***********************************************************************/
-void STRBLK::SetValue(char *sp, uint len, int n)
+void STRBLK::SetValue(const char *sp, uint len, int n)
{
PSZ p;
@@ -1352,7 +1316,7 @@ DATBLK::DATBLK(void *mp, int nval) : TYPBLK<int>(mp, nval, TYPE_INT)
/***********************************************************************/
/* Set format so formatted dates can be converted on input. */
/***********************************************************************/
-bool DATBLK::SetFormat(PGLOBAL g, PSZ fmt, int len, int year)
+bool DATBLK::SetFormat(PGLOBAL g, PCSZ fmt, int len, int year)
{
if (!(Dvalp = AllocateValue(g, TYPE_DATE, len, year, false, fmt)))
return true;
@@ -1379,7 +1343,7 @@ char *DATBLK::GetCharString(char *p, int n)
/***********************************************************************/
/* Set one value in a block from a char string. */
/***********************************************************************/
-void DATBLK::SetValue(PSZ p, int n)
+void DATBLK::SetValue(PCSZ p, int n)
{
if (Dvalp) {
// Decode the string according to format