Commit 32393e22 authored by Olivier Bertrand's avatar Olivier Bertrand

Merge branch 'ob-10.1' into 10.1

parents ad916ef3 a18a3fbd
...@@ -28,8 +28,8 @@ tabvct.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp ...@@ -28,8 +28,8 @@ tabvct.cpp tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp
array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h array.h blkfil.h block.h catalog.h checklvl.h colblk.h connect.h csort.h
engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h engmsg.h filamap.h filamdbf.h filamfix.h filamtxt.h filamvct.h filamzip.h
filter.h global.h ha_connect.h inihandl.h json.h maputil.h msgid.h mycat.h filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.h
myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h mycat.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h
user_connect.h valblk.h value.h xindex.h xobject.h xtable.h) user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
......
...@@ -1404,8 +1404,13 @@ void ZLBFAM::Rewind(void) ...@@ -1404,8 +1404,13 @@ void ZLBFAM::Rewind(void)
// We must be positioned after the header block // We must be positioned after the header block
if (CurBlk >= 0) { // Nothing to do if no block read yet if (CurBlk >= 0) { // Nothing to do if no block read yet
if (!Optimized) { // If optimized, fseek will be done in ReadBuffer if (!Optimized) { // If optimized, fseek will be done in ReadBuffer
size_t st;
rewind(Stream); rewind(Stream);
(void) fread(Zlenp, sizeof(int), 1, Stream);
if (!(st = fread(Zlenp, sizeof(int), 1, Stream)) && trace)
htrc("fread error %d in Rewind", errno);
fseek(Stream, *Zlenp + sizeof(int), SEEK_SET); fseek(Stream, *Zlenp + sizeof(int), SEEK_SET);
OldBlk = -1; OldBlk = -1;
} // endif Optimized } // endif Optimized
......
...@@ -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__
......
...@@ -534,15 +534,27 @@ PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src) ...@@ -534,15 +534,27 @@ PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
/***********************************************************************/ /***********************************************************************/
PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty) PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
{ {
PSZ str = NULL;
bool b = false, err = true; bool b = false, err = true;
JOUT *jp; JOUT *jp;
FILE *fs = NULL; FILE *fs = NULL;
g->Message[0] = 0; g->Message[0] = 0;
if (!jsp) { // Save stack and allocation environment and prepare error return
if (g->jump_level == MAX_JUMP) {
strcpy(g->Message, MSG(TOO_MANY_JUMPS));
return NULL;
} // endif jump_level
if (setjmp(g->jumper[++g->jump_level])) {
str = NULL;
goto fin;
} // endif jmp
if (!jsp) {
strcpy(g->Message, "Null json tree"); strcpy(g->Message, "Null json tree");
return NULL; goto fin;
} else if (!fn) { } else if (!fn) {
// Serialize to a string // Serialize to a string
jp = new(g) JOUTSTR(g); jp = new(g) JOUTSTR(g);
...@@ -552,7 +564,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty) ...@@ -552,7 +564,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
sprintf(g->Message, MSG(OPEN_MODE_ERROR), sprintf(g->Message, MSG(OPEN_MODE_ERROR),
"w", (int)errno, fn); "w", (int)errno, fn);
strcat(strcat(g->Message, ": "), strerror(errno)); strcat(strcat(g->Message, ": "), strerror(errno));
return g->Message; goto fin;;
} else if (pretty >= 2) { } else if (pretty >= 2) {
// Serialize to a pretty file // Serialize to a pretty file
jp = new(g)JOUTPRT(g, fs); jp = new(g)JOUTPRT(g, fs);
...@@ -582,20 +594,20 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty) ...@@ -582,20 +594,20 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
if (fs) { if (fs) {
fputs(EL, fs); fputs(EL, fs);
fclose(fs); fclose(fs);
return (err) ? g->Message : NULL; str = (err) ? NULL : "Ok";
} else if (!err) { } else if (!err) {
PSZ str = ((JOUTSTR*)jp)->Strp; str = ((JOUTSTR*)jp)->Strp;
jp->WriteChr('\0'); jp->WriteChr('\0');
PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N); PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
return str;
} else { } else {
if (!g->Message[0]) if (!g->Message[0])
strcpy(g->Message, "Error in Serialize"); strcpy(g->Message, "Error in Serialize");
return NULL;
} // endif's } // endif's
fin:
g->jump_level--;
return str;
} // end of Serialize } // end of Serialize
/***********************************************************************/ /***********************************************************************/
...@@ -1096,10 +1108,12 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x) ...@@ -1096,10 +1108,12 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
Last = jvp; Last = jvp;
} else { } else {
if (Last) if (!First)
Last->Next = jvp;
else
First = jvp; First = jvp;
else if (Last == First)
First->Next = Last = jvp;
else
Last->Next = jvp;
Last = jvp; Last = jvp;
} // endif x } // endif x
...@@ -1282,6 +1296,18 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text) ...@@ -1282,6 +1296,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 && 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. */
/***********************************************************************/ /***********************************************************************/
......
...@@ -149,7 +149,7 @@ class JSON : public BLOCK { ...@@ -149,7 +149,7 @@ class JSON : public BLOCK {
virtual JTYP GetType(void) {return TYPE_JSON;} virtual JTYP GetType(void) {return TYPE_JSON;}
virtual JTYP GetValType(void) {X return TYPE_JSON;} virtual JTYP GetValType(void) {X return TYPE_JSON;}
virtual void InitArray(PGLOBAL g) {X} virtual void InitArray(PGLOBAL g) {X}
virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;} //virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL) {X return NULL;}
virtual PJPR AddPair(PGLOBAL g, PSZ key) {X return NULL;} virtual PJPR AddPair(PGLOBAL g, PSZ key) {X return NULL;}
virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;} virtual PJAR GetKeyList(PGLOBAL g) {X return NULL;}
virtual PJVAL GetValue(const char *key) {X return NULL;} virtual PJVAL GetValue(const char *key) {X return NULL;}
...@@ -223,7 +223,7 @@ class JARRAY : public JSON { ...@@ -223,7 +223,7 @@ class JARRAY : public JSON {
virtual void Clear(void) {First = Last = NULL; Size = 0;} virtual void Clear(void) {First = Last = NULL; Size = 0;}
virtual JTYP GetType(void) {return TYPE_JAR;} virtual JTYP GetType(void) {return TYPE_JAR;}
virtual PJAR GetArray(void) {return this;} virtual PJAR GetArray(void) {return this;}
virtual PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL); PJVAL AddValue(PGLOBAL g, PJVAL jvp = NULL, int *x = NULL);
virtual void InitArray(PGLOBAL g); virtual void InitArray(PGLOBAL g);
virtual PJVAL GetValue(int i); virtual PJVAL GetValue(int i);
virtual bool Merge(PGLOBAL g, PJSON jsp); virtual bool Merge(PGLOBAL g, PJSON jsp);
...@@ -271,9 +271,9 @@ class JVALUE : public JSON { ...@@ -271,9 +271,9 @@ 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);
virtual void SetFloat(PGLOBAL g, double f); virtual void SetFloat(PGLOBAL g, double f);
......
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;}
...@@ -199,8 +239,10 @@ class JSNX : public BLOCK { ...@@ -199,8 +239,10 @@ class JSNX : public BLOCK {
my_bool SetJpath(PGLOBAL g, char *path, my_bool jb = false); my_bool SetJpath(PGLOBAL g, char *path, my_bool jb = false);
my_bool ParseJpath(PGLOBAL g); my_bool ParseJpath(PGLOBAL g);
void ReadValue(PGLOBAL g); void ReadValue(PGLOBAL g);
PJVAL GetValue(PGLOBAL g, PJSON row, int i, my_bool b = true); PJVAL GetRowValue(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,6 @@ class JSNX : public BLOCK { ...@@ -244,4 +287,6 @@ 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
my_bool Jb; // Must return json item
}; // end of class JSNX }; // end of class JSNX
...@@ -89,6 +89,7 @@ ...@@ -89,6 +89,7 @@
#if defined(XML_SUPPORT) #if defined(XML_SUPPORT)
#include "tabxml.h" #include "tabxml.h"
#endif // XML_SUPPORT #endif // XML_SUPPORT
#include "mycat.h"
/***********************************************************************/ /***********************************************************************/
/* Extern static variables. */ /* Extern static variables. */
......
This diff is collapsed.
{
"glossary": {
"title": "example glossary",
"GlossDiv": {
"title": "S",
"GlossList": {
"GlossEntry": {
"ID": "SGML",
"SortAs": "SGML",
"GlossTerm": "Standard Generalized Markup Language",
"Acronym": "SGML",
"Abbrev": "ISO 8879:1986",
"GlossDef": {
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
},
"GlossSee": "markup"
}
}
}
}
}
...@@ -9,40 +9,50 @@ if (!$HA_CONNECT_SO) { ...@@ -9,40 +9,50 @@ 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_key RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_object_list RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonvalue RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_object_list RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE AGGREGATE FUNCTION json_array_grp RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonvalue RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE AGGREGATE FUNCTION json_object_grp RETURNS STRING SONAME 'ha_connect'; --eval CREATE AGGREGATE FUNCTION json_array_grp RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_item_merge RETURNS STRING SONAME 'ha_connect'; --eval CREATE AGGREGATE FUNCTION json_object_grp RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_get_item RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_string RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_string RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_int RETURNS INTEGER SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_int RETURNS INTEGER SONAME 'ha_connect'; --eval CREATE FUNCTION jsonget_real RETURNS REAL SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonget_real RETURNS REAL SONAME 'ha_connect'; --eval CREATE FUNCTION jsonlocate RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jsonlocate RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_locate_all RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_locate_all RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_file RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_file RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jfile_make RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jfile_make RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsoncontains RETURNS INTEGER SONAME '$HA_CONNECT_SO';
CREATE FUNCTION json_serialize RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jsoncontains_path RETURNS INTEGER SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_get_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_add_values RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_set_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_insert_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_array_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_update_item RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_item_merge RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_nonull RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION json_serialize RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_add RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_delete RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_add_values RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_object_list RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_add RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_get_item RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_array_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_item_merge RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object RETURNS STRING SONAME '$HA_CONNECT_SO';
CREATE FUNCTION jbin_file RETURNS STRING SONAME 'ha_connect'; --eval CREATE FUNCTION jbin_object_nonull RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_object_key RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_object_add RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_object_delete RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_object_list RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_get_item RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_item_merge RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_set_item RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_insert_item RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_update_item RETURNS STRING SONAME '$HA_CONNECT_SO';
--eval CREATE FUNCTION jbin_file RETURNS STRING SONAME '$HA_CONNECT_SO';
--enable_query_log --enable_query_log
--disable_query_log --disable_query_log
DROP FUNCTION jsonvalue;
DROP FUNCTION json_array; DROP FUNCTION json_array;
DROP FUNCTION json_array_add; DROP FUNCTION json_array_add;
DROP FUNCTION json_array_add_values; DROP FUNCTION json_array_add_values;
DROP FUNCTION json_array_delete; DROP FUNCTION json_array_delete;
DROP FUNCTION json_object; DROP FUNCTION json_object;
DROP FUNCTION json_object_nonull; DROP FUNCTION json_object_nonull;
DROP FUNCTION json_object_key;
DROP FUNCTION json_object_add; DROP FUNCTION json_object_add;
DROP FUNCTION json_object_delete; DROP FUNCTION json_object_delete;
DROP FUNCTION json_object_list; DROP FUNCTION json_object_list;
DROP FUNCTION jsonvalue;
DROP FUNCTION json_array_grp; DROP FUNCTION json_array_grp;
DROP FUNCTION json_object_grp; DROP FUNCTION json_object_grp;
DROP FUNCTION json_item_merge; DROP FUNCTION jsonget_string;
DROP FUNCTION json_get_item; DROP FUNCTION jsonget_int;
DROP FUNCTION JsonGet_string; DROP FUNCTION jsonget_real;
DROP FUNCTION JsonGet_int;
DROP FUNCTION JsonGet_real;
DROP FUNCTION jsonlocate; DROP FUNCTION jsonlocate;
DROP FUNCTION json_locate_all; DROP FUNCTION json_locate_all;
DROP FUNCTION json_file; DROP FUNCTION json_file;
DROP FUNCTION json_serialize;
DROP FUNCTION jfile_make; DROP FUNCTION jfile_make;
DROP FUNCTION json_get_item;
DROP FUNCTION json_item_merge;
DROP FUNCTION jsoncontains;
DROP FUNCTION jsoncontains_path;
DROP FUNCTION json_set_item;
DROP FUNCTION json_insert_item;
DROP FUNCTION json_update_item;
DROP FUNCTION json_serialize;
DROP FUNCTION jbin_array; DROP FUNCTION jbin_array;
DROP FUNCTION jbin_array_add_values; DROP FUNCTION jbin_array_add_values;
DROP FUNCTION jbin_array_add; DROP FUNCTION jbin_array_add;
DROP FUNCTION jbin_array_delete; DROP FUNCTION jbin_array_delete;
DROP FUNCTION jbin_object; DROP FUNCTION jbin_object;
DROP FUNCTION jbin_object_nonull; DROP FUNCTION jbin_object_nonull;
DROP FUNCTION jbin_object_key;
DROP FUNCTION jbin_object_add; DROP FUNCTION jbin_object_add;
DROP FUNCTION jbin_object_delete; DROP FUNCTION jbin_object_delete;
DROP FUNCTION jbin_object_list; DROP FUNCTION jbin_object_list;
DROP FUNCTION jbin_get_item; DROP FUNCTION jbin_get_item;
DROP FUNCTION jbin_item_merge; DROP FUNCTION jbin_item_merge;
DROP FUNCTION jbin_set_item;
DROP FUNCTION jbin_insert_item;
DROP FUNCTION jbin_update_item;
DROP FUNCTION jbin_file; DROP FUNCTION jbin_file;
--enable_query_log --enable_query_log
......
This diff is collapsed.
This diff is collapsed.
...@@ -68,7 +68,8 @@ class JSONDEF : public DOSDEF { /* Table description */ ...@@ -68,7 +68,8 @@ class JSONDEF : public DOSDEF { /* Table description */
/***********************************************************************/ /***********************************************************************/
class TDBJSN : public TDBDOS { class TDBJSN : public TDBDOS {
friend class JSONCOL; friend class JSONCOL;
public: friend class JSONDEF;
public:
// Constructor // Constructor
TDBJSN(PJDEF tdp, PTXF txfp); TDBJSN(PJDEF tdp, PTXF txfp);
TDBJSN(TDBJSN *tdbp); TDBJSN(TDBJSN *tdbp);
...@@ -90,32 +91,34 @@ class TDBJSN : public TDBDOS { ...@@ -90,32 +91,34 @@ class TDBJSN : public TDBDOS {
virtual int Cardinality(PGLOBAL g); virtual int Cardinality(PGLOBAL g);
virtual int GetMaxSize(PGLOBAL g); virtual int GetMaxSize(PGLOBAL g);
virtual bool OpenDB(PGLOBAL g); virtual bool OpenDB(PGLOBAL g);
virtual bool PrepareWriting(PGLOBAL g);
virtual int ReadDB(PGLOBAL g); virtual int ReadDB(PGLOBAL g);
virtual bool PrepareWriting(PGLOBAL g);
virtual int WriteDB(PGLOBAL g);
protected: protected:
PJSON FindRow(PGLOBAL g); PJSON FindRow(PGLOBAL g);
int MakeTopTree(PGLOBAL g, PJSON jsp); int MakeTopTree(PGLOBAL g, PJSON jsp);
// Members // Members
PJSON Top; // The top JSON tree PGLOBAL G; // Support of parse memory
PJSON Row; // The current row PJSON Top; // The top JSON tree
PJSON Val; // The value of the current row PJSON Row; // The current row
PJCOL Colp; // The multiple column PJSON Val; // The value of the current row
JMODE Jmode; // MODE_OBJECT by default PJCOL Colp; // The multiple column
char *Objname; // The table object name JMODE Jmode; // MODE_OBJECT by default
char *Xcol; // Name of expandable column char *Objname; // The table object name
int Fpos; // The current row index char *Xcol; // Name of expandable column
int N; // The current Rownum int Fpos; // The current row index
int M; // Index of multiple value int N; // The current Rownum
int Limit; // Limit of multiple values int M; // Index of multiple value
int Pretty; // Depends on file structure int Limit; // Limit of multiple values
int NextSame; // Same next row int Pretty; // Depends on file structure
int SameRow; // Same row nb int NextSame; // Same next row
int Xval; // Index of expandable array int SameRow; // Same row nb
int B; // Array index base int Xval; // Index of expandable array
bool Strict; // Strict syntax checking int B; // Array index base
bool Comma; // Row has final comma bool Strict; // Strict syntax checking
bool Comma; // Row has final comma
}; // end of class TDBJSN }; // end of class TDBJSN
/* -------------------------- JSONCOL class -------------------------- */ /* -------------------------- JSONCOL class -------------------------- */
...@@ -154,7 +157,8 @@ class JSONCOL : public DOSCOL { ...@@ -154,7 +157,8 @@ class JSONCOL : public DOSCOL {
JSONCOL(void) {} JSONCOL(void) {}
// Members // Members
TDBJSN *Tjp; // To the JSN table block PGLOBAL G; // Support of parse memory
TDBJSN *Tjp; // To the JSN table block
PVAL MulVal; // To value used by multiple column PVAL MulVal; // To value used by multiple column
char *Jpath; // The json path char *Jpath; // The json path
JNODE *Nodes; // The intermediate objects JNODE *Nodes; // The intermediate objects
...@@ -170,7 +174,8 @@ class JSONCOL : public DOSCOL { ...@@ -170,7 +174,8 @@ class JSONCOL : public DOSCOL {
/* This is the JSON Access Method class declaration. */ /* This is the JSON Access Method class declaration. */
/***********************************************************************/ /***********************************************************************/
class TDBJSON : public TDBJSN { class TDBJSON : public TDBJSN {
friend class JSONCOL; friend class JSONDEF;
friend class JSONCOL;
public: public:
// Constructor // Constructor
TDBJSON(PJDEF tdp, PTXF txfp); TDBJSON(PJDEF tdp, PTXF txfp);
......
...@@ -60,7 +60,7 @@ extern "C" char version[]; ...@@ -60,7 +60,7 @@ extern "C" char version[];
#endif // !__WIN__ #endif // !__WIN__
#define TYPE_UNKNOWN 12 /* Must be greater than other types */ #define TYPE_UNKNOWN 12 /* Must be greater than other types */
#define XSTR(M) sizeof(M) - strlen(M) - 1 /* To avoid overflow*/ #define XLEN(M) sizeof(M) - strlen(M) - 1 /* To avoid overflow*/
/***********************************************************************/ /***********************************************************************/
/* Class and structure used by XMLColumns. */ /* Class and structure used by XMLColumns. */
...@@ -226,30 +226,30 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) ...@@ -226,30 +226,30 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
more: more:
if (vp->atp) { if (vp->atp) {
strncpy(colname, vp->atp->GetName(g), sizeof(colname)); strncpy(colname, vp->atp->GetName(g), sizeof(colname));
strncat(xcol->Name, colname, XSTR(xcol->Name)); strncat(xcol->Name, colname, XLEN(xcol->Name));
switch (vp->atp->GetText(g, buf, sizeof(buf))) { switch (vp->atp->GetText(g, buf, sizeof(buf))) {
case RC_INFO: case RC_INFO:
PushWarning(g, txmp); PushWarning(g, txmp);
case RC_OK: case RC_OK:
strncat(fmt, "@", XSTR(fmt)); strncat(fmt, "@", XLEN(fmt));
break; break;
default: default:
goto err; goto err;
} // enswitch rc } // enswitch rc
if (j) if (j)
strncat(fmt, colname, XSTR(fmt)); strncat(fmt, colname, XLEN(fmt));
} else { } else {
if (tdp->Usedom && node->GetType() != 1) if (tdp->Usedom && node->GetType() != 1)
continue; continue;
strncpy(colname, node->GetName(g), sizeof(colname)); strncpy(colname, node->GetName(g), sizeof(colname));
strncat(xcol->Name, colname, XSTR(xcol->Name)); strncat(xcol->Name, colname, XLEN(xcol->Name));
if (j) if (j)
strncat(fmt, colname, XSTR(fmt)); strncat(fmt, colname, XLEN(fmt));
if (j < lvl && ok) { if (j < lvl && ok) {
vp = lvlp[j+1]; vp = lvlp[j+1];
...@@ -267,9 +267,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) ...@@ -267,9 +267,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
if (!vp->atp) if (!vp->atp)
node = vp->nl->GetItem(g, vp->k++, node); node = vp->nl->GetItem(g, vp->k++, node);
strncat(fmt, colname, XSTR(fmt)); strncat(fmt, colname, XLEN(fmt));
strncat(fmt, "/", XSTR(fmt)); strncat(fmt, "/", XLEN(fmt));
strncat(xcol->Name, "_", XSTR(xcol->Name)); strncat(xcol->Name, "_", XLEN(xcol->Name));
j++; j++;
vp->n = (int)strlen(xcol->Name); vp->n = (int)strlen(xcol->Name);
vp->m = (int)strlen(fmt); vp->m = (int)strlen(fmt);
......
...@@ -2440,7 +2440,6 @@ void DTVAL::SetTimeShift(void) ...@@ -2440,7 +2440,6 @@ void DTVAL::SetTimeShift(void)
} // end of SetTimeShift } // end of SetTimeShift
#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 +2461,6 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm) ...@@ -2462,9 +2461,6 @@ 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
#define gmtime_mysql(T,B) gmtime((const time_t *)T)
#endif
/***********************************************************************/ /***********************************************************************/
/* GetGmTime: returns a pointer to a static tm structure obtained */ /* GetGmTime: returns a pointer to a static tm structure obtained */
...@@ -2493,7 +2489,6 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer) ...@@ -2493,7 +2489,6 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer)
return datm; return datm;
} // end of GetGmTime } // end of GetGmTime
#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 +2499,6 @@ static time_t mktime_mysql(struct tm *ptm) ...@@ -2504,9 +2499,6 @@ 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
#define mktime_mysql mktime
#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