Commit f5b05a11 authored by Olivier Bertrand's avatar Olivier Bertrand

- 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
parent eae8318b
......@@ -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
......
......@@ -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.
......
......@@ -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 Franois 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 Franois 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": "Franois",
"FIRSTNAME": "Philippe",
"LASTNAME": "Knab"
}
],
......
......@@ -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;
......
......@@ -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;
/***********************************************************************/
......
......@@ -171,8 +171,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
} // endif hSearch
while (n < PFNZ) {
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();
......
......@@ -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: */
......
......@@ -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"))
......
/************* 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 */
......
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