Skip to content

Commit ec4795a

Browse files
committed
In CONNECT version 1.6.10 NOSQL facility is enhanced by a new way to retrieve NOSQL data.
In addition to files and Mongo collections, JSON as well as XML and CSV data can be retrieved from the net as answers from REST queries. Because it uses and external package (cpprestsdk) this is currently available only to MariaDB servers compiled from source. -- Add the REST support when Microsoft Casablanca package (cpprestsdk) is installed. -- Also include some changes specific to MariaDB 10.3. modified: storage/connect/CMakeLists.txt -- Add conditional REST support -- Added string options HTTP and URI. -- Added added internal table type TAB_REST. modified: storage/connect/ha_connect.cc modified: storage/connect/mycat.cc modified: storage/connect/mycat.h modified: storage/connect/plgdbsem.h -- Fix MDEV-19648 Variable connect_conv_size doesn't change -- Change Variable wrong block parameter from 8169 to 1. -- Also change connect_conv_size default value to 1024. modified: storage/connect/ha_connect.cc -- Avoid possible buffer overflow -- In particular by the function ShowValue. modified: storage/connect/tabdos.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/value.cpp modified: storage/connect/value.h -- Add some cast to avoid some compiler warnings modified: storage/connect/filamdbf.cpp -- Fix some C++ error modified: storage/connect/javaconn.cpp modified: storage/connect/jmgoconn.cpp modified: storage/connect/plugutil.cpp -- Miscellaneous Typo and warning suppressing changes modified: storage/connect/connect.cpp modified: storage/connect/connect.h modified: storage/connect/filamvct.cpp modified: storage/connect/inihandl.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/libdoc.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabtbl.cpp modified: storage/connect/tabxml.cpp modified: storage/connect/user_connect.cc modified: storage/connect/user_connect.h -- Update failing test results and disbling modified: storage/connect/mysql-test/connect/disabled.def modified: storage/connect/mysql-test/connect/r/dir.result modified: storage/connect/mysql-test/connect/r/grant.result modified: storage/connect/mysql-test/connect/r/jdbc.result modified: storage/connect/mysql-test/connect/r/jdbc_postgresql.result modified: storage/connect/mysql-test/connect/r/xml.result modified: storage/connect/mysql-test/connect/r/xml2.result modified: storage/connect/mysql-test/connect/r/xml2_mult.result modified: storage/connect/mysql-test/connect/r/xml_mult.result -- Add an option modified: storage/connect/mysql-test/connect/t/grant.test
1 parent 66197aa commit ec4795a

38 files changed

+752
-400
lines changed

storage/connect/CMakeLists.txt

Lines changed: 48 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
# You should have received a copy of the GNU General Public License
1313
# along with this program; if not, write to the Free Software
14-
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14+
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
1515

1616
SET(CONNECT_PLUGIN_STATIC "connect")
1717
SET(CONNECT_PLUGIN_DYNAMIC "connect")
@@ -40,21 +40,26 @@ user_connect.h valblk.h value.h xindex.h xobject.h xtable.h)
4040
add_definitions( -DMARIADB -DFORCE_INIT_OF_VARS -Dconnect_EXPORTS)
4141
add_definitions( -DHUGE_SUPPORT -DGZ_SUPPORT )
4242

43+
macro(DISABLE_WARNING W)
44+
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-error=${W}")
45+
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-${W}" DEBUG)
46+
endmacro()
4347

4448
#
4549
# OS specific C flags, definitions and source files.
4650
#
4751
IF(UNIX)
4852
MY_CHECK_AND_SET_COMPILER_FLAG("-Wall -Wmissing-declarations")
4953
if(NOT WITH_WARNINGS)
50-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-function")
51-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-variable")
52-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-unused-value")
53-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-parentheses")
54-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-strict-aliasing")
55-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-misleading-indentation")
56-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-format-truncation")
57-
MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough")
54+
DISABLE_WARNING("unused-function")
55+
DISABLE_WARNING("unused-variable")
56+
DISABLE_WARNING("unused-value")
57+
DISABLE_WARNING("parentheses")
58+
DISABLE_WARNING("strict-aliasing")
59+
DISABLE_WARNING("misleading-indentation")
60+
DISABLE_WARNING("format-truncation")
61+
DISABLE_WARNING("implicit-fallthrough")
62+
DISABLE_WARNING("type-limits")
5863
endif(NOT WITH_WARNINGS)
5964

6065
add_definitions( -DUNIX -DLINUX -DUBUNTU )
@@ -113,6 +118,7 @@ IF(CONNECT_WITH_LIBXML2)
113118
FIND_PACKAGE(LibXml2)
114119
IF (LIBXML2_FOUND)
115120
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
121+
SET(ZLIB_LIBRARY "z") # see ZLIB_INCLUDE_DIR below
116122
SET(XML_LIBRARY ${LIBXML2_LIBRARIES})
117123
SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h)
118124
add_definitions(-DLIBXML2_SUPPORT)
@@ -128,7 +134,6 @@ IF(WIN32)
128134
OPTION(CONNECT_WITH_MSXML "Compile CONNECT storage engine with MSXML support" ON)
129135
IF(CONNECT_WITH_MSXML)
130136
add_definitions(-DMSX6 -DDOMDOC_SUPPORT)
131-
message(STATUS "MSXML library version: msxml6")
132137
SET(MSXML_FOUND 1)
133138
SET(CONNECT_SOURCES ${CONNECT_SOURCES} domdoc.cpp domdoc.h)
134139
ENDIF(CONNECT_WITH_MSXML)
@@ -168,7 +173,8 @@ IF(CONNECT_WITH_ODBC)
168173
# the library 'libiodbc' gets compiled with 'sql'h.
169174
# This will also need changes in the sources (e.g. #include <isql.h>).
170175

