mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
Merge branch 'connect/10.1' into 10.1
This commit is contained in:
commit
d5a80519c9
9 changed files with 109 additions and 63 deletions
|
@ -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_GAMMA /* 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 order by v desc;
|
||||
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 order by v desc;
|
||||
|
||||
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 : (char*)"*");
|
||||
Database = GetStringCatInfo(g, "Database", Schema ? Schema : PlugDup(g, "*"));
|
||||
Isview = GetBoolCatInfo("View", false);
|
||||
|
||||
// We must get other connection parms from the calling table
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
/* */
|
||||
/* COPYRIGHT: */
|
||||
/* ---------- */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2015 */
|
||||
/* (C) Copyright to the author Olivier BERTRAND 2000-2016 */
|
||||
/* */
|
||||
/* WHAT THIS PROGRAM DOES: */
|
||||
/* ----------------------- */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1344,10 +1344,13 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype)
|
|||
/***********************************************************************/
|
||||
bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
|
||||
{
|
||||
bool rc;
|
||||
bool rc = false;
|
||||
|
||||
if (p && n > 0) {
|
||||
rc = n > Len;
|
||||
if (!p || n == 0) {
|
||||
Reset();
|
||||
Null = Nullable;
|
||||
} else if (p != Strp) {
|
||||
rc = n > Len;
|
||||
|
||||
if ((n = MY_MIN(n, Len))) {
|
||||
strncpy(Strp, p, n);
|
||||
|
@ -1366,10 +1369,6 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
|
|||
Reset();
|
||||
|
||||
Null = false;
|
||||
} else {
|
||||
rc = false;
|
||||
Reset();
|
||||
Null = Nullable;
|
||||
} // endif p
|
||||
|
||||
return rc;
|
||||
|
@ -1380,12 +1379,12 @@ bool TYPVAL<PSZ>::SetValue_char(char *p, int n)
|
|||
/***********************************************************************/
|
||||
void TYPVAL<PSZ>::SetValue_psz(PSZ s)
|
||||
{
|
||||
if (s) {
|
||||
strncpy(Strp, s, Len);
|
||||
if (!s) {
|
||||
Reset();
|
||||
Null = Nullable;
|
||||
} else if (s != Strp) {
|
||||
strncpy(Strp, s, Len);
|
||||
Null = false;
|
||||
} else {
|
||||
Reset();
|
||||
Null = Nullable;
|
||||
} // endif s
|
||||
|
||||
} // end of SetValue_psz
|
||||
|
@ -1627,12 +1626,6 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp)
|
|||
return (n > 0) ? 1 : (n < 0) ? -1 : 0;
|
||||
} // end of CompareValue
|
||||
|
||||
static inline void v_strcpy(char *dest, const char *src)
|
||||
{
|
||||
if (dest != src)
|
||||
strcpy(dest, src);
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
/* Compute a function on a string. */
|
||||
/***********************************************************************/
|
||||
|
@ -1649,7 +1642,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||
assert(np == 1 || np == 2);
|
||||
|
||||
if (np == 2)
|
||||
strncpy(Strp, p[0], Len);
|
||||
SetValue_psz(p[0]);
|
||||
|
||||
if ((i = Len - (signed)strlen(Strp)) > 0)
|
||||
strncat(Strp, p[np - 1], i);
|
||||
|
@ -1657,11 +1650,11 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op)
|
|||
break;
|
||||
case OP_MIN:
|
||||
assert(np == 2);
|
||||
v_strcpy(Strp, (strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
|
||||
SetValue_psz((strcmp(p[0], p[1]) < 0) ? p[0] : p[1]);
|
||||
break;
|
||||
case OP_MAX:
|
||||
assert(np == 2);
|
||||
v_strcpy(Strp, (strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
|
||||
SetValue_psz((strcmp(p[0], p[1]) > 0) ? p[0] : p[1]);
|
||||
break;
|
||||
default:
|
||||
// sprintf(g->Message, MSG(BAD_EXP_OPER), op);
|
||||
|
|
Loading…
Add table
Reference in a new issue