Commit a88bdbdc authored by Olivier Bertrand's avatar Olivier Bertrand

Merge branch 'ob-10.1' into 10.1

parents c6e13e3b 46f3e320
...@@ -404,6 +404,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr) ...@@ -404,6 +404,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
rc = RC_FX; rc = RC_FX;
} catch (const char *msg) { } catch (const char *msg) {
strcpy(g->Message, msg); strcpy(g->Message, msg);
rc = RC_NF;
} // end catch } // end catch
return rc; return rc;
......
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -381,3 +382,4 @@ planner 167 41.75 ...@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar'; SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -381,3 +382,4 @@ planner 167 41.75 ...@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -380,3 +381,4 @@ planner 167 41.75 ...@@ -380,3 +381,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -376,3 +377,4 @@ planner 167 41.750000 ...@@ -376,3 +377,4 @@ planner 167 41.750000
postcard 23 5.750000 postcard 23 5.750000
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar'; SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo2.jar';
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -377,3 +378,4 @@ planner 167 41.75 ...@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
SET GLOBAL connect_class_path='C:/MariaDB-10.1/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar'; SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/Mongo3.jar';
set connect_enable_mongo=1;
# #
# Test the MONGO table type # Test the MONGO table type
# #
...@@ -377,3 +378,4 @@ planner 167 41.75 ...@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75 postcard 23 5.75
DROP TABLE t1; DROP TABLE t1;
true true
set connect_enable_mongo=0;
connect master,127.0.0.1,root,,test,$MASTER_MYPORT,;
connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,;
connection master;
CREATE DATABASE connect; CREATE DATABASE connect;
connection slave;
CREATE DATABASE connect; CREATE DATABASE connect;
connection default;
# #
# Checking thread TBL tables # Checking thread TBL tables
# #
...@@ -11,6 +16,7 @@ a b ...@@ -11,6 +16,7 @@ a b
1 test01 1 test01
2 test02 2 test02
3 test03 3 test03
connection master;
CREATE TABLE rt2 (a int, b char(10)); CREATE TABLE rt2 (a int, b char(10));
INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07'); INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07');
SELECT * FROM rt2; SELECT * FROM rt2;
...@@ -19,6 +25,7 @@ a b ...@@ -19,6 +25,7 @@ a b
5 test05 5 test05
6 test06 6 test06
7 test07 7 test07
connection slave;
USE test; USE test;
CREATE TABLE rt3 (a int, b char(10)); CREATE TABLE rt3 (a int, b char(10));
INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11'); INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11');
...@@ -44,6 +51,7 @@ a b ...@@ -44,6 +51,7 @@ a b
17 test17 17 test17
18 test18 18 test18
19 test19 19 test19
connection default;
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:MASTER_PORT/test/rt2'; CONNECTION='mysql://root@127.0.0.1:MASTER_PORT/test/rt2';
SELECT * FROM t2; SELECT * FROM t2;
...@@ -79,7 +87,7 @@ a b ...@@ -79,7 +87,7 @@ a b
CREATE TABLE total (a int, b char(10)) CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5' ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=PORT'; OPTION_LIST='thread=yes,port=PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by a desc; SELECT * FROM total order by a desc;
a b a b
19 test19 19 test19
...@@ -103,8 +111,11 @@ a b ...@@ -103,8 +111,11 @@ a b
1 test01 1 test01
0 test00 0 test00
set connect_xtrace=0; set connect_xtrace=0;
connection master;
DROP TABLE rt2; DROP TABLE rt2;
connection slave;
DROP TABLE rt3,rt4,rt5; DROP TABLE rt3,rt4,rt5;
connection default;
DROP TABLE t1,t2,t3,t4,t5,total; DROP TABLE t1,t2,t3,t4,t5,total;
# #
# Old thread TBL tables test modified # Old thread TBL tables test modified
...@@ -118,7 +129,7 @@ SELECT * FROM t2; ...@@ -118,7 +129,7 @@ SELECT * FROM t2;
v v
22 22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
v v
22 22
...@@ -137,7 +148,7 @@ SELECT * FROM t2; ...@@ -137,7 +148,7 @@ SELECT * FROM t2;
v v
22 22
CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';; CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=PORT';;
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
v v
22 22
...@@ -146,7 +157,9 @@ set connect_xtrace=0; ...@@ -146,7 +157,9 @@ set connect_xtrace=0;
DROP TABLE total; DROP TABLE total;
DROP TABLE t1; DROP TABLE t1;
DROP TABLE t2; DROP TABLE t2;
connection master;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1; DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect; DROP DATABASE IF EXISTS connect;
let $MONGO= C:/PROGRA~1/MongoDB/Server/3.4/bin/mongo; let $MONGO= C:/Applic/MongoDB/Server/3.6/bin/mongo;
let $MONGOIMPORT= C:/PROGRA~1/MongoDB/Server/3.4/bin/mongoimport; let $MONGOIMPORT= C:/Applic/MongoDB/Server/3.6/bin/mongoimport;
#set connect_enable_mongo=1; set connect_enable_mongo=1;
--echo # --echo #
--echo # Test the MONGO table type --echo # Test the MONGO table type
...@@ -130,7 +130,9 @@ DROP TABLE t1; ...@@ -130,7 +130,9 @@ DROP TABLE t1;
--echo # --echo #
--echo # try CRUD operations --echo # try CRUD operations
--echo # --echo #
--disable_query_log
--exec $MONGO --eval "db.testcoll.drop()" --quiet --exec $MONGO --eval "db.testcoll.drop()" --quiet
--enable_query_log
eval CREATE TABLE t1 (_id INT(4) NOT NULL, msg CHAR(64)) eval CREATE TABLE t1 (_id INT(4) NOT NULL, msg CHAR(64))
ENGINE=CONNECT TABLE_TYPE=$TYPE TABNAME='testcoll' ENGINE=CONNECT TABLE_TYPE=$TYPE TABNAME='testcoll'
OPTION_LIST='Driver=$DRV,Version=$VERS' $CONN; OPTION_LIST='Driver=$DRV,Version=$VERS' $CONN;
...@@ -147,7 +149,9 @@ DROP TABLE t1; ...@@ -147,7 +149,9 @@ DROP TABLE t1;
--echo # --echo #
--echo # List states whose population is equal or more than 10 millions --echo # List states whose population is equal or more than 10 millions
--echo # --echo #
--disable_query_log
--exec $MONGO --eval "db.cities.drop()" --quiet --exec $MONGO --eval "db.cities.drop()" --quiet
--enable_query_log
--exec $MONGOIMPORT --quiet $MTR_SUITE_DIR/std_data/cities.json --exec $MONGOIMPORT --quiet $MTR_SUITE_DIR/std_data/cities.json
eval CREATE TABLE t1 ( eval CREATE TABLE t1 (
_id char(5) NOT NULL, _id char(5) NOT NULL,
...@@ -204,4 +208,4 @@ SELECT * FROM t1; ...@@ -204,4 +208,4 @@ SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--exec $MONGO --eval "db.testcoll.drop()" --quiet --exec $MONGO --eval "db.testcoll.drop()" --quiet
#set connect_enable_mongo=0; set connect_enable_mongo=0;
...@@ -56,7 +56,7 @@ SELECT * FROM t5; ...@@ -56,7 +56,7 @@ SELECT * FROM t5;
eval CREATE TABLE total (a int, b char(10)) eval CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5' ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=$PORT'; OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by a desc; SELECT * FROM total order by a desc;
set connect_xtrace=0; set connect_xtrace=0;
...@@ -85,7 +85,7 @@ SELECT * FROM t2; ...@@ -85,7 +85,7 @@ SELECT * FROM t2;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
set connect_xtrace=0; set connect_xtrace=0;
DROP TABLE t1,t2,total; DROP TABLE t1,t2,total;
...@@ -101,7 +101,7 @@ SELECT * FROM t2; ...@@ -101,7 +101,7 @@ SELECT * FROM t2;
--replace_result $PORT PORT --replace_result $PORT PORT
--eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT'; --eval CREATE TABLE total (v BIGINT(20) UNSIGNED NOT NULL) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2' OPTION_LIST='thread=yes,port=$PORT';
set connect_xtrace=1; set connect_xtrace=96;
SELECT * FROM total order by v desc; SELECT * FROM total order by v desc;
set connect_xtrace=0; set connect_xtrace=0;
......
...@@ -29,6 +29,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ ...@@ -29,6 +29,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
friend class TXTFAM; friend class TXTFAM;
friend class DBFBASE; friend class DBFBASE;
friend class UNZIPUTL; friend class UNZIPUTL;
friend class JSONCOL;
public: public:
// Constructor // Constructor
DOSDEF(void); DOSDEF(void);
......
This diff is collapsed.
...@@ -15,6 +15,7 @@ enum JMODE {MODE_OBJECT, MODE_ARRAY, MODE_VALUE}; ...@@ -15,6 +15,7 @@ enum JMODE {MODE_OBJECT, MODE_ARRAY, MODE_VALUE};
typedef class JSONDEF *PJDEF; typedef class JSONDEF *PJDEF;
typedef class TDBJSON *PJTDB; typedef class TDBJSON *PJTDB;
typedef class JSONCOL *PJCOL; typedef class JSONCOL *PJCOL;
class TDBJSN;
/***********************************************************************/ /***********************************************************************/
/* The JSON tree node. Can be an Object or an Array. */ /* The JSON tree node. Can be an Object or an Array. */
...@@ -29,6 +30,47 @@ typedef struct _jnode { ...@@ -29,6 +30,47 @@ typedef struct _jnode {
int Nx; // Next to read row number int Nx; // Next to read row number
} JNODE, *PJNODE; } JNODE, *PJNODE;
typedef struct _jncol {
struct _jncol *Next;
char *Name;
char *Fmt;
int Type;
int Len;
int Scale;
bool Cbn;
bool Found;
} JCOL, *PJCL;
/***********************************************************************/
/* Class used to get the columns of a mongo collection. */
/***********************************************************************/
class JSONDISC : public BLOCK {
public:
// Constructor
JSONDISC(PGLOBAL g, int *lg);
// Functions
int GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt);
bool Find(PGLOBAL g, PJVAL jvp, int j);
void AddColumn(PGLOBAL g);
// Members
JCOL jcol;
PJCL jcp, fjcp, pjcp;
PVAL valp;
PJDEF tdp;
TDBJSN *tjnp;
PJTDB tjsp;
PJPR jpp;
PJSON jsp;
PJOB row;
PCSZ sep;
char colname[65], fmt[129], buf[16];
int *length;
int i, n, bf, ncol, lvl;
bool all;
}; // end of JSONDISC
/***********************************************************************/ /***********************************************************************/
/* JSON table. */ /* JSON table. */
/***********************************************************************/ /***********************************************************************/
...@@ -36,13 +78,13 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */ ...@@ -36,13 +78,13 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
friend class TDBJSON; friend class TDBJSON;
friend class TDBJSN; friend class TDBJSN;
friend class TDBJCL; friend class TDBJCL;
friend class JSONDISC;
#if defined(CMGO_SUPPORT) #if defined(CMGO_SUPPORT)
friend class CMGFAM; friend class CMGFAM;
#endif // CMGO_SUPPORT #endif // CMGO_SUPPORT
#if defined(JAVA_SUPPORT) #if defined(JAVA_SUPPORT)
friend class JMGFAM; friend class JMGFAM;
#endif // JAVA_SUPPORT #endif // JAVA_SUPPORT
friend PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool);
public: public:
// Constructor // Constructor
JSONDEF(void); JSONDEF(void);
......
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