summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier Bertrand <bertrandop@gmail.com>2016-03-17 10:17:42 +0100
committerOlivier Bertrand <bertrandop@gmail.com>2016-03-17 10:17:42 +0100
commit433c8a82a43ea4d1ec80190a4f726e09885a94c1 (patch)
treebf8702e5537c680c2aedb557cd41a3d96ef4f775
parent539b7368b3a4a89cb1a395b8a73f08dfafe14a96 (diff)
parent66890975ebf6a7d7ab9f19ba25543223b78c8c82 (diff)
downloadmariadb-git-433c8a82a43ea4d1ec80190a4f726e09885a94c1.tar.gz
Merge branch 'ob-10.0' into 10.0
-rw-r--r--storage/connect/ha_connect.cc29
-rw-r--r--storage/connect/mysql-test/connect/r/tbl.result45
-rw-r--r--storage/connect/mysql-test/connect/t/tbl.test45
-rw-r--r--storage/connect/odbconn.cpp9
-rw-r--r--storage/connect/tabmysql.cpp2
-rw-r--r--storage/connect/tabtbl.cpp4
-rw-r--r--storage/connect/tabtbl.h3
7 files changed, 95 insertions, 42 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 81e373a62d2..d82c6a278d8 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -169,9 +169,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.04.0005 January 24, 2016";
+ char version[]= "Version 1.04.0006 March 12, 2016";
#if defined(__WIN__)
- char compver[]= "Version 1.04.0005 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@@ -5160,7 +5160,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
fncn= topt->catfunc;
fnc= GetFuncID(fncn);
sep= topt->separator;
- spc= (!sep) ? ',' : (!strcmp(sep, "\\t")) ? '\t' : *sep;
+ spc= (!sep) ? ',' : *sep;
qch= topt->qchar ? *topt->qchar : (signed)topt->quoted >= 0 ? '"' : 0;
hdr= (int)topt->header;
tbl= topt->tablist;
@@ -5227,7 +5227,6 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
goto err;
} // endif rc
-
if (!tab) {
if (ttp == TAB_TBL) {
// Make tab the first table of the list
@@ -5296,8 +5295,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TAB_CSV:
if (!fn && fnc != FNC_NO)
sprintf(g->Message, "Missing %s file name", topt->type);
- else
- ok= true;
+ else if (sep && strlen(sep) > 1)
+ sprintf(g->Message, "Invalid separator %s", sep);
+ else
+ ok= true;
break;
case TAB_MYSQL:
@@ -5978,7 +5979,19 @@ int ha_connect::create(const char *name, TABLE *table_arg,
DBUG_RETURN(rc);
} // endif lrecl
- } // endif type
+ } // endif type JSON
+
+ if (type == TAB_CSV) {
+ const char *sep = options->separator;
+
+ if (sep && strlen(sep) > 1) {
+ sprintf(g->Message, "Invalid separator %s", sep);
+ my_message(ER_UNKNOWN_ERROR, g->Message, MYF(0));
+ rc= HA_ERR_INTERNAL_ERROR;
+ DBUG_RETURN(rc);
+ } // endif sep
+
+ } // endif type CSV
// Check column types
for (field= table_arg->field; *field; field++) {
@@ -6766,7 +6779,7 @@ maria_declare_plugin(connect)
0x0104, /* version number (1.04) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.04.0005", /* string version */
+ "1.04.0006", /* string version */
MariaDB_PLUGIN_MATURITY_BETA /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/mysql-test/connect/r/tbl.result b/storage/connect/mysql-test/connect/r/tbl.result
index bc77516c22d..f51b4dfa57f 100644
--- a/storage/connect/mysql-test/connect/r/tbl.result
+++ b/storage/connect/mysql-test/connect/r/tbl.result
@@ -44,8 +44,8 @@ ta message
1 Testing
2 myisam table
3 t4
-CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=PORT';
-select * from total;
+CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=PORT';
+SELECT * FROM total;
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -59,15 +59,15 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2';
tabname ta message
t2 1 Testing
t2 2 NULL
t2 3 t2
-select * from total where tabname = 't2' and ta = 3;
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
tabname ta message
t2 3 t2
-select * from total where tabname in ('t1','t4');
+SELECT * FROM total WHERE tabname IN ('t1','t4');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -75,11 +75,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where ta = 3 and tabname in ('t1','t2');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
tabname ta message
t1 3 t1
t2 3 t2
-select * from total where tabname <> 't2';
+SELECT * FROM total WHERE tabname <> 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -90,12 +90,12 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname != 't2' and ta = 3;
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
tabname ta message
t1 3 t1
t3 3 t3
t4 3 t4
-select * from total where tabname not in ('t2','t3');
+SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -103,11 +103,11 @@ t1 3 t1
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where ta = 3 and tabname in ('t2','t3');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
tabname ta message
t2 3 t2
t3 3 t3
-select * from total where ta = 3 or tabname in ('t2','t4');
+SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
tabname ta message
t1 3 t1
t2 1 Testing
@@ -117,7 +117,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where not tabname = 't2';
+SELECT * FROM total WHERE NOT tabname = 't2';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -128,7 +128,7 @@ t3 3 t3
t4 1 Testing
t4 2 myisam table
t4 3 t4
-select * from total where tabname = 't2' or tabname = 't1';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
tabname ta message
t1 1 Testing
t1 2 dos table
@@ -141,3 +141,22 @@ DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+#
+# Checking thread TBL tables
+#
+CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
+SELECT * FROM t1;
+v
+11
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
+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';;
+SELECT * FROM total order by v desc;
+v
+22
+11
+DROP TABLE total;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/storage/connect/mysql-test/connect/t/tbl.test b/storage/connect/mysql-test/connect/t/tbl.test
index 43c506c9403..3dc4b2e64b0 100644
--- a/storage/connect/mysql-test/connect/t/tbl.test
+++ b/storage/connect/mysql-test/connect/t/tbl.test
@@ -31,23 +31,40 @@ INSERT INTO t4 (message) VALUES ('Testing'),('myisam table'),('t4');
SELECT * FROM t4;
--replace_result $PORT PORT
---eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) engine=CONNECT table_type=TBL table_list='t1,t2,t3,t4' option_list='port=$PORT'
-
-select * from total;
-select * from total where tabname = 't2';
-select * from total where tabname = 't2' and ta = 3;
-select * from total where tabname in ('t1','t4');
-select * from total where ta = 3 and tabname in ('t1','t2');
-select * from total where tabname <> 't2';
-select * from total where tabname != 't2' and ta = 3;
-select * from total where tabname not in ('t2','t3');
-select * from total where ta = 3 and tabname in ('t2','t3');
-select * from total where ta = 3 or tabname in ('t2','t4');
-select * from total where not tabname = 't2';
-select * from total where tabname = 't2' or tabname = 't1';
+--eval CREATE TABLE total (tabname CHAR(8) NOT NULL SPECIAL='TABID', ta TINYINT NOT NULL FLAG=1, message CHAR(20)) ENGINE=CONNECT TABLE_TYPE=TBL TABLE_LIST='t1,t2,t3,t4' OPTION_LIST='port=$PORT'
+
+SELECT * FROM total;
+SELECT * FROM total WHERE tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' AND ta = 3;
+SELECT * FROM total WHERE tabname IN ('t1','t4');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t1','t2');
+SELECT * FROM total WHERE tabname <> 't2';
+SELECT * FROM total WHERE tabname != 't2' AND ta = 3;
+SELECT * FROM total WHERE tabname NOT IN ('t2','t3');
+SELECT * FROM total WHERE ta = 3 AND tabname IN ('t2','t3');
+SELECT * FROM total WHERE ta = 3 OR tabname IN ('t2','t4');
+SELECT * FROM total WHERE NOT tabname = 't2';
+SELECT * FROM total WHERE tabname = 't2' OR tabname = 't1';
DROP TABLE total;
DROP TABLE t1;
DROP TABLE t2;
DROP TABLE t3;
DROP TABLE t4;
+
+--echo #
+--echo # Checking thread TBL tables
+--echo #
+CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 11 as v';
+SELECT * FROM t1;
+
+CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL SRCDEF='select 22 as v';
+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';
+SELECT * FROM total order by v desc;
+
+DROP TABLE total;
+DROP TABLE t1;
+DROP TABLE t2;
diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp
index cb21a8bda15..55ccbdbada1 100644
--- a/storage/connect/odbconn.cpp
+++ b/storage/connect/odbconn.cpp
@@ -1758,7 +1758,9 @@ bool ODBConn::BindParam(ODBCCOL *colp)
SQLLEN *strlen = colp->GetStrLen();
SQLRETURN rc;
+#if 0
try {
+ // This function is often not or badly implemented by data sources
rc = SQLDescribeParam(m_hstmt, n, &sqlt, &colsize, &dec, &nul);
if (!Check(rc))
@@ -1766,11 +1768,12 @@ bool ODBConn::BindParam(ODBCCOL *colp)
} catch(DBX *x) {
sprintf(m_G->Message, "%s: %s", x->m_Msg, x->GetErrorMessage(0));
+#endif // 0
colsize = colp->GetPrecision();
sqlt = GetSQLType(buftype);
- dec = IsTypeChar(buftype) ? 0 : colp->GetScale();
- nul = SQL_NULLABLE_UNKNOWN;
- } // end try/catch
+ dec = IsTypeNum(buftype) ? colp->GetScale() : 0;
+ nul = colp->IsNullable() ? SQL_NULLABLE : SQL_NO_NULLS;
+//} // end try/catch
buf = colp->GetBuffer(0);
len = IsTypeChar(buftype) ? colp->GetBuflen() : 0;
diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp
index b9cede52a21..77be29ac12d 100644
--- a/storage/connect/tabmysql.cpp
+++ b/storage/connect/tabmysql.cpp
@@ -334,7 +334,7 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int)
Delayed = !!GetIntCatInfo("Delayed", 0);
} else {
// MYSQL access from a PROXY table
- Database = GetStringCatInfo(g, "Database", Schema ? Schema : "*");
+ Database = GetStringCatInfo(g, "Database", Schema ? Schema : (PSZ)"*");
Isview = GetBoolCatInfo("View", false);
// We must get other connection parms from the calling table
diff --git a/storage/connect/tabtbl.cpp b/storage/connect/tabtbl.cpp
index 6b72c715517..36849146746 100644
--- a/storage/connect/tabtbl.cpp
+++ b/storage/connect/tabtbl.cpp
@@ -607,7 +607,7 @@ void TDBTBM::ResetDB(void)
for (PTABLE tabp = Tablist; tabp; tabp = tabp->GetNext())
((PTDBASE)tabp->GetTo_Tdb())->ResetDB();
- Tdbp = (PTDBASE)Tablist->GetTo_Tdb();
+ Tdbp = (Tablist) ? (PTDBASE)Tablist->GetTo_Tdb() : NULL;
Crp = 0;
} // end of ResetDB
@@ -679,7 +679,7 @@ bool TDBTBM::OpenDB(PGLOBAL g)
/* Table already open, replace it at its beginning. */
/*******************************************************************/
ResetDB();
- return Tdbp->OpenDB(g); // Re-open fist table
+ return (Tdbp) ? Tdbp->OpenDB(g) : false; // Re-open fist table
} // endif use
#if 0
diff --git a/storage/connect/tabtbl.h b/storage/connect/tabtbl.h
index 9d3f297f9e7..3a5ec45d025 100644
--- a/storage/connect/tabtbl.h
+++ b/storage/connect/tabtbl.h
@@ -138,7 +138,8 @@ class DllExport TDBTBM : public TDBTBL {
virtual void ResetDB(void);
// Database routines
- virtual int GetMaxSize(PGLOBAL g) {return 10;} // Temporary
+ virtual int Cardinality(PGLOBAL g) { return 10; }
+ virtual int GetMaxSize(PGLOBAL g) { return 10; } // Temporary
virtual int RowNumber(PGLOBAL g, bool b = FALSE);
virtual bool OpenDB(PGLOBAL g);
virtual int ReadDB(PGLOBAL g);