mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
- Fix MDEV-9603 compiler error.
modified: storage/connect/tabmysql.cpp - Test invalid CSV separator when creating the table (MDEV-9714) modified: storage/connect/ha_connect.cc - Stop using SQLDescribeParam anymore modified: storage/connect/odbconn.cpp - Fix MDEV-9723 Regression due to calling Cardinality instead of GetMaxSize in info. modified: storage/connect/tabtbl.h modified: storage/connect/mysql-test/connect/r/tbl.result modified: storage/connect/mysql-test/connect/t/tbl.test - Typo modified: storage/connect/tabodbc.cpp
This commit is contained in:
@@ -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,6 +5295,8 @@ 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 if (sep && strlen(sep) > 1)
|
||||
sprintf(g->Message, "Invalid separator %s", sep);
|
||||
else
|
||||
ok= true;
|
||||
|
||||
@@ -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;
|
||||
|
@@ -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;
|
||||
v
|
||||
22
|
||||
11
|
||||
DROP TABLE total;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@@ -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'
|
||||
--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';
|
||||
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;
|
||||
|
||||
DROP TABLE total;
|
||||
DROP TABLE t1;
|
||||
DROP TABLE t2;
|
||||
|
@@ -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;
|
||||
|
@@ -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
|
||||
|
@@ -138,6 +138,7 @@ class DllExport TDBTBM : public TDBTBL {
|
||||
virtual void ResetDB(void);
|
||||
|
||||
// Database routines
|
||||
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);
|
||||
|
Reference in New Issue
Block a user