Commit 13b26f84 authored by Olivier Bertrand's avatar Olivier Bertrand

-- Fix wrong setting of Pipe

  modified:   storage/connect/tabcmg.cpp

-- Fix declaration of drv in MGOColumns
  modified:   storage/connect/mongo.cpp

-- Add jmongo3 test (disabled)
  modified:   storage/connect/mysql-test/connect/disabled.def
  added:      storage/connect/mysql-test/connect/std_data/Mongo3.jar
  added:      storage/connect/mysql-test/connect/t/jmongo3.test
parent c51b1a1f
......@@ -47,7 +47,6 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
unsigned int length[] = {0, 6, 8, 10, 10, 6, 6, 0};
int ncol = sizeof(buftyp) / sizeof(int);
int i, n = 0;
//PCSZ drv;
PBCOL bcp;
MGODISC *cmgd;
PQRYRES qrp;
......@@ -67,7 +66,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info)
#elif !defined(MONGO_SUPPORT)
cmgd = new(g) JMGDISC(g, (int*)length);
#else
drv = GetStringTableOption(g, topt, "Driver", "C");
PCSZ drv = GetStringTableOption(g, topt, "Driver", "C");
if (toupper(*drv) == 'C')
cmgd = new(g) CMGDISC(g, (int*)length);
......
......@@ -15,3 +15,4 @@ jdbc_oracle : Variable settings depend on machine configuration
jdbc_postgresql : Variable settings depend on machine configuration
json_mgo : Need MongoDB running and its C Driver installed
mongo : Need MongoDB running and its C Driver installed
jmongo3 : Need MongoDB running and its Java Driver installed
This diff was suppressed by a .gitattributes entry.
-- source jdbconn.inc
eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/Mongo3.jar';
CREATE TABLE t1 (Document varchar(1024) field_format='*')
ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME=restaurants OPTION_LIST='Version=3' DATA_CHARSET=utf8;
SELECT * from t1 limit 3;
DROP TABLE t1;
#
# Test catfunc
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME=restaurants CATFUNC=columns OPTION_LIST='Level=1,Version=3' DATA_CHARSET=utf8;
SELECT * from t1;
DROP TABLE t1;
#
# Explicit columns
#
CREATE TABLE t1 (
_id VARCHAR(24) NOT NULL,
name VARCHAR(255) NOT NULL,
cuisine VARCHAR(255) NOT NULL,
borough VARCHAR(255) NOT NULL,
restaurant_id VARCHAR(255) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME=restaurants
CONNECTION='mongodb://localhost:27017' DATA_CHARSET=utf8;
SELECT * FROM t1 LIMIT 10;
DROP TABLE t1;
#
# Test discovery
#
CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME=restaurants OPTION_LIST='Level=1,Version=3' DATA_CHARSET=utf8;
SHOW CREATE TABLE t1;
SELECT * FROM t1 LIMIT 5;
DROP TABLE t1;
#
# Dropping a column
#
CREATE TABLE t1
ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME=restaurants DATA_CHARSET=utf8
COLIST='{"grades":0}' OPTION_LIST='Driver=java,level=0';
SELECT * FROM t1 LIMIT 10;
DROP TABLE t1;
#
# Specifying Jpath
#
CREATE TABLE t1 (
_id VARCHAR(24) NOT NULL,
name VARCHAR(64) NOT NULL,
cuisine CHAR(200) NOT NULL,
borough CHAR(16) NOT NULL,
street VARCHAR(65) FIELD_FORMAT='address.street',
building CHAR(16) FIELD_FORMAT='address.building',
zipcode CHAR(5) FIELD_FORMAT='address.zipcode',
grade CHAR(1) FIELD_FORMAT='grades.0.grade',
score INT(4) NOT NULL FIELD_FORMAT='grades.0.score',
`date` DATE FIELD_FORMAT='grades.0.date',
restaurant_id VARCHAR(255) NOT NULL)
ENGINE=CONNECT TABLE_TYPE=MONGO TABNAME='restaurants' DATA_CHARSET=utf8;
--vertical_results
SELECT * FROM t1 LIMIT 1;
--horizontal_results
SELECT name, street, score, date FROM t1 LIMIT 5;
SELECT name, cuisine, borough FROM t1 WHERE grade = 'A' LIMIT 10;
SELECT COUNT(*) FROM t1 WHERE grade = 'A';
SELECT * FROM t1 WHERE cuisine = 'English';
SELECT * FROM t1 WHERE score = building;
DROP TABLE t1;
-- source jdbconn_cleanup.inc
......@@ -171,7 +171,7 @@ TDBCMG::TDBCMG(MGODEF *tdp) : TDBEXT(tdp)
Pcg.Coll_name = tdp->Tabname;
Pcg.Options = tdp->Colist;
Pcg.Filter = tdp->Filter;
Pcg.Pipe = tdp->Pipe && Options != NULL;
Pcg.Pipe = tdp->Pipe && tdp->Colist != NULL;
B = tdp->Base ? 1 : 0;
} else {
Pcg.Uristr = NULL;
......
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