1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge connect/10.0 into 10.0

This is a squashed merge.
This commit is contained in:
Vicențiu Ciorbaru
2017-09-19 02:04:05 +03:00
parent 0f44c8ab28
commit df2675a9cc
149 changed files with 42779 additions and 3161 deletions

View File

@@ -27,10 +27,12 @@
#endif
#define M 7
bool IsNum(PSZ s);
char *NextChr(PSZ s, char sep);
char *GetJsonNull(void);
uint GetJsonGrpSize(void);
static int IsJson(UDF_ARGS *args, uint i);
static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i);
static int IsJson(UDF_ARGS *args, uint i);
static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i);
static char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *is_null, char *error);
static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
@@ -112,10 +114,9 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
PJNODE jnp = &Nodes[i];
if (*p) {
if (p[--n] == ']') {
p[n--] = 0;
p++;
} else {
if (p[n - 1] == ']') {
p[--n] = 0;
} else if (!IsNum(p)) {
// Wrong array specification
sprintf(g->Message, "Invalid array specification %s", p);
return true;
@@ -125,8 +126,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
b = true;
// To check whether a numeric Rank was specified
for (int k = 0; dg && p[k]; k++)
dg = isdigit(p[k]) > 0;
dg = IsNum(p);
if (!n) {
// Default specifications
@@ -143,7 +143,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
jnp->Rank = B;
jnp->Op = OP_LE;
} else if (!Value->IsTypeNum()) {
jnp->CncVal = AllocateValue(g, (void*)", ", TYPE_STRING);
jnp->CncVal = AllocateValue(g, PlugDup(g, ", "), TYPE_STRING);
jnp->Op = OP_CNC;
} else
jnp->Op = OP_ADD;
@@ -161,13 +161,12 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
// Set the Op value;
switch (*p) {
case '+': jnp->Op = OP_ADD; break;
case '*': jnp->Op = OP_MULT; break;
case 'x': jnp->Op = OP_MULT; break;
case '>': jnp->Op = OP_MAX; break;
case '<': jnp->Op = OP_MIN; break;
case '!': jnp->Op = OP_SEP; break; // Average
case '#': jnp->Op = OP_NUM; break;
case 'x':
case 'X': // Expand this array
case '*': // Expand this array
strcpy(g->Message, "Expand not supported by this function");
return true;
default:
@@ -182,6 +181,10 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
if (n > 2) {
// Set concat intermediate string
p[n - 1] = 0;
if (trace)
htrc("Concat string=%s\n", p + 1);
jnp->CncVal = AllocateValue(g, p + 1, TYPE_STRING);
} // endif n
@@ -233,9 +236,9 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm)
/*********************************************************************************/
my_bool JSNX::ParseJpath(PGLOBAL g)
{
char *p, *p2 = NULL, *pbuf = NULL;
char *p, *p1 = NULL, *p2 = NULL, *pbuf = NULL;
int i;
my_bool mul = false;
my_bool a, mul = false;
if (Parsed)
return false; // Already done
@@ -243,11 +246,18 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
// Jpath = Name;
return true;
if (trace)
htrc("ParseJpath %s\n", SVP(Jpath));
if (!(pbuf = PlgDBDup(g, Jpath)))
return true;
// The Jpath must be analyzed
for (i = 0, p = pbuf; (p = strchr(p, ':')); i++, p++)
if (*pbuf == '$') pbuf++;
if (*pbuf == '.') pbuf++;
if (*pbuf == '[') p1 = pbuf++;
// Estimate the required number of nodes
for (i = 0, p = pbuf; (p = NextChr(p, '.')); i++, p++)
Nod++; // One path node found
if (!(Nodes = (PJNODE)PlgDBSubAlloc(g, NULL, (++Nod) * sizeof(JNODE))))
@@ -256,12 +266,28 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
memset(Nodes, 0, (Nod)* sizeof(JNODE));
// Analyze the Jpath for this column
for (i = 0, p = pbuf; i < Nod; i++, p = (p2 ? p2 + 1 : p + strlen(p))) {
if ((p2 = strchr(p, ':')))
*p2 = 0;
for (i = 0, p = pbuf; p && i < Nod; i++, p = (p2 ? p2 : NULL)) {
a = (p1 != NULL);
p1 = strchr(p, '[');
p2 = strchr(p, '.');
if (!p2)
p2 = p1;
else if (p1) {
if (p1 < p2)
p2 = p1;
else if (p1 == p2 + 1)
*p2++ = 0; // Old syntax .[
else
p1 = NULL;
} // endif p1
if (p2)
*p2++ = 0;
// Jpath must be explicit
if (*p == 0 || *p == '[') {
if (a || *p == 0 || *p == '[' || IsNum(p)) {
// Analyse intermediate array processing
if (SetArrayOptions(g, p, i, Nodes[i-1].Key))
return true;
@@ -280,7 +306,14 @@ my_bool JSNX::ParseJpath(PGLOBAL g)
} // endfor i, p
Nod = i;
MulVal = AllocateValue(g, Value);
if (trace)
for (i = 0; i < Nod; i++)
htrc("Node(%d) Key=%s Op=%d Rank=%d\n",
i, SVP(Nodes[i].Key), Nodes[i].Op, Nodes[i].Rank);
Parsed = true;
return false;
} // end of ParseJpath
@@ -308,6 +341,8 @@ PVAL JSNX::MakeJson(PGLOBAL g, PJSON jsp)
void JSNX::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n)
{
if (val) {
vp->SetNull(false);
if (Jb) {
vp->SetValue_psz(Serialize(g, val->GetJsp(), NULL, 0));
} else switch (val->GetValType()) {
@@ -462,8 +497,8 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n)
/*********************************************************************************/
PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
{
//int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, ars, nv = 0, nextsame = 0;
//int i, ars, nv = 0, nextsame = Tjp->NextSame;
int i, nv = 0, nextsame = 0;
my_bool err;
OPVAL op = Nodes[n].Op;
PVAL val[2], vp = Nodes[n].Valp;
@@ -471,11 +506,20 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
JVALUE jval;
vp->Reset();
ars = arp->size();
//ars = arp->size();
for (i = 0; i < ars; i++) {
if (trace)
htrc("CalculateArray size=%d\n", arp->size());
// htrc("CalculateArray size=%d\n", ars);
for (i = 0; i < arp->size(); i++) {
//for (i = 0; i < ars; i++) { because compiler bug
jvrp = arp->GetValue(i);
if (trace)
htrc("Value %s null=%d nv=%d\n",
jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv);
if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) {
if (jvrp->IsNull()) {
jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING);
@@ -492,7 +536,7 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
} else
SetJsonValue(g, MulVal, jvp, n);
if (!MulVal->IsZero()) {
if (!MulVal->IsNull()) {
switch (op) {
case OP_CNC:
if (Nodes[n].CncVal) {
@@ -503,7 +547,7 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n)
val[0] = MulVal;
err = vp->Compute(g, val, 1, op);
break;
// case OP_NUM:
// case OP_NUM:
case OP_SEP:
val[0] = Nodes[n].Valp;
val[1] = MulVal;
@@ -715,6 +759,7 @@ PSZ JSNX::Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k)
// Write to the path string
Jp = new(g) JOUTSTR(g);
Jp->WriteChr('$');
Jvalp = jvp;
K = k;
@@ -773,7 +818,12 @@ my_bool JSNX::LocateArray(PJAR jarp)
/*********************************************************************************/
my_bool JSNX::LocateObject(PJOB jobp)
{
size_t m = Jp->N;
size_t m;
if (Jp->WriteChr('.'))
return true;
m = Jp->N;
for (PJPR pair = jobp->First; pair && !Found; pair = pair->Next) {
Jp->N = m;
@@ -794,19 +844,12 @@ my_bool JSNX::LocateObject(PJOB jobp)
/*********************************************************************************/
my_bool JSNX::LocateValue(PJVAL jvp)
{
if (CompareTree(Jvalp, jvp)) {
if (CompareTree(Jvalp, jvp))
Found = (--K == 0);
} else if (jvp->GetArray()) {
if (Jp->WriteChr(':'))
return true;
else if (jvp->GetArray())
return LocateArray(jvp->GetArray());
} else if (jvp->GetObject()) {
if (Jp->WriteChr(':'))
return true;
else if (jvp->GetObject())
return LocateObject(jvp->GetObject());
} // endif's
return false;
} // end of LocateValue
@@ -852,6 +895,7 @@ PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
if (!g->Message[0])
strcpy(g->Message, "Invalid json tree");
return NULL;
} else {
if (Jp->N > 1)
Jp->N--;
@@ -862,7 +906,6 @@ PSZ JSNX::LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx)
return Jp->Strp;
} // endif's
return NULL;
} // end of LocateAll
/*********************************************************************************/
@@ -968,26 +1011,26 @@ my_bool JSNX::CompareTree(PJSON jp1, PJSON jp2)
/*********************************************************************************/
my_bool JSNX::AddPath(void)
{
char s[16];
my_bool b = false;
char s[16];
if (Jp->WriteChr('"'))
if (Jp->WriteStr("\"$"))
return true;
for (int i = 0; i <= I; i++) {
if (b) {
if (Jp->WriteChr(':')) return true;
} else
b = true;
if (Jpnp[i].Type == TYPE_JAR) {
sprintf(s, "[%d]", Jpnp[i].N + B);
if (Jp->WriteStr(s))
return true;
} else if (Jp->WriteStr(Jpnp[i].Key))
return true;
} else {
if (Jp->WriteChr('.'))
return true;
if (Jp->WriteStr(Jpnp[i].Key))
return true;
} // endif's
} // endfor i
@@ -1097,7 +1140,7 @@ static my_bool JsonInit(UDF_INIT *initid, UDF_ARGS *args,
unsigned long reslen, unsigned long memlen,
unsigned long more = 0)
{
PGLOBAL g = PlugInit(NULL, memlen + more);
PGLOBAL g = PlugInit(NULL, memlen + more + 500); // +500 to avoid CheckMem
if (!g) {
strcpy(message, "Allocation error");
@@ -1457,6 +1500,11 @@ static my_bool CheckMemory(PGLOBAL g, UDF_INIT *initid, UDF_ARGS *args, uint n,
ml += g->More;
if (ml > g->Sarea_Size) {
#if !defined(DEVELOPMENT)
if (trace)
#endif
htrc("Freeing Sarea at %p size=%d\n", g->Sarea, g->Sarea_Size);
free(g->Sarea);
if (!(g->Sarea = PlugAllocMem(g, ml))) {
@@ -1762,16 +1810,16 @@ void jsonvalue_deinit(UDF_INIT* initid)
/*********************************************************************************/
/* Make a Json array containing all the parameters. */
/*********************************************************************************/
my_bool json_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
my_bool json_make_array_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
unsigned long reslen, memlen;
CalcLen(args, false, reslen, memlen);
return JsonInit(initid, args, message, false, reslen, memlen);
} // end of json_array_init
} // end of json_make_array_init
char *json_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *, char *)
char *json_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *, char *)
{
char *str;
PGLOBAL g = (PGLOBAL)initid->ptr;
@@ -1798,12 +1846,12 @@ char *json_array(UDF_INIT *initid, UDF_ARGS *args, char *result,
*res_length = strlen(str);
return str;
} // end of json_array
} // end of json_make_array
void json_array_deinit(UDF_INIT* initid)
void json_make_array_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of json_array_deinit
} // end of json_make_array_deinit
/*********************************************************************************/
/* Add one or several values to a Json array. */
@@ -1850,7 +1898,7 @@ char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJAR arp;
PJVAL jvp = MakeValue(g, args, 0, &top);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(top = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
return NULL;
@@ -2083,19 +2131,219 @@ void json_array_delete_deinit(UDF_INIT* initid)
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of json_array_delete_deinit
/*********************************************************************************/
/* Sum big integer values from a Json array. */
/*********************************************************************************/
my_bool jsonsum_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
unsigned long reslen, memlen, more;
if (args->arg_count != 1) {
strcpy(message, "This function must have 1 argument");
return true;
} else if (!IsJson(args, 0) && args->arg_type[0] != STRING_RESULT) {
strcpy(message, "First argument must be a json item");
return true;
} else
CalcLen(args, false, reslen, memlen);
// TODO: calculate this
more = (IsJson(args, 0) != 3) ? 1000 : 0;
return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonsum_int_init
long long jsonsum_int(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
long long n = 0LL;
PGLOBAL g = (PGLOBAL)initid->ptr;
if (g->N) {
if (!g->Activityp) {
*is_null = 1;
return 0LL;
} else
return *(long long*)g->Activityp;
} else if (initid->const_item)
g->N = 1;
if (!CheckMemory(g, initid, args, 1, false, false, true)) {
PJVAL jvp = MakeValue(g, args, 0);
if (jvp && jvp->GetValType() == TYPE_JAR) {
PJAR arp = jvp->GetArray();
for (int i = 0; i < arp->size(); i++)
n += arp->GetValue(i)->GetBigint();
} else {
PUSH_WARNING("First argument target is not an array");
} // endif jvp
} else {
*error = 1;
n = -1LL;
} // end of CheckMemory
if (g->N) {
// Keep result of constant function
long long *np = (long long*)PlugSubAlloc(g, NULL, sizeof(long long));
*np = n;
g->Activityp = (PACTIVITY)np;
} // endif const_item
return n;
} // end of jsonsum_int
void jsonsum_int_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonsum_int_deinit
/*********************************************************************************/
/* Sum big integer values from a Json array. */
/*********************************************************************************/
my_bool jsonsum_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
unsigned long reslen, memlen, more;
if (args->arg_count != 1) {
strcpy(message, "This function must have 1 argument");
return true;
} else if (!IsJson(args, 0) && args->arg_type[0] != STRING_RESULT) {
strcpy(message, "First argument must be a json item");
return true;
} else
CalcLen(args, false, reslen, memlen);
// TODO: calculate this
more = (IsJson(args, 0) != 3) ? 1000 : 0;
return JsonInit(initid, args, message, true, reslen, memlen, more);
} // end of jsonsum_real_init
double jsonsum_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
double n = 0.0;
PGLOBAL g = (PGLOBAL)initid->ptr;
if (g->N) {
if (!g->Activityp) {
*is_null = 1;
return 0.0;
} else
return *(double*)g->Activityp;
} else if (initid->const_item)
g->N = 1;
if (!CheckMemory(g, initid, args, 1, false, false, true)) {
PJVAL jvp = MakeValue(g, args, 0);
if (jvp && jvp->GetValType() == TYPE_JAR) {
PJAR arp = jvp->GetArray();
for (int i = 0; i < arp->size(); i++)
n += arp->GetValue(i)->GetFloat();
} else {
PUSH_WARNING("First argument target is not an array");
} // endif jvp
} else {
*error = 1;
n = -1.0;
} // end of CheckMemory
if (g->N) {
// Keep result of constant function
double *np = (double*)PlugSubAlloc(g, NULL, sizeof(double));
*np = n;
g->Activityp = (PACTIVITY)np;
} // endif const_item
return n;
} // end of jsonsum_real
void jsonsum_real_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonsum_real_deinit
/*********************************************************************************/
/* Returns the average of big integer values from a Json array. */
/*********************************************************************************/
my_bool jsonavg_real_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
return jsonsum_real_init(initid, args, message);
} // end of jsonavg_real_init
double jsonavg_real(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
double n = 0.0;
PGLOBAL g = (PGLOBAL)initid->ptr;
if (g->N) {
if (!g->Activityp) {
*is_null = 1;
return 0.0;
} else
return *(double*)g->Activityp;
} else if (initid->const_item)
g->N = 1;
if (!CheckMemory(g, initid, args, 1, false, false, true)) {
PJVAL jvp = MakeValue(g, args, 0);
if (jvp && jvp->GetValType() == TYPE_JAR) {
PJAR arp = jvp->GetArray();
if (arp->size()) {
for (int i = 0; i < arp->size(); i++)
n += arp->GetValue(i)->GetFloat();
n /= arp->size();
} // endif size
} else {
PUSH_WARNING("First argument target is not an array");
} // endif jvp
} else {
*error = 1;
n = -1.0;
} // end of CheckMemory
if (g->N) {
// Keep result of constant function
double *np = (double*)PlugSubAlloc(g, NULL, sizeof(double));
*np = n;
g->Activityp = (PACTIVITY)np;
} // endif const_item
return n;
} // end of jsonavg_real
void jsonavg_real_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of jsonavg_real_deinit
/*********************************************************************************/
/* Make a Json Object containing all the parameters. */
/*********************************************************************************/
my_bool json_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
my_bool json_make_object_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
unsigned long reslen, memlen;
CalcLen(args, true, reslen, memlen);
return JsonInit(initid, args, message, false, reslen, memlen);
} // end of json_object_init
} // end of json_make_object_init
char *json_object(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *, char *)
char *json_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result,
unsigned long *res_length, char *, char *)
{
char *str = NULL;
PGLOBAL g = (PGLOBAL)initid->ptr;
@@ -2120,12 +2368,12 @@ char *json_object(UDF_INIT *initid, UDF_ARGS *args, char *result,
*res_length = strlen(str);
return str;
} // end of json_object
} // end of json_make_object
void json_object_deinit(UDF_INIT* initid)
void json_make_object_deinit(UDF_INIT* initid)
{
JsonFreeMem((PGLOBAL)initid->ptr);
} // end of json_object_deinit
} // end of json_make_object_deinit
/*********************************************************************************/
/* Make a Json Object containing all not null parameters. */
@@ -2440,7 +2688,7 @@ char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJSON jsp;
PJVAL jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
return NULL;
@@ -2824,7 +3072,7 @@ char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
return NULL;
@@ -2939,7 +3187,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto err;
@@ -2976,6 +3224,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result,
} catch (int n) {
if (trace)
htrc("Exception %d: %s\n", n, g->Message);
PUSH_WARNING(g->Message);
str = NULL;
} catch (const char *msg) {
@@ -3025,7 +3274,7 @@ my_bool jsonget_int_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
} // end of jsonget_int_init
long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args,
char *is_null, char *error)
char *is_null, char *error)
{
char *p, *path;
long long n;
@@ -3053,7 +3302,7 @@ long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
if (g->Mrr) *error = 1;
@@ -3168,7 +3417,7 @@ double jsonget_real(UDF_INIT *initid, UDF_ARGS *args,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
*is_null = 1;
@@ -3284,7 +3533,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto err;
@@ -3316,6 +3565,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result,
} catch (int n) {
if (trace)
htrc("Exception %d: %s\n", n, g->Message);
PUSH_WARNING(g->Message);
*error = 1;
path = NULL;
@@ -3407,7 +3657,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto err;
@@ -3440,6 +3690,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result,
} catch (int n) {
if (trace)
htrc("Exception %d: %s\n", n, g->Message);
PUSH_WARNING(g->Message);
*error = 1;
path = NULL;
@@ -3578,7 +3829,7 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto err;
@@ -3665,7 +3916,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
throw 2;
} // endif jsp
@@ -3714,6 +3965,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} catch (int n) {
if (trace)
htrc("Exception %d: %s\n", n, g->Message);
PUSH_WARNING(g->Message);
str = NULL;
} catch (const char *msg) {
@@ -4000,14 +4252,14 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!strchr("[{ \t\r\n", *p)) {
// Is this a file name?
if (!(p = GetJsonFile(g, p))) {
PUSH_WARNING(g->Message);
goto fin;
} else
fn = jvp->GetString();
fn = jvp->GetString(g);
} // endif p
@@ -4150,7 +4402,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJVAL jvp = MakeValue(g, args, 0, &top);
PGLOBAL gb = GetMemPtr(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(top = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
return NULL;
@@ -4688,7 +4940,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result,
PJSON jsp;
PJVAL jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
return NULL;
@@ -4759,7 +5011,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto fin;
@@ -4933,7 +5185,7 @@ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result,
} else
jvp = MakeValue(g, args, 0);
if ((p = jvp->GetString())) {
if ((p = jvp->GetString(g))) {
if (!(jsp = ParseJson(g, p, strlen(p)))) {
PUSH_WARNING(g->Message);
goto fin;