171-
find_path(ODBC_INCLUDE_DIR sql.h
176+
find_file(ODBC_INCLUDES sql.h
177+
PATHS
172178
/usr/include
173179
/usr/include/odbc
174180
/usr/local/include
@@ -178,7 +184,7 @@ IF(CONNECT_WITH_ODBC)
178184
#"C:/Program Files/Microsoft SDKs/Windows/v7.0A/include"
179185
#"C:/Program Files/Microsoft SDKs/Windows/v6.0a/include"
180186
#"C:/Program Files (x86)/Microsoft SDKs/Windows/v7.0A/include"
181-
DOC "Specify the directory containing sql.h."
187+
DOC "Specify the path to sql.h."
182188
)
183189

184190
find_library(ODBC_LIBRARY
@@ -197,9 +203,10 @@ IF(CONNECT_WITH_ODBC)
197203
DOC "Specify the ODBC driver manager library here."
198204
)
199205

200-
mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDE_DIR)
206+
mark_as_advanced(ODBC_LIBRARY ODBC_INCLUDES)
201207

202-
IF(ODBC_INCLUDE_DIR AND ODBC_LIBRARY)
208+
IF(ODBC_INCLUDES AND ODBC_LIBRARY)
209+
get_filename_component(ODBC_INCLUDE_DIR "${ODBC_INCLUDES}" PATH)
203210
set(CMAKE_REQUIRED_LIBRARIES ${ODBC_LIBRARY})
204211
set(CMAKE_REQUIRED_INCLUDES ${ODBC_INCLUDE_DIR})
205212
CHECK_CXX_SOURCE_COMPILES(
@@ -305,6 +312,24 @@ IF(CONNECT_WITH_MONGO)
305312
ENDIF(CONNECT_WITH_MONGO)
306313

307314

315+
#
316+
# REST
317+
#
318+
319+
#OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON)
320+
321+
IF(CONNECT_WITH_REST)
322+
MESSAGE(STATUS "=====> REST support is ON")
323+
FIND_PACKAGE(cpprestsdk)
324+
IF (cpprestsdk_FOUND)
325+
MESSAGE(STATUS "=====> cpprestsdk found")
326+
SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h)
327+
add_definitions(-DREST_SUPPORT)
328+
ELSE(NOT cpprestsdk_FOUND)
329+
MESSAGE(STATUS "=====> cpprestsdk package not found")
330+
ENDIF (cpprestsdk_FOUND)
331+
ENDIF(CONNECT_WITH_ZIP)
332+
308333
#
309334
# XMAP
310335
#
@@ -330,6 +355,14 @@ IF(NOT TARGET connect)
330355
RETURN()
331356
ENDIF()
332357

358+
# Don't link with bundled zlib and systel libxml2 at the same time.
359+
# System libxml2 uses system zlib, might conflict with the bundled one.
360+
IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB)
361+
GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES)
362+
LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR})
363+
SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS})
364+
ENDIF()
365+
333366
IF(WIN32)
334367
IF (libmongoc-1.0_FOUND)
335368
SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS
@@ -338,14 +371,7 @@ IF(WIN32)
338371

339372
# Install some extra files that belong to connect engine
340373

341-
# install ha_connect.lib
342-
GET_TARGET_PROPERTY(CONNECT_LOCATION connect LOCATION)
343-
STRING(REPLACE "dll" "lib" CONNECT_LIB ${CONNECT_LOCATION})
344-
IF(CMAKE_CONFIGURATION_TYPES)
345-
STRING(REPLACE "${CMAKE_CFG_INTDIR}" "\${CMAKE_INSTALL_CONFIG_NAME}"
346-
CONNECT_LIB ${CONNECT_LIB})
347-
ENDIF()
348-
INSTALL(FILES ${CONNECT_LIB}
374+
INSTALL(FILES "$<TARGET_FILE_DIR:connect>/ha_connect.lib"
349375
DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine)
350376
ENDIF(WIN32)
351377

storage/connect/connect.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
1414
You should have received a copy of the GNU General Public License
1515
along with this program; if not, write to the Free Software
16-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
16+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
1717

1818
/***********************************************************************/
1919
/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2017 */

storage/connect/connect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
1212
You should have received a copy of the GNU General Public License
1313
along with this program; if not, write to the Free Software
14-
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */
14+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */
1515

1616
/**************** Cnt H Declares Source Code File (.H) *****************/
1717
/* Name: CONNECT.H Version 2.4 */

storage/connect/filamdbf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ int DBFFAM::Cardinality(PGLOBAL g)
447447

448448
if (rln && Lrecl != rln) {
449449
// This happens always on some Linux platforms
450-
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln);
450+
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln);
451451

452452
if (Accept) {
453453
Lrecl = rln;
@@ -967,7 +967,7 @@ int DBMFAM::Cardinality(PGLOBAL g)
967967

968968
if (rln && Lrecl != rln) {
969969
// This happens always on some Linux platforms
970-
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, rln);
970+
sprintf(g->Message, MSG(BAD_LRECL), Lrecl, (ushort)rln);
971971

972972
if (Accept) {
973973
Lrecl = rln;

storage/connect/filamvct.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,6 @@
6565
extern int num_read, num_there; // Statistics
6666
static int num_write;
6767

68-
#if defined(UNIX)
69-
// Add dummy strerror (NGC)
70-
char *strerror(int num);
71-
#endif // UNIX
72-
7368
/***********************************************************************/
7469
/* Header containing block info for not split VEC tables. */
7570
/* Block and last values can be calculated from NumRec and Nrec. */

0 commit comments

Comments
 (0)