Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a88bdbdc
Commit
a88bdbdc
authored
Feb 14, 2018
by
Olivier Bertrand
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'ob-10.1' into 10.1
parents
c6e13e3b
46f3e320
Changes
14
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
409 additions
and
281 deletions
+409
-281
storage/connect/connect.cc
storage/connect/connect.cc
+1
-0
storage/connect/mysql-test/connect/r/json_java_2.result
storage/connect/mysql-test/connect/r/json_java_2.result
+3
-1
storage/connect/mysql-test/connect/r/json_java_3.result
storage/connect/mysql-test/connect/r/json_java_3.result
+3
-1
storage/connect/mysql-test/connect/r/json_mongo_c.result
storage/connect/mysql-test/connect/r/json_mongo_c.result
+2
-0
storage/connect/mysql-test/connect/r/mongo_c.result
storage/connect/mysql-test/connect/r/mongo_c.result
+2
-0
storage/connect/mysql-test/connect/r/mongo_java_2.result
storage/connect/mysql-test/connect/r/mongo_java_2.result
+3
-1
storage/connect/mysql-test/connect/r/mongo_java_3.result
storage/connect/mysql-test/connect/r/mongo_java_3.result
+3
-1
storage/connect/mysql-test/connect/r/tbl_thread.result
storage/connect/mysql-test/connect/r/tbl_thread.result
+16
-3
storage/connect/mysql-test/connect/t/mongo.inc
storage/connect/mysql-test/connect/t/mongo.inc
+2
-2
storage/connect/mysql-test/connect/t/mongo_test.inc
storage/connect/mysql-test/connect/t/mongo_test.inc
+6
-2
storage/connect/mysql-test/connect/t/tbl_thread.test
storage/connect/mysql-test/connect/t/tbl_thread.test
+3
-3
storage/connect/tabdos.h
storage/connect/tabdos.h
+1
-0
storage/connect/tabjson.cpp
storage/connect/tabjson.cpp
+321
-266
storage/connect/tabjson.h
storage/connect/tabjson.h
+43
-1
No files found.
storage/connect/connect.cc
View file @
a88bdbdc
...
...
@@ -404,6 +404,7 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr)
rc
=
RC_FX
;
}
catch
(
const
char
*
msg
)
{
strcpy
(
g
->
Message
,
msg
);
rc
=
RC_NF
;
}
// end catch
return
rc
;
...
...
storage/connect/mysql-test/connect/r/json_java_2.result
View file @
a88bdbdc
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
#
...
...
@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/json_java_3.result
View file @
a88bdbdc
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
#
...
...
@@ -381,3 +382,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/json_mongo_c.result
View file @
a88bdbdc
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
...
...
@@ -380,3 +381,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/mongo_c.result
View file @
a88bdbdc
set connect_enable_mongo=1;
#
# Test the MONGO table type
#
...
...
@@ -376,3 +377,4 @@ planner 167 41.750000
postcard 23 5.750000
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/mongo_java_2.result
View file @
a88bdbdc
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
#
...
...
@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/mongo_java_3.result
View file @
a88bdbdc
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
#
...
...
@@ -377,3 +378,4 @@ planner 167 41.75
postcard 23 5.75
DROP TABLE t1;
true
set connect_enable_mongo=0;
storage/connect/mysql-test/connect/r/tbl_thread.result
View file @
a88bdbdc
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;
connection slave;
CREATE DATABASE connect;
connection default;
#
# Checking thread TBL tables
#
...
...
@@ -11,6 +16,7 @@ a b
1 test01
2 test02
3 test03
connection master;
CREATE TABLE rt2 (a int, b char(10));
INSERT INTO rt2 VALUES (4,'test04'),(5,'test05'),(6,'test06'),(7,'test07');
SELECT * FROM rt2;
...
...
@@ -19,6 +25,7 @@ a b
5 test05
6 test06
7 test07
connection slave;
USE test;
CREATE TABLE rt3 (a int, b char(10));
INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11');
...
...
@@ -44,6 +51,7 @@ a b
17 test17
18 test18
19 test19
connection default;
CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL
CONNECTION='mysql://root@127.0.0.1:MASTER_PORT/test/rt2';
SELECT * FROM t2;
...
...
@@ -79,7 +87,7 @@ a b
CREATE TABLE total (a int, b char(10))
ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4,t5'
OPTION_LIST='thread=yes,port=PORT';
set connect_xtrace=
1
;
set connect_xtrace=
96
;
SELECT * FROM total order by a desc;
a b
19 test19
...
...
@@ -103,8 +111,11 @@ a b
1 test01
0 test00
set connect_xtrace=0;
connection master;
DROP TABLE rt2;
connection slave;
DROP TABLE rt3,rt4,rt5;
connection default;
DROP TABLE t1,t2,t3,t4,t5,total;
#
# Old thread TBL tables test modified
...
...
@@ -118,7 +129,7 @@ SELECT * FROM t2;
v
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';;
set connect_xtrace=
1
;
set connect_xtrace=
96
;
SELECT * FROM total order by v desc;
v
22
...
...
@@ -137,7 +148,7 @@ SELECT * FROM t2;
v
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';;
set connect_xtrace=
1
;
set connect_xtrace=
96
;
SELECT * FROM total order by v desc;
v
22
...
...
@@ -146,7 +157,9 @@ set connect_xtrace=0;
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
connection master;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
connection slave;
DROP TABLE IF EXISTS connect.t1;
DROP DATABASE IF EXISTS connect;
storage/connect/mysql-test/connect/t/mongo.inc
View file @
a88bdbdc
let
$MONGO
=
C
:/
PROGRA
~
1
/
MongoDB
/
Server
/
3.4
/
bin
/
mongo
;
let
$MONGOIMPORT
=
C
:/
PROGRA
~
1
/
MongoDB
/
Server
/
3.4
/
bin
/
mongoimport
;
let
$MONGO
=
C
:/
Applic
/
MongoDB
/
Server
/
3.6
/
bin
/
mongo
;
let
$MONGOIMPORT
=
C
:/
Applic
/
MongoDB
/
Server
/
3.6
/
bin
/
mongoimport
;
storage/connect/mysql-test/connect/t/mongo_test.inc
View file @
a88bdbdc
#
set connect_enable_mongo=1;
set
connect_enable_mongo
=
1
;
--
echo
#
--
echo
# Test the MONGO table type
...
...
@@ -130,7 +130,9 @@ DROP TABLE t1;
--
echo
#
--
echo
# try CRUD operations
--
echo
#
--
disable_query_log
--
exec
$MONGO
--
eval
"db.testcoll.drop()"
--
quiet
--
enable_query_log
eval
CREATE
TABLE
t1
(
_id
INT
(
4
)
NOT
NULL
,
msg
CHAR
(
64
))
ENGINE
=
CONNECT
TABLE_TYPE
=
$TYPE
TABNAME
=
'testcoll'
OPTION_LIST
=
'Driver=$DRV,Version=$VERS'
$CONN
;
...
...
@@ -147,7 +149,9 @@ DROP TABLE t1;
--
echo
#
--
echo
# List states whose population is equal or more than 10 millions
--
echo
#
--
disable_query_log
--
exec
$MONGO
--
eval
"db.cities.drop()"
--
quiet
--
enable_query_log
--
exec
$MONGOIMPORT
--
quiet
$MTR_SUITE_DIR
/
std_data
/
cities
.
json
eval
CREATE
TABLE
t1
(
_id
char
(
5
)
NOT
NULL
,
...
...
@@ -204,4 +208,4 @@ SELECT * FROM t1;
DROP
TABLE
t1
;
--
exec
$MONGO
--
eval
"db.testcoll.drop()"
--
quiet
#
set connect_enable_mongo=0;
set
connect_enable_mongo
=
0
;
storage/connect/mysql-test/connect/t/tbl_thread.test
View file @
a88bdbdc
...
...
@@ -56,7 +56,7 @@ SELECT * FROM t5;
eval
CREATE
TABLE
total
(
a
int
,
b
char
(
10
))
ENGINE
=
CONNECT
TABLE_TYPE
=
TBL
TABLE_LIST
=
't1,t2,t3,t4,t5'
OPTION_LIST
=
'thread=yes,port=$PORT'
;
set
connect_xtrace
=
1
;
set
connect_xtrace
=
96
;
SELECT
*
FROM
total
order
by
a
desc
;
set
connect_xtrace
=
0
;
...
...
@@ -85,7 +85,7 @@ SELECT * FROM t2;
--
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'
;
set
connect_xtrace
=
1
;
set
connect_xtrace
=
96
;
SELECT
*
FROM
total
order
by
v
desc
;
set
connect_xtrace
=
0
;
DROP
TABLE
t1
,
t2
,
total
;
...
...
@@ -101,7 +101,7 @@ SELECT * FROM t2;
--
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'
;
set
connect_xtrace
=
1
;
set
connect_xtrace
=
96
;
SELECT
*
FROM
total
order
by
v
desc
;
set
connect_xtrace
=
0
;
...
...
storage/connect/tabdos.h
View file @
a88bdbdc
...
...
@@ -29,6 +29,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */
friend
class
TXTFAM
;
friend
class
DBFBASE
;
friend
class
UNZIPUTL
;
friend
class
JSONCOL
;
public:
// Constructor
DOSDEF
(
void
);
...
...
storage/connect/tabjson.cpp
View file @
a88bdbdc
This diff is collapsed.
Click to expand it.
storage/connect/tabjson.h
View file @
a88bdbdc
...
...
@@ -15,6 +15,7 @@ enum JMODE {MODE_OBJECT, MODE_ARRAY, MODE_VALUE};
typedef
class
JSONDEF
*
PJDEF
;
typedef
class
TDBJSON
*
PJTDB
;
typedef
class
JSONCOL
*
PJCOL
;
class
TDBJSN
;
/***********************************************************************/
/* The JSON tree node. Can be an Object or an Array. */
...
...
@@ -29,6 +30,47 @@ typedef struct _jnode {
int
Nx
;
// Next to read row number
}
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. */
/***********************************************************************/
...
...
@@ -36,13 +78,13 @@ class DllExport JSONDEF : public DOSDEF { /* Table description */
friend
class
TDBJSON
;
friend
class
TDBJSN
;
friend
class
TDBJCL
;
friend
class
JSONDISC
;
#if defined(CMGO_SUPPORT)
friend
class
CMGFAM
;
#endif // CMGO_SUPPORT
#if defined(JAVA_SUPPORT)
friend
class
JMGFAM
;
#endif // JAVA_SUPPORT
friend
PQRYRES
JSONColumns
(
PGLOBAL
,
PCSZ
,
PCSZ
,
PTOS
,
bool
);
public:
// Constructor
JSONDEF
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment