Commit 464947e6 authored by Olivier Bertrand's avatar Olivier Bertrand

- Fix a bug that caused a crash when doing delete on a json table with wrong syntax file

- Suppress MYSQL_SUPPORT preprocessor variable
parent 7733b247
...@@ -293,6 +293,7 @@ storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset ...@@ -293,6 +293,7 @@ storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset
[Dd]ebugPublic/ [Dd]ebugPublic/
[Rr]elease/ [Rr]elease/
[Rr]eleases/ [Rr]eleases/
[Rr]eleaseWithDebInfo/
x64/ x64/
x86/ x86/
build/ build/
......
...@@ -21,18 +21,18 @@ ha_connect.cc connect.cc user_connect.cc mycat.cc ...@@ -21,18 +21,18 @@ ha_connect.cc connect.cc user_connect.cc mycat.cc
fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h fmdlex.c osutil.c plugutil.c rcmsg.c rcmsg.h
array.cpp blkfil.cpp colblk.cpp csort.cpp array.cpp blkfil.cpp colblk.cpp csort.cpp
filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp filamap.cpp filamdbf.cpp filamfix.cpp filamtxt.cpp filamvct.cpp filamzip.cpp
filter.cpp json.cpp jsonudf.cpp maputil.cpp myutil.cpp plgdbutl.cpp reldef.cpp filter.cpp json.cpp jsonudf.cpp maputil.cpp myconn.cpp myutil.cpp plgdbutl.cpp
tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp tabmul.cpp reldef.cpp tabcol.cpp tabdos.cpp tabfix.cpp tabfmt.cpp tabjson.cpp table.cpp
taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp tabvct.cpp tabmul.cpp tabmysql.cpp taboccur.cpp tabpivot.cpp tabsys.cpp tabtbl.cpp tabutil.cpp
tabvir.cpp tabxcl.cpp valblk.cpp value.cpp xindex.cpp xobject.cpp 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 maputil.h msgid.h mycat.h
myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h resource.h myconn.h myutil.h os.h osutil.h plgcnx.h plgdbsem.h preparse.h reldef.h
tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h taboccur.h tabpivot.h resource.h tabcol.h tabdos.h tabfix.h tabfmt.h tabjson.h tabmul.h tabmysql.h
tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h user_connect.h taboccur.h tabpivot.h tabsys.h tabtbl.h tabutil.h tabvct.h tabvir.h tabxcl.h
valblk.h value.h xindex.h xobject.h xtable.h) user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
# #
# Definitions that are shared for all OSes # Definitions that are shared for all OSes
...@@ -166,24 +166,15 @@ IF(LIBXML2_FOUND OR MSXML_FOUND) ...@@ -166,24 +166,15 @@ IF(LIBXML2_FOUND OR MSXML_FOUND)
ENDIF() ENDIF()
# #
# MySQL # MySQL is now included unconditionnally
# #
OPTION(CONNECT_WITH_MYSQL IF(NOT UNIX)
"Compile CONNECT storage engine with remote MySQL connection support" #
ON) # TODO: remove this
# change to use "#include "../../include/mysql.h" in the sources.
IF(CONNECT_WITH_MYSQL) INCLUDE_DIRECTORIES("../../include/mysql")
SET(CONNECT_SOURCES ${CONNECT_SOURCES} ENDIF(NOT UNIX)
myconn.cpp myconn.h tabmysql.cpp tabmysql.h)
add_definitions(-DMYSQL_SUPPORT)
IF(NOT UNIX)
#
# TODO: remove this
# change to use "#include "../../include/mysql.h" in the sources.
INCLUDE_DIRECTORIES("../../include/mysql")
ENDIF(NOT UNIX)
ENDIF(CONNECT_WITH_MYSQL)
# #
......
...@@ -130,10 +130,8 @@ ...@@ -130,10 +130,8 @@
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
#include "odbccat.h" #include "odbccat.h"
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT)
#include "xtable.h" #include "xtable.h"
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "filamdbf.h" #include "filamdbf.h"
#include "tabxcl.h" #include "tabxcl.h"
#include "tabfmt.h" #include "tabfmt.h"
...@@ -5147,7 +5145,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5147,7 +5145,6 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
ok= true; ok= true;
break; break;
#if defined(MYSQL_SUPPORT)
case TAB_MYSQL: case TAB_MYSQL:
ok= true; ok= true;
...@@ -5187,14 +5184,15 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5187,14 +5184,15 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
ok= false; ok= false;
break; break;
#endif // MYSQL_SUPPORT
#if defined(WIN32) #if defined(WIN32)
case TAB_WMI: case TAB_WMI:
ok= true; ok= true;
break; break;
#endif // WIN32 #endif // WIN32
#if defined(PIVOT_SUPPORT)
case TAB_PIVOT: case TAB_PIVOT:
supfnc= FNC_NO; supfnc= FNC_NO;
#endif // PIVOT_SUPPORT
case TAB_PRX: case TAB_PRX:
case TAB_TBL: case TAB_TBL:
case TAB_XCL: case TAB_XCL:
...@@ -5293,12 +5291,10 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5293,12 +5291,10 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
break; break;
#endif // ODBC_SUPPORT #endif // ODBC_SUPPORT
#if defined(MYSQL_SUPPORT)
case TAB_MYSQL: case TAB_MYSQL:
qrp= MyColumns(g, thd, host, db, user, pwd, tab, qrp= MyColumns(g, thd, host, db, user, pwd, tab,
NULL, port, fnc == FNC_COL); NULL, port, fnc == FNC_COL);
break; break;
#endif // MYSQL_SUPPORT
case TAB_CSV: case TAB_CSV:
qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL); qrp= CSVColumns(g, dpath, fn, spc, qch, hdr, mxe, fnc == FNC_COL);
break; break;
...@@ -5324,9 +5320,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd, ...@@ -5324,9 +5320,11 @@ static int connect_assisted_discovery(handlerton *hton, THD* thd,
} // endif OcrColumns } // endif OcrColumns
break; break;
#if defined(PIVOT_SUPPORT)
case TAB_PIVOT: case TAB_PIVOT:
qrp= PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port); qrp= PivotColumns(g, tab, src, pic, fcl, skc, host, db, user, pwd, port);
break; break;
#endif // PIVOT_SUPPORT
case TAB_VIR: case TAB_VIR:
qrp= VirColumns(g, tab, (char*)db, fnc == FNC_COL); qrp= VirColumns(g, tab, (char*)db, fnc == FNC_COL);
break; break;
......
...@@ -78,9 +78,7 @@ ...@@ -78,9 +78,7 @@
#include "tabxml.h" #include "tabxml.h"
#endif // XML_SUPPORT #endif // XML_SUPPORT
#include "tabmul.h" #include "tabmul.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#if defined(ODBC_SUPPORT) #if defined(ODBC_SUPPORT)
#define NODBC #define NODBC
#include "tabodbc.h" #include "tabodbc.h"
...@@ -122,10 +120,8 @@ TABTYPE GetTypeID(const char *type) ...@@ -122,10 +120,8 @@ TABTYPE GetTypeID(const char *type)
#ifdef ODBC_SUPPORT #ifdef ODBC_SUPPORT
: (!stricmp(type, "ODBC")) ? TAB_ODBC : (!stricmp(type, "ODBC")) ? TAB_ODBC
#endif #endif
#ifdef MYSQL_SUPPORT
: (!stricmp(type, "MYSQL")) ? TAB_MYSQL : (!stricmp(type, "MYSQL")) ? TAB_MYSQL
: (!stricmp(type, "MYPRX")) ? TAB_MYSQL : (!stricmp(type, "MYPRX")) ? TAB_MYSQL
#endif
: (!stricmp(type, "DIR")) ? TAB_DIR : (!stricmp(type, "DIR")) ? TAB_DIR
#ifdef WIN32 #ifdef WIN32
: (!stricmp(type, "MAC")) ? TAB_MAC : (!stricmp(type, "MAC")) ? TAB_MAC
...@@ -537,9 +533,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am) ...@@ -537,9 +533,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, LPCSTR name, LPCSTR am)
case TAB_XCL: tdp= new(g) XCLDEF; break; case TAB_XCL: tdp= new(g) XCLDEF; break;
case TAB_PRX: tdp= new(g) PRXDEF; break; case TAB_PRX: tdp= new(g) PRXDEF; break;
case TAB_OCCUR: tdp= new(g) OCCURDEF; break; case TAB_OCCUR: tdp= new(g) OCCURDEF; break;
#if defined(MYSQL_SUPPORT)
case TAB_MYSQL: tdp= new(g) MYSQLDEF; break; case TAB_MYSQL: tdp= new(g) MYSQLDEF; break;
#endif // MYSQL_SUPPORT
#if defined(PIVOT_SUPPORT) #if defined(PIVOT_SUPPORT)
case TAB_PIVOT: tdp= new(g) PIVOTDEF; break; case TAB_PIVOT: tdp= new(g) PIVOTDEF; break;
#endif // PIVOT_SUPPORT #endif // PIVOT_SUPPORT
......
...@@ -1540,12 +1540,11 @@ int TDBJSON::MakeNewDoc(PGLOBAL g) ...@@ -1540,12 +1540,11 @@ int TDBJSON::MakeNewDoc(PGLOBAL g)
int TDBJSON::MakeDocument(PGLOBAL g) int TDBJSON::MakeDocument(PGLOBAL g)
{ {
char filename[_MAX_PATH]; char filename[_MAX_PATH];
int rc = RC_OK;
DWORD drc; DWORD drc;
if (Done) if (Done)
return RC_OK; return RC_OK;
else
Done = true;
// Now open the JSON file // Now open the JSON file
PlugSetPath(filename, Txfp->To_File, GetPath()); PlugSetPath(filename, Txfp->To_File, GetPath());
...@@ -1553,16 +1552,11 @@ int TDBJSON::MakeDocument(PGLOBAL g) ...@@ -1553,16 +1552,11 @@ int TDBJSON::MakeDocument(PGLOBAL g)
/*********************************************************************/ /*********************************************************************/
/* Get top of the parsed tree and the inside table document. */ /* Get top of the parsed tree and the inside table document. */
/*********************************************************************/ /*********************************************************************/
Top = MakeJsonTree(g, filename, Objname, Pretty, Doc, drc); if (!(Top = MakeJsonTree(g, filename, Objname, Pretty, Doc, drc)))
rc = (drc == ENOENT && Mode == MODE_INSERT) ? MakeNewDoc(g) : RC_FX;
if (!Top) {
if (drc != ENOENT || Mode != MODE_INSERT)
return RC_FX;
return MakeNewDoc(g); Done = (rc == RC_OK);
} // endif !Top return rc;
return RC_OK;
} // end of MakeDocument } // end of MakeDocument
#if 0 #if 0
......
...@@ -45,9 +45,7 @@ ...@@ -45,9 +45,7 @@
#include "tabcol.h" #include "tabcol.h"
#include "taboccur.h" #include "taboccur.h"
#include "xtable.h" #include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" #include "mycat.h"
......
...@@ -70,9 +70,7 @@ ...@@ -70,9 +70,7 @@
#include "tabcol.h" #include "tabcol.h"
#include "tabdos.h" // TDBDOS and DOSCOL class dcls #include "tabdos.h" // TDBDOS and DOSCOL class dcls
#include "tabtbl.h" #include "tabtbl.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" // For GetHandler #include "mycat.h" // For GetHandler
......
...@@ -48,9 +48,7 @@ ...@@ -48,9 +48,7 @@
#include "resource.h" #include "resource.h"
#include "reldef.h" #include "reldef.h"
#include "xtable.h" #include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "tabcol.h" #include "tabcol.h"
#include "tabutil.h" #include "tabutil.h"
#include "ha_connect.h" #include "ha_connect.h"
...@@ -94,19 +92,13 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, ...@@ -94,19 +92,13 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db,
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"))
#if defined(MYSQL_SUPPORT)
mysql = true; mysql = true;
#else // !MYSQL_SUPPORT else
sprintf(g->Message, "%s.%s is not a CONNECT table", db, name);
return NULL;
#endif // MYSQL_SUPPORT
} else
mysql = false; mysql = false;
} else { } else
mysql = true; mysql = true;
} // endif is_view
} else { } else {
if (thd->is_error()) if (thd->is_error())
...@@ -428,7 +420,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b) ...@@ -428,7 +420,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
} // endif srcdef } // endif srcdef
if (mysql) { if (mysql) {
#if defined(MYSQL_SUPPORT)
// Access sub-table via MySQL API // Access sub-table via MySQL API
if (!(tdbp= cat->GetTable(g, tabp, Mode, "MYPRX"))) { if (!(tdbp= cat->GetTable(g, tabp, Mode, "MYPRX"))) {
char buf[MAX_STR]; char buf[MAX_STR];
...@@ -445,11 +436,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b) ...@@ -445,11 +436,6 @@ PTDBASE TDBPRX::GetSubTable(PGLOBAL g, PTABLE tabp, bool b)
if (Mode == MODE_UPDATE || Mode == MODE_DELETE) if (Mode == MODE_UPDATE || Mode == MODE_DELETE)
tdbp->SetName(Name); // For Make_Command tdbp->SetName(Name); // For Make_Command
#else // !MYSQL_SUPPORT
sprintf(g->Message, "%s.%s is not a CONNECT table",
db, tblp->Name);
goto err;
#endif // MYSQL_SUPPORT
} else { } else {
// Sub-table is a CONNECT table // Sub-table is a CONNECT table
tabp->Next = To_Table; // For loop checking tabp->Next = To_Table; // For loop checking
......
...@@ -51,9 +51,7 @@ ...@@ -51,9 +51,7 @@
#include "tabcol.h" #include "tabcol.h"
#include "tabxcl.h" #include "tabxcl.h"
#include "xtable.h" #include "xtable.h"
#if defined(MYSQL_SUPPORT)
#include "tabmysql.h" #include "tabmysql.h"
#endif // MYSQL_SUPPORT
#include "ha_connect.h" #include "ha_connect.h"
#include "mycat.h" #include "mycat.h"
......
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