Commit 1d239d8c authored by Olivier Bertrand's avatar Olivier Bertrand

Make changes required by version 10.1.9 (see Sergei's mmail):

Use PlgDBSuballoc in JbinAlloc to avoid unsupported longjmp's.
  modified:   storage/connect/ha_connect.cc
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h
  modified:   storage/connect/mysql-test/connect/r/json_udf.result
  modified:   storage/connect/mysql-test/connect/t/json_udf.inc
  modified:   storage/connect/tabjson.cpp
  modified:   storage/connect/value.cpp
Add new UDF functions jsoncontains, jsoncontains_path, json_set_item,
json_insert_item, json_update_item, jbin_set_item, jbin_insert_item,
jbin_update_item
  modified:   storage/connect/json.cpp
  modified:   storage/connect/json.h
  modified:   storage/connect/jsonudf.cpp
  modified:   storage/connect/jsonudf.h
parent 0a852591
...@@ -169,9 +169,9 @@ ...@@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size #define JSONMAX 10 // JSON Default max grp size
extern "C" { extern "C" {
char version[]= "Version 1.04.0003 October 25, 2015"; char version[]= "Version 1.04.0005 November 20, 2015";
#if defined(__WIN__) #if defined(__WIN__)
char compver[]= "Version 1.04.0003 " __DATE__ " " __TIME__; char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
char slash= '\\'; char slash= '\\';
#else // !__WIN__ #else // !__WIN__
char slash= '/'; char slash= '/';
...@@ -6274,10 +6274,6 @@ bool ha_connect::FileExists(const char *fn, bool bf) ...@@ -6274,10 +6274,6 @@ bool ha_connect::FileExists(const char *fn, bool bf)
int n; int n;
struct stat info; struct stat info;
if (check_access(ha_thd(), FILE_ACL, table->s->db.str,
NULL, NULL, 0, 0))
return true;
#if defined(__WIN__) #if defined(__WIN__)
s= "\\"; s= "\\";
#else // !__WIN__ #else // !__WIN__
......
...@@ -1282,6 +1282,18 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text) ...@@ -1282,6 +1282,18 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
return text; return text;
} // end of GetText } // end of GetText
void JVALUE::SetValue(PJSON jsp)
{
if (jsp->GetType() == TYPE_JVAL) {
Jsp = jsp->GetJsp();
Value = jsp->GetValue();
} else {
Jsp = jsp;
Value = NULL;
} // endif Type
} // end of SetValue;
/***********************************************************************/ /***********************************************************************/
/* Set the Value's value as the given integer. */ /* Set the Value's value as the given integer. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -271,8 +271,8 @@ class JVALUE : public JSON { ...@@ -271,8 +271,8 @@ class JVALUE : public JSON {
virtual double GetFloat(void); virtual double GetFloat(void);
virtual PSZ GetString(void); virtual PSZ GetString(void);
virtual PSZ GetText(PGLOBAL g, PSZ text); virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual void SetValue(PVAL valp) {Value = valp; Jsp = NULL;} virtual void SetValue(PJSON jsp);
virtual void SetValue(PJSON jsp) {Jsp = jsp; Value = NULL;} virtual void SetValue(PVAL valp) { Value = valp; Jsp = NULL; }
virtual void SetString(PGLOBAL g, PSZ s, short c = 0); virtual void SetString(PGLOBAL g, PSZ s, short c = 0);
virtual void SetInteger(PGLOBAL g, int n); virtual void SetInteger(PGLOBAL g, int n);
virtual void SetBigint(PGLOBAL g, longlong ll); virtual void SetBigint(PGLOBAL g, longlong ll);
......
This diff is collapsed.
...@@ -61,6 +61,10 @@ extern "C" { ...@@ -61,6 +61,10 @@ extern "C" {
DllExport char *json_object_nonull(UDF_EXEC_ARGS); DllExport char *json_object_nonull(UDF_EXEC_ARGS);
DllExport void json_object_nonull_deinit(UDF_INIT*); DllExport void json_object_nonull_deinit(UDF_INIT*);
DllExport my_bool json_object_key_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_object_key(UDF_EXEC_ARGS);
DllExport void json_object_key_deinit(UDF_INIT*);
DllExport my_bool json_object_add_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool json_object_add_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_object_add(UDF_EXEC_ARGS); DllExport char *json_object_add(UDF_EXEC_ARGS);
DllExport void json_object_add_deinit(UDF_INIT*); DllExport void json_object_add_deinit(UDF_INIT*);
...@@ -105,6 +109,10 @@ extern "C" { ...@@ -105,6 +109,10 @@ extern "C" {
DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); DllExport double jsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*);
DllExport void jsonget_real_deinit(UDF_INIT*); DllExport void jsonget_real_deinit(UDF_INIT*);
DllExport my_bool jsoncontains_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long jsoncontains(UDF_EXEC_ARGS);
DllExport void jsoncontains_deinit(UDF_INIT*);
DllExport my_bool jsonlocate_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool jsonlocate_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jsonlocate(UDF_EXEC_ARGS); DllExport char *jsonlocate(UDF_EXEC_ARGS);
DllExport void jsonlocate_deinit(UDF_INIT*); DllExport void jsonlocate_deinit(UDF_INIT*);
...@@ -113,6 +121,22 @@ extern "C" { ...@@ -113,6 +121,22 @@ extern "C" {
DllExport char *json_locate_all(UDF_EXEC_ARGS); DllExport char *json_locate_all(UDF_EXEC_ARGS);
DllExport void json_locate_all_deinit(UDF_INIT*); DllExport void json_locate_all_deinit(UDF_INIT*);
DllExport my_bool jsoncontains_path_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long jsoncontains_path(UDF_EXEC_ARGS);
DllExport void jsoncontains_path_deinit(UDF_INIT*);
DllExport my_bool json_set_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_set_item(UDF_EXEC_ARGS);
DllExport void json_set_item_deinit(UDF_INIT*);
DllExport my_bool json_insert_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_insert_item(UDF_EXEC_ARGS);
DllExport void json_insert_item_deinit(UDF_INIT*);
DllExport my_bool json_update_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_update_item(UDF_EXEC_ARGS);
DllExport void json_update_item_deinit(UDF_INIT*);
DllExport my_bool json_file_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool json_file_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *json_file(UDF_EXEC_ARGS); DllExport char *json_file(UDF_EXEC_ARGS);
DllExport void json_file_deinit(UDF_INIT*); DllExport void json_file_deinit(UDF_INIT*);
...@@ -145,6 +169,10 @@ extern "C" { ...@@ -145,6 +169,10 @@ extern "C" {
DllExport char *jbin_object_nonull(UDF_EXEC_ARGS); DllExport char *jbin_object_nonull(UDF_EXEC_ARGS);
DllExport void jbin_object_nonull_deinit(UDF_INIT*); DllExport void jbin_object_nonull_deinit(UDF_INIT*);
DllExport my_bool jbin_object_key_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_object_key(UDF_EXEC_ARGS);
DllExport void jbin_object_key_deinit(UDF_INIT*);
DllExport my_bool jbin_object_add_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool jbin_object_add_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_object_add(UDF_EXEC_ARGS); DllExport char *jbin_object_add(UDF_EXEC_ARGS);
DllExport void jbin_object_add_deinit(UDF_INIT*); DllExport void jbin_object_add_deinit(UDF_INIT*);
...@@ -165,6 +193,18 @@ extern "C" { ...@@ -165,6 +193,18 @@ extern "C" {
DllExport char *jbin_item_merge(UDF_EXEC_ARGS); DllExport char *jbin_item_merge(UDF_EXEC_ARGS);
DllExport void jbin_item_merge_deinit(UDF_INIT*); DllExport void jbin_item_merge_deinit(UDF_INIT*);
DllExport my_bool jbin_set_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_set_item(UDF_EXEC_ARGS);
DllExport void jbin_set_item_deinit(UDF_INIT*);
DllExport my_bool jbin_insert_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_insert_item(UDF_EXEC_ARGS);
DllExport void jbin_insert_item_deinit(UDF_INIT*);
DllExport my_bool jbin_update_item_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_update_item(UDF_EXEC_ARGS);
DllExport void jbin_update_item_deinit(UDF_INIT*);
DllExport my_bool jbin_file_init(UDF_INIT*, UDF_ARGS*, char*); DllExport my_bool jbin_file_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *jbin_file(UDF_EXEC_ARGS); DllExport char *jbin_file(UDF_EXEC_ARGS);
DllExport void jbin_file_deinit(UDF_INIT*); DllExport void jbin_file_deinit(UDF_INIT*);
...@@ -189,7 +229,7 @@ typedef struct _jpn { ...@@ -189,7 +229,7 @@ typedef struct _jpn {
class JSNX : public BLOCK { class JSNX : public BLOCK {
public: public:
// Constructors // Constructors
JSNX(PGLOBAL g, PJSON row, int type, int len = 64, int prec = 0); JSNX(PGLOBAL g, PJSON row, int type, int len = 64, int prec = 0, my_bool wr = false);
// Implementation // Implementation
int GetPrecision(void) {return Prec;} int GetPrecision(void) {return Prec;}
...@@ -201,6 +241,8 @@ class JSNX : public BLOCK { ...@@ -201,6 +241,8 @@ class JSNX : public BLOCK {
void ReadValue(PGLOBAL g); void ReadValue(PGLOBAL g);
PJVAL GetValue(PGLOBAL g, PJSON row, int i, my_bool b = true); PJVAL GetValue(PGLOBAL g, PJSON row, int i, my_bool b = true);
PJVAL GetJson(PGLOBAL g); PJVAL GetJson(PGLOBAL g);
my_bool CheckPath(PGLOBAL g);
my_bool WriteValue(PGLOBAL g, PJVAL jvalp);
char *Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k = 1); char *Locate(PGLOBAL g, PJSON jsp, PJVAL jvp, int k = 1);
char *LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx = 10); char *LocateAll(PGLOBAL g, PJSON jsp, PJVAL jvp, int mx = 10);
...@@ -211,6 +253,7 @@ class JSNX : public BLOCK { ...@@ -211,6 +253,7 @@ class JSNX : public BLOCK {
PVAL CalculateArray(PGLOBAL g, PJAR arp, int n); PVAL CalculateArray(PGLOBAL g, PJAR arp, int n);
PVAL MakeJson(PGLOBAL g, PJSON jsp); PVAL MakeJson(PGLOBAL g, PJSON jsp);
void SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n); void SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val, int n);
PJSON GetRow(PGLOBAL g);
my_bool LocateArray(PJAR jarp); my_bool LocateArray(PJAR jarp);
my_bool LocateObject(PJOB jobp); my_bool LocateObject(PJOB jobp);
my_bool LocateValue(PJVAL jvp); my_bool LocateValue(PJVAL jvp);
...@@ -244,4 +287,5 @@ class JSNX : public BLOCK { ...@@ -244,4 +287,5 @@ class JSNX : public BLOCK {
my_bool Xpd; // True for expandable column my_bool Xpd; // True for expandable column
my_bool Parsed; // True when parsed my_bool Parsed; // True when parsed
my_bool Found; // Item found by locate my_bool Found; // Item found by locate
my_bool Wr; // Write mode
}; // end of class JSNX }; // end of class JSNX
...@@ -334,8 +334,6 @@ JsonGet_Int(@j2,'qty') ...@@ -334,8 +334,6 @@ JsonGet_Int(@j2,'qty')
SELECT JsonGet_Int('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose'); SELECT JsonGet_Int('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose');
JsonGet_Int('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose') JsonGet_Int('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose')
NULL NULL
Warnings:
Warning 1105 Value not found
SELECT JsonGet_Int(JsonGet_String(Json_Array(Json_Array(45,28),Json_Array(36,45,89)),'[1]:*'),'[+]') sum; SELECT JsonGet_Int(JsonGet_String(Json_Array(Json_Array(45,28),Json_Array(36,45,89)),'[1]:*'),'[+]') sum;
sum sum
170 170
...@@ -381,8 +379,6 @@ JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','price ...@@ -381,8 +379,6 @@ JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','price
SELECT JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose'); SELECT JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose');
JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose') JsonGet_Real('{"qty":56,"price":3.141600,"truc":"machin","garanty":null}','chose')
NULL NULL
Warnings:
Warning 1105 Value not found
SELECT department, JsonGet_Real(Json_Object(department, Json_Array_Grp(salary) "Json_salaries"),'salaries:[+]') Sumsal FROM t3 GROUP BY department; SELECT department, JsonGet_Real(Json_Object(department, Json_Array_Grp(salary) "Json_salaries"),'salaries:[+]') Sumsal FROM t3 GROUP BY department;
department Sumsal department Sumsal
0021 28500.000000000000000 0021 28500.000000000000000
......
...@@ -9,40 +9,40 @@ if (!$HA_CONNECT_SO) { ...@@ -9,40 +9,40 @@ if (!$HA_CONNECT_SO) {
--skip Needs a dynamically built ha_connect.so --skip Needs a dynamically built ha_connect.so
} }
CREATE FUNCTION json_array RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_array RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_array_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_array_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_array_add_values RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_array_add_values RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_array_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_array_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_nonull RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_nonull RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_list RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_list RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonvalue RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonvalue RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE AGGREGATE FUNCTION json_array_grp RETURNS STRING SONAME 'ha_connect'; --eval CREATE AGGREGATE FUNCTION json_array_grp RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE AGGREGATE FUNCTION json_object_grp RETURNS STRING SONAME 'ha_connect'; --eval CREATE AGGREGATE FUNCTION json_object_grp RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_item_merge RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_item_merge RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_get_item RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_get_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_string RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_string RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_int RETURNS INTEGER SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_int RETURNS INTEGER SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_real RETURNS REAL SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_real RETURNS REAL SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonlocate RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonlocate RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_locate_all RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_locate_all RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_file RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_file RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jfile_make RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jfile_make RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_serialize RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_serialize RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_add_values RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_add_values RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_nonull RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object_nonull RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_list RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object_list RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_get_item RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_get_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_item_merge RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_item_merge RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_file RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_file RETURNS STRING SONAME '$HA_CONNECT_SO';
--enable_query_log --enable_query_log
...@@ -1107,7 +1107,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) ...@@ -1107,7 +1107,7 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
} else switch (row->GetType()) { } else switch (row->GetType()) {
case TYPE_JOB: case TYPE_JOB:
if (!Nodes[i].Key) { if (!Nodes[i].Key) {
// Expected Array was not there // Expected Array was not there, wrap the value
if (i < Nod-1) if (i < Nod-1)
continue; continue;
else else
...@@ -1128,11 +1128,11 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i) ...@@ -1128,11 +1128,11 @@ PVAL JSONCOL::GetColumnValue(PGLOBAL g, PJSON row, int i)
else else
return CalculateArray(g, arp, i); return CalculateArray(g, arp, i);
} else if (i < Nod-1) { } else {
strcpy(g->Message, "Unexpected array"); // Unexpected array, unwrap it as [0]
val = NULL; // Not an expected array
} else
val = arp->GetValue(0); val = arp->GetValue(0);
i--;
} // endif's
break; break;
case TYPE_JVAL: case TYPE_JVAL:
...@@ -1275,29 +1275,30 @@ PJSON JSONCOL::GetRow(PGLOBAL g) ...@@ -1275,29 +1275,30 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
PJAR arp; PJAR arp;
PJSON nwr, row = Tjp->Row; PJSON nwr, row = Tjp->Row;
for (int i = 0; i < Nod-1 && row; i++) { for (int i = 0; i < Nod && row; i++) {
if (Nodes[i+1].Op == OP_XX) if (Nodes[i+1].Op == OP_XX)
break; break;
else switch (row->GetType()) { else switch (row->GetType()) {
case TYPE_JOB: case TYPE_JOB:
if (!Nodes[i].Key) if (!Nodes[i].Key)
// Expected Array was not there // Expected Array was not there, wrap the value
continue; continue;
val = ((PJOB)row)->GetValue(Nodes[i].Key); val = ((PJOB)row)->GetValue(Nodes[i].Key);
break; break;
case TYPE_JAR: case TYPE_JAR:
if (!Nodes[i].Key) {
arp = (PJAR)row; arp = (PJAR)row;
if (!Nodes[i].Key) {
if (Nodes[i].Op == OP_EQ) if (Nodes[i].Op == OP_EQ)
val = arp->GetValue(Nodes[i].Rank); val = arp->GetValue(Nodes[i].Rank);
else else
val = arp->GetValue(Nodes[i].Rx); val = arp->GetValue(Nodes[i].Rx);
} else { } else {
strcpy(g->Message, "Unexpected array"); // Unexpected array, unwrap it as [0]
val = NULL; // Not an expected array val = arp->GetValue(0);
i--;
} // endif Nodes } // endif Nodes
break; break;
...@@ -1370,7 +1371,6 @@ void JSONCOL::WriteColumn(PGLOBAL g) ...@@ -1370,7 +1371,6 @@ void JSONCOL::WriteColumn(PGLOBAL g)
PJAR arp = NULL; PJAR arp = NULL;
PJVAL jvp = NULL; PJVAL jvp = NULL;
PJSON jsp, row = GetRow(g); PJSON jsp, row = GetRow(g);
JTYP type = row->GetType();
switch (row->GetType()) { switch (row->GetType()) {
case TYPE_JOB: objp = (PJOB)row; break; case TYPE_JOB: objp = (PJOB)row; break;
......
...@@ -2440,7 +2440,7 @@ void DTVAL::SetTimeShift(void) ...@@ -2440,7 +2440,7 @@ void DTVAL::SetTimeShift(void)
} // end of SetTimeShift } // end of SetTimeShift
#if defined(connect_EXPORTS) //#if defined(connect_EXPORTS)
// Added by Alexander Barkov // Added by Alexander Barkov
static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime) static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime)
{ {
...@@ -2462,9 +2462,9 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm) ...@@ -2462,9 +2462,9 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm)
TIME_to_localtime(tm, &ltime); TIME_to_localtime(tm, &ltime);
return tm; return tm;
} // end of gmtime_mysql } // end of gmtime_mysql
#else //#else
#define gmtime_mysql(T,B) gmtime((const time_t *)T) //#define gmtime_mysql(T,B) gmtime((const time_t *)T)
#endif //#endif
/***********************************************************************/ /***********************************************************************/
/* GetGmTime: returns a pointer to a static tm structure obtained */ /* GetGmTime: returns a pointer to a static tm structure obtained */
...@@ -2493,7 +2493,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer) ...@@ -2493,7 +2493,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
return datm; return datm;
} // end of GetGmTime } // end of GetGmTime
#if defined(connect_EXPORTS) //#if defined(connect_EXPORTS)
// Added by Alexander Barkov // Added by Alexander Barkov
static time_t mktime_mysql(struct tm *ptm) static time_t mktime_mysql(struct tm *ptm)
{ {
...@@ -2504,9 +2504,9 @@ static time_t mktime_mysql(struct tm *ptm) ...@@ -2504,9 +2504,9 @@ static time_t mktime_mysql(struct tm *ptm)
time_t t= TIME_to_timestamp(current_thd, &ltime, &error_code); time_t t= TIME_to_timestamp(current_thd, &ltime, &error_code);
return error_code ? (time_t) -1 : t; return error_code ? (time_t) -1 : t;
} }
#else //#else
#define mktime_mysql mktime //#define mktime_mysql mktime
#endif //#endif
/***********************************************************************/ /***********************************************************************/
/* MakeTime: calculates a date value from a tm structures using the */ /* MakeTime: calculates a date value from a tm structures using the */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment