summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2015-05-01 15:59:12 +0200
committerOlivier Bertrand <bertrandop@gmail.com>2015-05-01 15:59:12 +0200
commitf5b05a11c1d8f5817b957f5397c288146a348b29 (patch)
tree185f88c7b78f1189782b45e2e03063b31b647990
parenteae8318b19da168e4676fe3da5b2f8665cb4104c (diff)
downloadmariadb-git-f5b05a11c1d8f5817b957f5397c288146a348b29.tar.gz
- Fix bug on updating JSON expanded values
modified: json.result tabjson.cpp tabjson.h - Fix bug on multiple tables (directories must be eliminated from file list) modified: tabmul.cpp - Update version modified: ha_connect.cc - Typo modified: global.h ha_connect.cc tabtbl.cpp tabutil.cpp value.cpp
-rw-r--r--storage/connect/global.h2
-rw-r--r--storage/connect/ha_connect.cc62
-rw-r--r--storage/connect/mysql-test/connect/r/json.result12
-rw-r--r--storage/connect/tabjson.cpp21
-rw-r--r--storage/connect/tabjson.h3
-rw-r--r--storage/connect/tabmul.cpp6
-rw-r--r--storage/connect/tabtbl.cpp2
-rw-r--r--storage/connect/tabutil.cpp7
-rw-r--r--storage/connect/value.cpp2
9 files changed, 57 insertions, 60 deletions
diff --git a/storage/connect/global.h b/storage/connect/global.h
index a67bb605755..10564d09815 100644
--- a/storage/connect/global.h
+++ b/storage/connect/global.h
@@ -118,7 +118,7 @@ extern "C" {
/* Static variables */
/***********************************************************************/
#if defined(STORAGE)
- char sys_stamp[4] = SYS_STAMP;
+ char sys_stamp[5] = SYS_STAMP;
#else
extern char sys_stamp[];
#endif
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index a3f88bfe7eb..8b1ca3519ee 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -168,35 +168,21 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.03.0006 April 12, 2015";
-
+ char version[]= "Version 1.03.0007 April 30, 2015";
#if defined(WIN32)
- char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !WIN32
char slash= '/';
#endif // !WIN32
-
-// int trace= 0; // The general trace value
-// ulong xconv= 0; // The type conversion option
-// int zconv= 0; // The text conversion size
} // extern "C"
#if defined(XMAP)
my_bool xmap= false;
#endif // XMAP
-// uint worksize= 0;
ulong ha_connect::num= 0;
-//int DTVAL::Shift= 0;
-/* CONNECT system variables */
-//atic int conv_size= 0;
-//atic uint work_size= 0;
-//atic ulong type_conv= 0;
-#if defined(XMAP)
-//atic my_bool indx_map= 0;
-#endif // XMAP
#if defined(XMSG)
extern "C" {
char *msg_path;
@@ -613,9 +599,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
delete_table method in handler.cc
*/
static const char *ha_connect_exts[]= {
- ".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
- ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop", ".vop",
- NULL};
+ ".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".json", ".ini",
+ ".vec", ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop",
+ ".vop", NULL};
/**
@brief
@@ -4730,6 +4716,25 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
DBUG_RETURN(rows);
} // end of records_in_range
+// Used to check whether a MYSQL table is created on itself
+bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
+ const char *db, char *tab, const char *src, int port)
+{
+ if (src)
+ return false;
+ else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
+ return false;
+ else if (db && stricmp(db, s->db.str))
+ return false;
+ else if (tab && stricmp(tab, s->table_name.str))
+ return false;
+ else if (port && port != (signed)GetDefaultPort())
+ return false;
+
+ strcpy(g->Message, "This MySQL table is defined on itself");
+ return true;
+} // end of CheckSelf
+
/**
Convert an ISO-8859-1 column name to UTF-8
*/
@@ -4933,25 +4938,6 @@ static int init_table_share(THD* thd,
sql->ptr(), sql->length());
} // end of init_table_share
-// Used to check whether a MYSQL table is created on itself
-bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host,
- const char *db, char *tab, const char *src, int port)
-{
- if (src)
- return false;
- else if (host && stricmp(host, "localhost") && strcmp(host, "127.0.0.1"))
- return false;
- else if (db && stricmp(db, s->db.str))
- return false;
- else if (tab && stricmp(tab, s->table_name.str))
- return false;
- else if (port && port != (signed)GetDefaultPort())
- return false;
-
- strcpy(g->Message, "This MySQL table is defined on itself");
- return true;
-} // end of CheckSelf
-
/**
@brief
connect_assisted_discovery() is called when creating a table with no columns.
diff --git a/storage/connect/mysql-test/connect/r/json.result b/storage/connect/mysql-test/connect/r/json.result
index fa6497e5bba..80b0a2cbc18 100644
--- a/storage/connect/mysql-test/connect/r/json.result
+++ b/storage/connect/mysql-test/connect/r/json.result
@@ -89,8 +89,8 @@ ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher L
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
SELECT * FROM t1 WHERE ISBN = '9782212090819';
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
-9782212090819 fr applications François Knab Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
#
# To add an author a new table must be created
#
@@ -104,8 +104,8 @@ William J. Pardi
INSERT INTO t2 VALUES('Charles','Dickens');
SELECT * FROM t1;
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
-9782212090819 fr applications Philippe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
-9782212090819 fr applications François Knab Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
+9782212090819 fr applications Philippe Knab Construire une application XML NULL NULL Eyrolles Paris 1999
9782840825685 fr applications William J. Pardi XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
9782840825685 fr applications Charles Dickens XML en Action adapté de l'anglais par James Guerin Microsoft Press Paris 1999
DROP TABLE t1;
@@ -127,11 +127,11 @@ line
"SUBJECT": "applications",
"AUTHOR": [
{
- "FIRSTNAME": "Philippe",
+ "FIRSTNAME": "Jean-Christophe",
"LASTNAME": "Bernadac"
},
{
- "FIRSTNAME": "François",
+ "FIRSTNAME": "Philippe",
"LASTNAME": "Knab"
}
],
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index 4432f164cf8..0231b369fc1 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -968,6 +968,20 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
else if (!Jpath)
Jpath = Name;
+ if (To_Tdb->GetOrig()) {
+ // This is an updated column, get nodes from origin
+ for (PJCOL colp = (PJCOL)Tjp->GetColumns(); colp;
+ colp = (PJCOL)colp->GetNext())
+ if (!stricmp(Name, colp->GetName())) {
+ Nod = colp->Nod;
+ Nodes = colp->Nodes;
+ goto fin;
+ } // endif Name
+
+ sprintf(g->Message, "Cannot parse updated column %s", Name);
+ return true;
+ } // endif To_Orig
+
pbuf = PlugDup(g, Jpath);
// The Jpath must be analyzed
@@ -998,6 +1012,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
} // endfor i, p
+ fin:
MulVal = AllocateValue(g, Value);
Parsed = true;
return false;
@@ -1147,7 +1162,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
ars = MY_MIN(Tjp->Limit, arp->size());
- if (!(jvp = arp->GetValue(Nodes[n].Nx))) {
+ if (!(jvp = arp->GetValue((Nodes[n].Rx = Nodes[n].Nx)))) {
strcpy(g->Message, "Logical error expanding array");
longjmp(g->jumper[g->jump_level], 666);
} // endif jvp
@@ -1278,7 +1293,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
if (Nodes[i].Rank)
val = arp->GetValue(Nodes[i].Rank - 1);
else
- val = arp->GetValue(Nodes[i].Nx);
+ val = arp->GetValue(Nodes[i].Rx);
} else
val = NULL;
@@ -1726,7 +1741,7 @@ bool TDBJSON::OpenDB(PGLOBAL g)
/***********************************************************************/
int TDBJSON::ReadDB(PGLOBAL g)
{
- int rc;
+ int rc;
N++;
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index 7e9896c3b75..10b9a9a9cc3 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -25,7 +25,8 @@ typedef struct _jnode {
PVAL CncVal; // To cont value used for OP_CNC
PVAL Valp; // The internal array VALUE
int Rank; // The rank in array
- int Nx; // Same row number
+ int Rx; // Read row number
+ int Nx; // Next to read row number
} JNODE, *PJNODE;
/***********************************************************************/
diff --git a/storage/connect/tabmul.cpp b/storage/connect/tabmul.cpp
index 36f3fc73210..94950584c9b 100644
--- a/storage/connect/tabmul.cpp
+++ b/storage/connect/tabmul.cpp
@@ -171,8 +171,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
} // endif hSearch
while (n < PFNZ) {
- strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
- pfn[n++] = PlugDup(g, filename);
+ if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
+ pfn[n++] = PlugDup(g, filename);
+ } // endif dwFileAttributes
if (!FindNextFile(hSearch, &FileData)) {
rc = GetLastError();
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 1ef70549751..2bf26a5f183 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -5,7 +5,7 @@
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to PlugDB Software Development 2008-2014 */
+/* (C) Copyright to PlugDB Software Development 2008-2015 */
/* Author: Olivier BERTRAND */
/* */
/* WHAT THIS PROGRAM DOES: */
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index 1c238bcf6f2..c26d766af01 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -52,7 +52,6 @@
#include "tabutil.h"
#include "ha_connect.h"
-//extern "C" int zconv;
int GetConvSize(void);
/************************************************************************/
@@ -72,11 +71,8 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
{
char key[256];
uint k;
-//TABLE_LIST table_list;
TABLE_SHARE *s;
-//table_list.init_one_table(db, strlen(db), name, strlen(name),
-// NULL, TL_IGNORE);
k = sprintf(key, "%s", db) + 1;
k += sprintf(key + k, "%s", name);
key[++k] = 0;
@@ -86,9 +82,6 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
return NULL;
} // endif s
-// 1 2 4 8
-//flags = GTS_TABLE | GTS_VIEW | GTS_NOLOCK | GTS_FORCE_DISCOVERY;
-
if (!open_table_def(thd, s, GTS_TABLE | GTS_VIEW)) {
if (!s->is_view) {
if (stricmp(plugin_name(s->db_plugin)->str, "connect"))
diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp
index 7d3d5463129..d14fc367cc7 100644
--- a/storage/connect/value.cpp
+++ b/storage/connect/value.cpp
@@ -1,7 +1,7 @@
/************* Value C++ Functions Source Code File (.CPP) *************/
/* Name: VALUE.CPP Version 2.5 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2001-2014 */
+/* (C) Copyright to the author Olivier BERTRAND 2001-2015 */
/* */
/* This file contains the VALUE and derived classes family functions. */
/* These classes contain values of different types. They are used so */