mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- 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
This commit is contained in:
@@ -118,7 +118,7 @@ extern "C" {
|
|||||||
/* Static variables */
|
/* Static variables */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
#if defined(STORAGE)
|
#if defined(STORAGE)
|
||||||
char sys_stamp[4] = SYS_STAMP;
|
char sys_stamp[5] = SYS_STAMP;
|
||||||
#else
|
#else
|
||||||
extern char sys_stamp[];
|
extern char sys_stamp[];
|
||||||
#endif
|
#endif
|
||||||
|
@@ -168,35 +168,21 @@
|
|||||||
#define JSONMAX 10 // JSON Default max grp size
|
#define JSONMAX 10 // JSON Default max grp size
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char version[]= "Version 1.03.0006 April 12, 2015";
|
char version[]= "Version 1.03.0007 April 30, 2015";
|
||||||
|
|
||||||
#if defined(WIN32)
|
#if defined(WIN32)
|
||||||
char compver[]= "Version 1.03.0006 " __DATE__ " " __TIME__;
|
char compver[]= "Version 1.03.0007 " __DATE__ " " __TIME__;
|
||||||
char slash= '\\';
|
char slash= '\\';
|
||||||
#else // !WIN32
|
#else // !WIN32
|
||||||
char slash= '/';
|
char slash= '/';
|
||||||
#endif // !WIN32
|
#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"
|
} // extern "C"
|
||||||
|
|
||||||
#if defined(XMAP)
|
#if defined(XMAP)
|
||||||
my_bool xmap= false;
|
my_bool xmap= false;
|
||||||
#endif // XMAP
|
#endif // XMAP
|
||||||
|
|
||||||
// uint worksize= 0;
|
|
||||||
ulong ha_connect::num= 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)
|
#if defined(XMSG)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
char *msg_path;
|
char *msg_path;
|
||||||
@@ -613,9 +599,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
|
|||||||
delete_table method in handler.cc
|
delete_table method in handler.cc
|
||||||
*/
|
*/
|
||||||
static const char *ha_connect_exts[]= {
|
static const char *ha_connect_exts[]= {
|
||||||
".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".ini", ".vec",
|
".dos", ".fix", ".csv", ".bin", ".fmt", ".dbf", ".xml", ".json", ".ini",
|
||||||
".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop", ".vop",
|
".vec", ".dnx", ".fnx", ".bnx", ".vnx", ".dbx", ".dop", ".fop", ".bop",
|
||||||
NULL};
|
".vop", NULL};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief
|
@brief
|
||||||
@@ -4730,6 +4716,25 @@ ha_rows ha_connect::records_in_range(uint inx, key_range *min_key,
|
|||||||
DBUG_RETURN(rows);
|
DBUG_RETURN(rows);
|
||||||
} // end of records_in_range
|
} // 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
|
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());
|
sql->ptr(), sql->length());
|
||||||
} // end of init_table_share
|
} // 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
|
@brief
|
||||||
connect_assisted_discovery() is called when creating a table with no columns.
|
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';
|
UPDATE t1 SET AuthorFN = 'Philippe' WHERE AuthorLN = 'Knab';
|
||||||
SELECT * FROM t1 WHERE ISBN = '9782212090819';
|
SELECT * FROM t1 WHERE ISBN = '9782212090819';
|
||||||
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
|
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 Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
|
||||||
9782212090819 fr applications Fran<EFBFBD>ois Knab 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
|
# To add an author a new table must be created
|
||||||
#
|
#
|
||||||
@@ -104,8 +104,8 @@ William J. Pardi
|
|||||||
INSERT INTO t2 VALUES('Charles','Dickens');
|
INSERT INTO t2 VALUES('Charles','Dickens');
|
||||||
SELECT * FROM t1;
|
SELECT * FROM t1;
|
||||||
ISBN Language Subject AuthorFN AuthorLN Title Translation Translator Publisher Location Year
|
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 Jean-Christophe Bernadac Construire une application XML NULL NULL Eyrolles Paris 1999
|
||||||
9782212090819 fr applications Fran<EFBFBD>ois Knab 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<70> de l'anglais par James Guerin Microsoft Press Paris 1999
|
9782840825685 fr applications William J. Pardi XML en Action adapt<70> de l'anglais par James Guerin Microsoft Press Paris 1999
|
||||||
9782840825685 fr applications Charles Dickens XML en Action adapt<70> de l'anglais par James Guerin Microsoft Press Paris 1999
|
9782840825685 fr applications Charles Dickens XML en Action adapt<70> de l'anglais par James Guerin Microsoft Press Paris 1999
|
||||||
DROP TABLE t1;
|
DROP TABLE t1;
|
||||||
@@ -127,11 +127,11 @@ line
|
|||||||
"SUBJECT": "applications",
|
"SUBJECT": "applications",
|
||||||
"AUTHOR": [
|
"AUTHOR": [
|
||||||
{
|
{
|
||||||
"FIRSTNAME": "Philippe",
|
"FIRSTNAME": "Jean-Christophe",
|
||||||
"LASTNAME": "Bernadac"
|
"LASTNAME": "Bernadac"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"FIRSTNAME": "Fran<EFBFBD>ois",
|
"FIRSTNAME": "Philippe",
|
||||||
"LASTNAME": "Knab"
|
"LASTNAME": "Knab"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@@ -968,6 +968,20 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
|
|||||||
else if (!Jpath)
|
else if (!Jpath)
|
||||||
Jpath = Name;
|
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);
|
pbuf = PlugDup(g, Jpath);
|
||||||
|
|
||||||
// The Jpath must be analyzed
|
// The Jpath must be analyzed
|
||||||
@@ -998,6 +1012,7 @@ bool JSONCOL::ParseJpath(PGLOBAL g)
|
|||||||
|
|
||||||
} // endfor i, p
|
} // endfor i, p
|
||||||
|
|
||||||
|
fin:
|
||||||
MulVal = AllocateValue(g, Value);
|
MulVal = AllocateValue(g, Value);
|
||||||
Parsed = true;
|
Parsed = true;
|
||||||
return false;
|
return false;
|
||||||
@@ -1147,7 +1162,7 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n)
|
|||||||
|
|
||||||
ars = MY_MIN(Tjp->Limit, arp->size());
|
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");
|
strcpy(g->Message, "Logical error expanding array");
|
||||||
longjmp(g->jumper[g->jump_level], 666);
|
longjmp(g->jumper[g->jump_level], 666);
|
||||||
} // endif jvp
|
} // endif jvp
|
||||||
@@ -1278,7 +1293,7 @@ PJSON JSONCOL::GetRow(PGLOBAL g)
|
|||||||
if (Nodes[i].Rank)
|
if (Nodes[i].Rank)
|
||||||
val = arp->GetValue(Nodes[i].Rank - 1);
|
val = arp->GetValue(Nodes[i].Rank - 1);
|
||||||
else
|
else
|
||||||
val = arp->GetValue(Nodes[i].Nx);
|
val = arp->GetValue(Nodes[i].Rx);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
val = NULL;
|
val = NULL;
|
||||||
@@ -1726,7 +1741,7 @@ bool TDBJSON::OpenDB(PGLOBAL g)
|
|||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
int TDBJSON::ReadDB(PGLOBAL g)
|
int TDBJSON::ReadDB(PGLOBAL g)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
N++;
|
N++;
|
||||||
|
|
||||||
|
@@ -25,7 +25,8 @@ typedef struct _jnode {
|
|||||||
PVAL CncVal; // To cont value used for OP_CNC
|
PVAL CncVal; // To cont value used for OP_CNC
|
||||||
PVAL Valp; // The internal array VALUE
|
PVAL Valp; // The internal array VALUE
|
||||||
int Rank; // The rank in array
|
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;
|
} JNODE, *PJNODE;
|
||||||
|
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
@@ -171,8 +171,10 @@ bool TDBMUL::InitFileNames(PGLOBAL g)
|
|||||||
} // endif hSearch
|
} // endif hSearch
|
||||||
|
|
||||||
while (n < PFNZ) {
|
while (n < PFNZ) {
|
||||||
strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
|
if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
|
||||||
pfn[n++] = PlugDup(g, filename);
|
strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName);
|
||||||
|
pfn[n++] = PlugDup(g, filename);
|
||||||
|
} // endif dwFileAttributes
|
||||||
|
|
||||||
if (!FindNextFile(hSearch, &FileData)) {
|
if (!FindNextFile(hSearch, &FileData)) {
|
||||||
rc = GetLastError();
|
rc = GetLastError();
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
/* */
|
/* */
|
||||||
/* COPYRIGHT: */
|
/* COPYRIGHT: */
|
||||||
/* ---------- */
|
/* ---------- */
|
||||||
/* (C) Copyright to PlugDB Software Development 2008-2014 */
|
/* (C) Copyright to PlugDB Software Development 2008-2015 */
|
||||||
/* Author: Olivier BERTRAND */
|
/* Author: Olivier BERTRAND */
|
||||||
/* */
|
/* */
|
||||||
/* WHAT THIS PROGRAM DOES: */
|
/* WHAT THIS PROGRAM DOES: */
|
||||||
|
@@ -52,7 +52,6 @@
|
|||||||
#include "tabutil.h"
|
#include "tabutil.h"
|
||||||
#include "ha_connect.h"
|
#include "ha_connect.h"
|
||||||
|
|
||||||
//extern "C" int zconv;
|
|
||||||
int GetConvSize(void);
|
int GetConvSize(void);
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
@@ -72,11 +71,8 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
|
|||||||
{
|
{
|
||||||
char key[256];
|
char key[256];
|
||||||
uint k;
|
uint k;
|
||||||
//TABLE_LIST table_list;
|
|
||||||
TABLE_SHARE *s;
|
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, "%s", db) + 1;
|
||||||
k += sprintf(key + k, "%s", name);
|
k += sprintf(key + k, "%s", name);
|
||||||
key[++k] = 0;
|
key[++k] = 0;
|
||||||
@@ -86,9 +82,6 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
|
|||||||
return NULL;
|
return NULL;
|
||||||
} // endif s
|
} // 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 (!open_table_def(thd, s, GTS_TABLE | GTS_VIEW)) {
|
||||||
if (!s->is_view) {
|
if (!s->is_view) {
|
||||||
if (stricmp(plugin_name(s->db_plugin)->str, "connect"))
|
if (stricmp(plugin_name(s->db_plugin)->str, "connect"))
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
/************* Value C++ Functions Source Code File (.CPP) *************/
|
/************* Value C++ Functions Source Code File (.CPP) *************/
|
||||||
/* Name: VALUE.CPP Version 2.5 */
|
/* 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. */
|
/* This file contains the VALUE and derived classes family functions. */
|
||||||
/* These classes contain values of different types. They are used so */
|
/* These classes contain values of different types. They are used so */
|
||||||
|
Reference in New Issue
Block a user