Skip to content

Commit

Permalink
Merge branch 'ob-10.1' into 10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Buggynours committed Dec 8, 2015
2 parents ad916ef + a18a3fb commit 32393e2
Show file tree
Hide file tree
Showing 19 changed files with 2,767 additions and 847 deletions.
4 changes: 2 additions & 2 deletions storage/connect/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
filter.h global.h ha_connect.h inihandl.h json.h jsonudf.h maputil.h msgid.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
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)
Expand Down
7 changes: 6 additions & 1 deletion storage/connect/filamzip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1404,8 +1404,13 @@ void ZLBFAM::Rewind(void)
// We must be positioned after the header block
if (CurBlk >= 0) { // Nothing to do if no block read yet
if (!Optimized) { // If optimized, fseek will be done in ReadBuffer
size_t st;

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);
OldBlk = -1;
} // endif Optimized
Expand Down
8 changes: 2 additions & 6 deletions storage/connect/ha_connect.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size

extern "C" {
char version[]= "Version 1.04.0003 October 25, 2015";
char version[]= "Version 1.04.0005 November 20, 2015";
#if defined(__WIN__)
char compver[]= "Version 1.04.0003 " __DATE__ " " __TIME__;
char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
Expand Down Expand Up @@ -6274,10 +6274,6 @@ bool ha_connect::FileExists(const char *fn, bool bf)
int n;
struct stat info;

if (check_access(ha_thd(), FILE_ACL, table->s->db.str,
NULL, NULL, 0, 0))
return true;

#if defined(__WIN__)
s= "\\";
#else // !__WIN__
Expand Down
48 changes: 37 additions & 11 deletions storage/connect/json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,15 +534,27 @@ PVAL ParseNumeric(PGLOBAL g, int& i, STRG& src)
/***********************************************************************/
PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
{
PSZ str = NULL;
bool b = false, err = true;
JOUT *jp;
FILE *fs = NULL;

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");
return NULL;
goto fin;
} else if (!fn) {
// Serialize to a string
jp = new(g) JOUTSTR(g);
Expand All @@ -552,7 +564,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
sprintf(g->Message, MSG(OPEN_MODE_ERROR),
"w", (int)errno, fn);
strcat(strcat(g->Message, ": "), strerror(errno));
return g->Message;
goto fin;;
} else if (pretty >= 2) {
// Serialize to a pretty file
jp = new(g)JOUTPRT(g, fs);
Expand Down Expand Up @@ -582,20 +594,20 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty)
if (fs) {
fputs(EL, fs);
fclose(fs);
return (err) ? g->Message : NULL;
str = (err) ? NULL : "Ok";
} else if (!err) {
PSZ str = ((JOUTSTR*)jp)->Strp;

str = ((JOUTSTR*)jp)->Strp;
jp->WriteChr('\0');
PlugSubAlloc(g, NULL, ((JOUTSTR*)jp)->N);
return str;
} else {
if (!g->Message[0])
strcpy(g->Message, "Error in Serialize");

return NULL;
} // endif's

fin:
g->jump_level--;
return str;
} // end of Serialize

/***********************************************************************/
Expand Down Expand Up @@ -1096,10 +1108,12 @@ PJVAL JARRAY::AddValue(PGLOBAL g, PJVAL jvp, int *x)
Last = jvp;

} else {
if (Last)
Last->Next = jvp;
else
if (!First)
First = jvp;
else if (Last == First)
First->Next = Last = jvp;
else
Last->Next = jvp;

Last = jvp;
} // endif x
Expand Down Expand Up @@ -1282,6 +1296,18 @@ PSZ JVALUE::GetText(PGLOBAL g, PSZ text)
return text;
} // 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. */
/***********************************************************************/
Expand Down
10 changes: 5 additions & 5 deletions storage/connect/json.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class JSON : public BLOCK {
virtual JTYP GetType(void) {return TYPE_JSON;}
virtual JTYP GetValType(void) {X return TYPE_JSON;}
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 PJAR GetKeyList(PGLOBAL g) {X return NULL;}
virtual PJVAL GetValue(const char *key) {X return NULL;}
Expand Down Expand Up @@ -223,7 +223,7 @@ class JARRAY : public JSON {
virtual void Clear(void) {First = Last = NULL; Size = 0;}
virtual JTYP GetType(void) {return TYPE_JAR;}
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 PJVAL GetValue(int i);
virtual bool Merge(PGLOBAL g, PJSON jsp);
Expand Down Expand Up @@ -271,9 +271,9 @@ class JVALUE : public JSON {
virtual double GetFloat(void);
virtual PSZ GetString(void);
virtual PSZ GetText(PGLOBAL g, PSZ text);
virtual void SetValue(PVAL valp) {Value = valp; Jsp = NULL;}
virtual void SetValue(PJSON jsp) {Jsp = jsp; Value = NULL;}
virtual void SetString(PGLOBAL g, PSZ s, short c = 0);
virtual void SetValue(PJSON jsp);
virtual void SetValue(PVAL valp) { Value = valp; Jsp = NULL; }
virtual void SetString(PGLOBAL g, PSZ s, short c = 0);
virtual void SetInteger(PGLOBAL g, int n);
virtual void SetBigint(PGLOBAL g, longlong ll);
virtual void SetFloat(PGLOBAL g, double f);
Expand Down
Loading

0 comments on commit 32393e2

Please sign in to comment.