diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2017-08-10 16:16:25 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2017-08-10 16:16:25 +0200 |
commit | 0b9ea65dc15a56888e0df6d68e7955aa0139e5ae (patch) | |
tree | 3d1836b43c5f1fcf63f2773bb338047ee883ce5f | |
parent | 9e5ca80afe1c126bb974b71c3b3c5ff96f010295 (diff) | |
download | mariadb-git-0b9ea65dc15a56888e0df6d68e7955aa0139e5ae.tar.gz |
Make source from 10.2 source
28 files changed, 117 insertions, 305 deletions
diff --git a/storage/connect/jmgoconn.cpp b/storage/connect/jmgoconn.cpp index a51127c80a0..7535431c82e 100644 --- a/storage/connect/jmgoconn.cpp +++ b/storage/connect/jmgoconn.cpp @@ -732,7 +732,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) return RC_FX; if (env->CallBooleanMethod(job, docaddid, updlist, jkey, val)) - return NULL; + return RC_OK; env->DeleteLocalRef(jkey); } // endfor colp @@ -742,7 +742,7 @@ int JMgoConn::DocUpdate(PGLOBAL g, PTDB tdbp) jkey = env->NewStringUTF("$set"); if (env->CallBooleanMethod(job, docaddid, upd, jkey, updlist)) - return NULL; + return RC_OK; env->DeleteLocalRef(jkey); diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index da94d4e227c..b86d2da21b7 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -1403,10 +1403,20 @@ double JVALUE::GetFloat(void) /***********************************************************************/ /* Return the Value's String value. */ /***********************************************************************/ -PSZ JVALUE::GetString(void) +PSZ JVALUE::GetString(PGLOBAL g) { - char buf[32]; - return (Value) ? Value->GetCharString(buf) : NULL; + char *p; + + if (Value) { + char buf[32]; + + if ((p = Value->GetCharString(buf)) == buf) + p = PlugDup(g, buf); + + } else + p = NULL; + + return p; } // end of GetString /***********************************************************************/ diff --git a/storage/connect/json.h b/storage/connect/json.h index daed055435b..cf7b2b18737 100644 --- a/storage/connect/json.h +++ b/storage/connect/json.h @@ -53,6 +53,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char *fn, int pretty); bool SerializeArray(JOUT *js, PJAR jarp, bool b); bool SerializeObject(JOUT *js, PJOB jobp); bool SerializeValue(JOUT *js, PJVAL jvp); +bool IsNum(PSZ s); +char *NextChr(PSZ s, char sep); /***********************************************************************/ /* Class JOUT. Used by Serialize. */ @@ -165,7 +167,7 @@ class JSON : public BLOCK { virtual PJPR GetFirst(void) {X return NULL;} virtual int GetInteger(void) {X return 0;} virtual double GetFloat() {X return 0.0;} - virtual PSZ GetString() {X return NULL;} + virtual PSZ GetString(PGLOBAL g) {X return NULL;} virtual PSZ GetText(PGLOBAL g, PSZ text) {X return NULL;} virtual bool Merge(PGLOBAL g, PJSON jsp) { X return true; } virtual bool SetValue(PGLOBAL g, PJVAL jvp, int i) { X return true; } @@ -275,7 +277,7 @@ class JVALUE : public JSON { virtual int GetInteger(void); virtual long long GetBigint(void); virtual double GetFloat(void); - virtual PSZ GetString(void); + virtual PSZ GetString(PGLOBAL g); virtual PSZ GetText(PGLOBAL g, PSZ text); virtual void SetValue(PJSON jsp); virtual void SetValue(PVAL valp) { Value = valp; Jsp = NULL; } diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 566ad31510b..6acf18cd323 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -143,7 +143,7 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) jnp->Rank = B; jnp->Op = OP_LE; } else if (!Value->IsTypeNum()) { - jnp->CncVal = AllocateValue(g, (void*)", ", TYPE_STRING); + jnp->CncVal = AllocateValue(g, PlugDup(g, ", "), TYPE_STRING); jnp->Op = OP_CNC; } else jnp->Op = OP_ADD; @@ -181,6 +181,10 @@ my_bool JSNX::SetArrayOptions(PGLOBAL g, char *p, int i, PSZ nm) if (n > 2) { // Set concat intermediate string p[n - 1] = 0; + + if (trace) + htrc("Concat string=%s\n", p + 1); + jnp->CncVal = AllocateValue(g, p + 1, TYPE_STRING); } // endif n @@ -242,6 +246,9 @@ my_bool JSNX::ParseJpath(PGLOBAL g) // Jpath = Name; return true; + if (trace) + htrc("ParseJpath %s\n", SVP(Jpath)); + if (!(pbuf = PlgDBDup(g, Jpath))) return true; @@ -301,6 +308,12 @@ my_bool JSNX::ParseJpath(PGLOBAL g) Nod = i; MulVal = AllocateValue(g, Value); + + if (trace) + for (i = 0; i < Nod; i++) + htrc("Node(%d) Key=%s Op=%d Rank=%d\n", + i, SVP(Nodes[i].Key), Nodes[i].Op, Nodes[i].Rank); + Parsed = true; return false; } // end of ParseJpath @@ -485,7 +498,7 @@ PVAL JSNX::ExpandArray(PGLOBAL g, PJAR arp, int n) PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) { //int i, ars, nv = 0, nextsame = Tjp->NextSame; - int i, ars, nv = 0, nextsame = 0; + int i, nv = 0, nextsame = 0; my_bool err; OPVAL op = Nodes[n].Op; PVAL val[2], vp = Nodes[n].Valp; @@ -493,11 +506,20 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) JVALUE jval; vp->Reset(); - ars = arp->size(); +//ars = arp->size(); + + if (trace) + htrc("CalculateArray size=%d\n", arp->size()); +// htrc("CalculateArray size=%d\n", ars); - for (i = 0; i < ars; i++) { + for (i = 0; i < arp->size(); i++) { +//for (i = 0; i < ars; i++) { because compiler bug jvrp = arp->GetValue(i); + if (trace) + htrc("Value %s null=%d nv=%d\n", + jvrp->GetString(g), jvrp->IsNull() ? 1 : 0, nv); + if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) { if (jvrp->IsNull()) { jvrp->Value = AllocateValue(g, GetJsonNull(), TYPE_STRING); @@ -514,8 +536,8 @@ PVAL JSNX::CalculateArray(PGLOBAL g, PJAR arp, int n) } else SetJsonValue(g, MulVal, jvp, n); - if (!MulVal->IsZero()) { - switch (op) { + if (!MulVal->IsNull()) { + switch (op) { case OP_CNC: if (Nodes[n].CncVal) { val[0] = Nodes[n].CncVal; @@ -1876,7 +1898,7 @@ char *json_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, PJAR arp; PJVAL jvp = MakeValue(g, args, 0, &top); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(top = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); return NULL; @@ -2666,7 +2688,7 @@ char *json_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, PJSON jsp; PJVAL jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); return NULL; @@ -3050,7 +3072,7 @@ char *json_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); return NULL; @@ -3165,7 +3187,7 @@ char *jsonget_string(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto err; @@ -3280,7 +3302,7 @@ long long jsonget_int(UDF_INIT *initid, UDF_ARGS *args, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); if (g->Mrr) *error = 1; @@ -3395,7 +3417,7 @@ double jsonget_real(UDF_INIT *initid, UDF_ARGS *args, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); *is_null = 1; @@ -3511,7 +3533,7 @@ char *jsonlocate(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto err; @@ -3635,7 +3657,7 @@ char *json_locate_all(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto err; @@ -3807,7 +3829,7 @@ long long jsoncontains_path(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto err; @@ -3894,7 +3916,7 @@ char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { throw 2; } // endif jsp @@ -4230,14 +4252,14 @@ char *jfile_make(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!strchr("[{ \t\r\n", *p)) { // Is this a file name? if (!(p = GetJsonFile(g, p))) { PUSH_WARNING(g->Message); goto fin; } else - fn = jvp->GetString(); + fn = jvp->GetString(g); } // endif p @@ -4380,7 +4402,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, PJVAL jvp = MakeValue(g, args, 0, &top); PGLOBAL gb = GetMemPtr(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(top = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); return NULL; @@ -4918,7 +4940,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, PJSON jsp; PJVAL jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); return NULL; @@ -4989,7 +5011,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto fin; @@ -5163,7 +5185,7 @@ char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, } else jvp = MakeValue(g, args, 0); - if ((p = jvp->GetString())) { + if ((p = jvp->GetString(g))) { if (!(jsp = ParseJson(g, p, strlen(p)))) { PUSH_WARNING(g->Message); goto fin; diff --git a/storage/connect/mongo.cpp b/storage/connect/mongo.cpp index 2bbbc7eef86..12f2f428112 100644 --- a/storage/connect/mongo.cpp +++ b/storage/connect/mongo.cpp @@ -47,6 +47,7 @@ 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; @@ -61,7 +62,7 @@ PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info) /*********************************************************************/ /* Open MongoDB. */ /*********************************************************************/ - PCSZ drv = GetStringTableOption(g, topt, "Driver", NULL); + drv = GetStringTableOption(g, topt, "Driver", NULL); if (drv && toupper(*drv) == 'C') { #if defined(CMGO_SUPPORT) @@ -256,7 +257,7 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k) if (k && *fmt && (!bcp->Fmt || strlen(bcp->Fmt) < strlen(fmt))) { bcp->Fmt = PlugDup(g, fmt); - length[7] = MY_MAX(length[7], strlen(fmt)); + length[7] = MY_MAX(length[7], (signed)strlen(fmt)); } // endif *fmt bcp->Len = MY_MAX(bcp->Len, bcol.Len); @@ -269,11 +270,11 @@ void MGODISC::AddColumn(PGLOBAL g, PCSZ colname, PCSZ fmt, int k) *bcp = bcol; bcp->Cbn |= (i > 1); bcp->Name = PlugDup(g, colname); - length[0] = MY_MAX(length[0], strlen(colname)); + length[0] = MY_MAX(length[0], (signed)strlen(colname)); if (k) { bcp->Fmt = PlugDup(g, fmt); - length[7] = MY_MAX(length[7], strlen(fmt)); + length[7] = MY_MAX(length[7], (signed)strlen(fmt)); } else bcp->Fmt = NULL; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index e68489faad5..d2d55f33611 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -139,7 +139,7 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, unsigned int length[] = {0, 4, 0, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0}; PCSZ fmt; char *fld, *colname, *chset, v, buf[128], uns[16], zero[16]; - int i, n, nf, ncol = sizeof(buftyp) / sizeof(int); + int i, n, nf = 0, ncol = sizeof(buftyp) / sizeof(int); int len, type, prec, rc, k = 0; bool b; PQRYRES qrp; @@ -160,7 +160,9 @@ PQRYRES MyColumns(PGLOBAL g, THD *thd, const char *host, const char *db, /* Do an evaluation of the result size. */ /********************************************************************/ STRING cmd(g, 64, "SHOW FULL COLUMNS FROM "); - b = cmd.Append((PSZ)table); + b = cmd.Append('`'); + b |= cmd.Append((PSZ)table); + b |= cmd.Append('`'); b |= cmd.Append(" FROM "); b |= cmd.Append((PSZ)(db ? db : PlgGetUser(g)->DBName)); diff --git a/storage/connect/mysql-test/connect/r/bin.result b/storage/connect/mysql-test/connect/r/bin.result index 1baa18a1e4d..4ba353ac705 100644 --- a/storage/connect/mysql-test/connect/r/bin.result +++ b/storage/connect/mysql-test/connect/r/bin.result @@ -57,7 +57,7 @@ t1 CREATE TABLE `t1` ( `name` char(10) NOT NULL, `birth` date NOT NULL, `id` char(5) NOT NULL `FIELD_FORMAT`='S', - `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', + `salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F', `dept` int(4) NOT NULL `FIELD_FORMAT`='S' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=NO INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); @@ -76,7 +76,7 @@ t1 CREATE TABLE `t1` ( `name` char(10) NOT NULL, `birth` date NOT NULL, `id` char(5) NOT NULL `FIELD_FORMAT`='S', - `salary` double(9,2) NOT NULL DEFAULT 0.00 `FIELD_FORMAT`='F', + `salary` double(9,2) NOT NULL DEFAULT '0.00' `FIELD_FORMAT`='F', `dept` int(4) NOT NULL `FIELD_FORMAT`='S' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=BIN `FILE_NAME`='Testbal.dat' `OPTION_LIST`='Endian=Little' `READONLY`=YES INSERT INTO t1 VALUES (7777,'BILL','1973-06-30',4444,5555.555,777); diff --git a/storage/connect/mysql-test/connect/r/dir.result b/storage/connect/mysql-test/connect/r/dir.result index e10bb458d62..34a591fb26c 100644 --- a/storage/connect/mysql-test/connect/r/dir.result +++ b/storage/connect/mysql-test/connect/r/dir.result @@ -26,7 +26,7 @@ fname ftype size boys .txt 282 boyswin .txt 288 INSERT INTO t1 VALUES ('','','',''); -ERROR 22007: Incorrect double value: '' for column 'size' at row 1 +ERROR HY000: Got error 174 'COLBLK SetBuffer: undefined Access Method' from CONNECT DROP TABLE t1; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.txt'; ERROR HY000: Cannot get column info for table type DIR diff --git a/storage/connect/mysql-test/connect/r/grant.result b/storage/connect/mysql-test/connect/r/grant.result index 118d75408be..4e64b983ea7 100644 --- a/storage/connect/mysql-test/connect/r/grant.result +++ b/storage/connect/mysql-test/connect/r/grant.result @@ -4,8 +4,6 @@ set sql_mode=""; # GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -16,7 +14,6 @@ ftype CHAR(4) NOT NULL, size DOUBLE(12,0) NOT NULL flag=5 ) ENGINE=CONNECT TABLE_TYPE=DIR FILE_NAME='*.*'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -29,7 +26,6 @@ size DOUBLE(12,0) NOT NULL flag=5 SELECT fname, ftype, size FROM t1 WHERE size>0; fname ftype size t1 .frm 1081 -connection user; SELECT user(); user() user@localhost @@ -48,12 +44,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -65,8 +59,6 @@ UPDATE v1 SET path=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -disconnect user; -connection default; SELECT user(); user() root@localhost @@ -82,8 +74,6 @@ DROP USER user@localhost; CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -112,13 +102,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -141,12 +129,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -158,7 +144,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -168,15 +153,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=BIN; Warnings: Warning 1105 No file name. Table will use t1.bin INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc @@ -187,8 +169,6 @@ DROP USER user@localhost; CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -217,13 +197,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -246,12 +224,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -263,7 +239,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -273,15 +248,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=CSV; Warnings: Warning 1105 No file name. Table will use t1.csv INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc @@ -292,8 +264,6 @@ DROP USER user@localhost; CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -322,13 +292,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -351,12 +319,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -368,7 +334,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -378,15 +343,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=DBF; Warnings: Warning 1105 No file name. Table will use t1.dbf INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc @@ -397,8 +359,6 @@ DROP USER user@localhost; CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -427,13 +387,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -456,12 +414,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -473,7 +429,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -483,15 +438,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=FIX; Warnings: Warning 1105 No file name. Table will use t1.fix INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc @@ -502,8 +454,6 @@ DROP USER user@localhost; CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -532,13 +482,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100 FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -561,12 +509,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -578,7 +524,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -588,15 +533,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=VEC MAX_ROWS=100; Warnings: Warning 1105 No file name. Table will use t1.vec INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc diff --git a/storage/connect/mysql-test/connect/r/grant2.result b/storage/connect/mysql-test/connect/r/grant2.result index 73e41f49256..0259dd74cdc 100644 --- a/storage/connect/mysql-test/connect/r/grant2.result +++ b/storage/connect/mysql-test/connect/r/grant2.result @@ -5,7 +5,6 @@ CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; # Testing SQLCOM_SELECT -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -22,7 +21,6 @@ a 10 SELECT * FROM v1_baddefiner; ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO) -connect user,localhost,user,,; SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) SELECT * FROM v1_invoker; @@ -30,11 +28,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) SELECT * FROM v1_definer; a 10 -connection default; DROP VIEW v1_invoker, v1_definer, v1_baddefiner; DROP TABLE t1; # Testing SQLCOM_UPDATE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -42,17 +38,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; UPDATE t1 SET a=11; UPDATE v1_invoker SET a=12; UPDATE v1_definer SET a=13; -connection user; UPDATE t1 SET a=21; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) UPDATE v1_invoker SET a=22; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) UPDATE v1_definer SET a=23; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_INSERT -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -60,17 +53,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; INSERT INTO t1 VALUES (11); INSERT INTO v1_invoker VALUES (12); INSERT INTO v1_definer VALUES (13); -connection user; INSERT INTO t1 VALUES (21); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) INSERT INTO v1_invoker VALUES (22); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) INSERT INTO v1_definer VALUES (23); -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_REPLACE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -81,18 +71,15 @@ REPLACE INTO v1_invoker VALUES (12); ERROR 42000: CONNECT Unsupported command REPLACE INTO v1_definer VALUES (13); ERROR 42000: CONNECT Unsupported command -connection user; REPLACE INTO t1 VALUES (21); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) REPLACE INTO v1_invoker VALUES (22); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) REPLACE INTO v1_definer VALUES (23); ERROR 42000: CONNECT Unsupported command -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_DELETE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -100,17 +87,14 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; DELETE FROM t1 WHERE a=11; DELETE FROM v1_invoker WHERE a=12; DELETE FROM v1_definer WHERE a=13; -connection user; DELETE FROM t1 WHERE a=21; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1_invoker WHERE a=22; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1_definer WHERE a=23; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_LOAD -connection default; CREATE TABLE t1 (a VARCHAR(128)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -118,38 +102,29 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer; -connection user; LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_TRUNCATE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); TRUNCATE TABLE t1; INSERT INTO t1 VALUES (11); -connection user; TRUNCATE TABLE t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_DROP_TABLE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); -connection user; DROP TABLE t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_DROP_VIEW # DROP VIEW does not need FILE_ACL. -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10),(11),(12),(13),(21),(22),(23); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -157,18 +132,13 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; DROP VIEW v1_invoker, v1_definer; CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; -connection user; DROP VIEW v1_invoker; DROP VIEW v1_definer; -connection default; DROP TABLE t1; # Testing SQLCOM_CREATE_TABLE -connection user; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; # Testing SQLCOM_LOCK_TABLES -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -185,7 +155,6 @@ LOCK TABLE v1_definer READ; UNLOCK TABLES; LOCK TABLE v1_definer WRITE; UNLOCK TABLES; -connection user; LOCK TABLE t1 READ; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) LOCK TABLE t1 WRITE; @@ -198,11 +167,9 @@ LOCK TABLE v1_definer READ; UNLOCK TABLES; LOCK TABLE v1_definer WRITE; UNLOCK TABLES; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_UPDATE_MULTI -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix'; CREATE TABLE t3 (a INT); @@ -262,7 +229,6 @@ UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -connection user; UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; @@ -352,11 +318,9 @@ UPDATE v2_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -connection default; DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer; DROP TABLE t1, t2, t3; # Testing SQLCOM_DELETE_MULTI -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; CREATE TABLE t2 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t2.fix'; CREATE TABLE t3 (a INT); @@ -416,7 +380,6 @@ DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a; -connection user; DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a; @@ -506,11 +469,9 @@ DELETE a1 FROM v2_definer a1,v1_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v2_invoker a2 WHERE a1.a=a2.a; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a; -connection default; DROP VIEW v1_invoker, v1_definer, v2_invoker, v2_definer; DROP TABLE t1, t2, t3; # Testing SQLCOM_CREATE_VIEW -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -519,18 +480,15 @@ CREATE VIEW v2 AS SELECT * FROM v1_invoker; DROP VIEW v2; CREATE VIEW v2 AS SELECT * FROM v1_definer; DROP VIEW v2; -connection user; CREATE VIEW v2 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v2 AS SELECT * FROM v1_invoker; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v2 AS SELECT * FROM v1_definer; DROP VIEW v2; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_INSERT_SELECT -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -544,7 +502,6 @@ INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; -connection user; INSERT INTO t1 SELECT * FROM t1 WHERE a=20; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20; @@ -562,11 +519,9 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_REPLACE_SELECT -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); CREATE SQL SECURITY INVOKER VIEW v1_invoker AS SELECT * FROM t1; @@ -589,7 +544,6 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; ERROR 42000: CONNECT Unsupported command REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20; ERROR 42000: CONNECT Unsupported command -connection user; REPLACE INTO t1 SELECT * FROM t1 WHERE a=20; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20; @@ -608,11 +562,9 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; ERROR 42000: CONNECT Unsupported command REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20; ERROR 42000: CONNECT Unsupported command -connection default; DROP VIEW v1_invoker, v1_definer; DROP TABLE t1; # Testing SQLCOM_RENAME_TABLE -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); RENAME TABLE t1 TO t2; @@ -622,13 +574,10 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' RENAME TABLE t2 TO t1; -connection user; RENAME TABLE t1 TO t2; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME) -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); ALTER TABLE t1 RENAME TO t2; @@ -638,26 +587,20 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 `TABLE_TYPE`=fix `FILE_NAME`='t1.fix' ALTER TABLE t2 RENAME TO t1; -connection user; ALTER TABLE t1 RENAME TO t2; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT) -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); ALTER TABLE t1 ENGINE=MyISAM; DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); -connection user; ALTER TABLE t1 ENGINE=MyISAM; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT) -connection default; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (10); SELECT * FROM t1; @@ -667,83 +610,63 @@ ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (10); -connection user; ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_OPTIMIZE -connection default; CREATE TABLE t1 (a INT NOT NULL, KEY(a)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize status OK -connection user; OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize Error Access denied for user 'user'@'localhost' (using password: NO) test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT test.t1 optimize error Corrupt -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (adding columns) -connection default; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); ALTER TABLE t1 ADD b INT; Warnings: Warning 1105 This is an outward table, table data were not modified. -connection user; ALTER TABLE t1 ADD c INT; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (removing columns) -connection default; CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10,10,10); ALTER TABLE t1 DROP b; Warnings: Warning 1105 This is an outward table, table data were not modified. -connection user; ALTER TABLE t1 DROP c; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (adding keys) -connection default; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10,10); ALTER TABLE t1 ADD KEY(a); -connection user; ALTER TABLE t1 ADD KEY(b); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (removing keys) -connection default; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10,10); ALTER TABLE t1 DROP KEY a; -connection user; ALTER TABLE t1 DROP KEY b; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX -connection default; CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10,10); CREATE INDEX a ON t1 (a); DROP INDEX a ON t1; CREATE INDEX a ON t1 (a); -connection user; CREATE INDEX b ON t1 (b); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DROP INDEX a ON t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; # Testing stored procedures CREATE PROCEDURE p_definer() SQL SECURITY DEFINER @@ -758,11 +681,9 @@ CALL p_invoker(); DROP TABLE t1; CALL p_baddefiner(); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection user; CALL p_invoker(); ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CALL p_definer(); -connection default; DROP TABLE t1; DROP PROCEDURE p_definer; DROP PROCEDURE p_invoker; diff --git a/storage/connect/mysql-test/connect/r/ini_grant.result b/storage/connect/mysql-test/connect/r/ini_grant.result index 8cbf88123fb..68330278183 100644 --- a/storage/connect/mysql-test/connect/r/ini_grant.result +++ b/storage/connect/mysql-test/connect/r/ini_grant.result @@ -5,8 +5,6 @@ set sql_mode=""; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; set sql_mode=default; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -35,13 +33,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES ('sec1','val1'); -connection user; SELECT user(); user() user@localhost @@ -62,12 +58,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -79,8 +73,6 @@ UPDATE v1 SET val='val11'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -disconnect user; -connection default; DROP VIEW v1; DROP TABLE t1; DROP USER user@localhost; diff --git a/storage/connect/mysql-test/connect/r/jdbc_new.result b/storage/connect/mysql-test/connect/r/jdbc_new.result index 33d8bd3b7d8..f49cb6b6d51 100644 --- a/storage/connect/mysql-test/connect/r/jdbc_new.result +++ b/storage/connect/mysql-test/connect/r/jdbc_new.result @@ -1,7 +1,3 @@ -connect master,127.0.0.1,root,,test,$MASTER_MYPORT,; -connect slave,127.0.0.1,root,,test,$SLAVE_MYPORT,; -connection master; -connection slave; SET GLOBAL time_zone='+1:00'; CREATE TABLE t1 (a int, b char(10)); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); @@ -15,7 +11,6 @@ NULL NULL # # Testing errors # -connection master; SET GLOBAL time_zone='+1:00'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown'; @@ -41,14 +36,10 @@ ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unkn DROP TABLE t1; CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; -connection slave; ALTER TABLE t1 RENAME t1backup; -connection master; SELECT * FROM t1; ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT -connection slave; ALTER TABLE t1backup RENAME t1; -connection master; DROP TABLE t1; # # Testing SELECT, etc. @@ -117,7 +108,6 @@ NULL NULL 2 0 3 0 DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing numeric data types @@ -136,7 +126,6 @@ t1 CREATE TABLE `t1` ( `h` decimal(20,5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; SHOW CREATE TABLE t1; @@ -155,7 +144,6 @@ SELECT * FROM t1; a b c d e f g h 100 3333 41235 1234567890 235000000000 3 3 3141.59265 DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing character data types @@ -171,7 +159,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); SELECT * FROM t1; a b Welcome Hello, World -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; SHOW CREATE TABLE t1; @@ -184,7 +171,6 @@ SELECT * FROM t1; a b Welcome Hello, World DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing temporal data types @@ -196,7 +182,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `e` year(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); @@ -207,7 +193,6 @@ Warning 1265 Data truncated for column 'e' at row 1 SELECT * FROM t1; a b c d e 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; SHOW CREATE TABLE t1; @@ -216,15 +201,13 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `e` year(4) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC' SELECT * FROM t1; a b c d e 2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003 DROP TABLE t1; -connection slave; DROP TABLE t1; SET GLOBAL time_zone=SYSTEM; -connection master; SET GLOBAL time_zone=SYSTEM; diff --git a/storage/connect/mysql-test/connect/r/mysql.result b/storage/connect/mysql-test/connect/r/mysql.result index 29f077c3d9f..3ac23394cbc 100644 --- a/storage/connect/mysql-test/connect/r/mysql.result +++ b/storage/connect/mysql-test/connect/r/mysql.result @@ -17,7 +17,7 @@ ERROR HY000: (1049) Unknown database 'unknown' CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=localhost,user=root,port=PORT' DBNAME='unknown' TABNAME='t1'; ERROR HY000: (1049) Unknown database 'unknown' CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='unknown' OPTION_LIST='host=localhost,user=root,port=PORT'; -ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM unknown FROM test] +ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM `unknown` FROM test] SHOW CREATE TABLE t2; ERROR 42S02: Table 'test.t2' doesn't exist CREATE TABLE t2 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL TABNAME='t1' OPTION_LIST='host=localhost,user=root,port=PORT'; diff --git a/storage/connect/mysql-test/connect/r/mysql_discovery.result b/storage/connect/mysql-test/connect/r/mysql_discovery.result index 32bd4761f37..4580c68558f 100644 --- a/storage/connect/mysql-test/connect/r/mysql_discovery.result +++ b/storage/connect/mysql-test/connect/r/mysql_discovery.result @@ -1,10 +1,5 @@ -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 slave; CREATE TABLE t1 ( `id` int(20) primary key, `group` int NOT NULL default 1, @@ -12,15 +7,14 @@ CREATE TABLE t1 ( `a\\` int unsigned, `name` varchar(32) default 'name') DEFAULT CHARSET=latin1; -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `id` int(20) NOT NULL, - `group` int(11) NOT NULL DEFAULT 1, - `a\\b` int(11) NOT NULL DEFAULT 2, + `group` int(11) NOT NULL DEFAULT '1', + `a\\b` int(11) NOT NULL DEFAULT '2', `a\\` int(10) unsigned DEFAULT NULL, `name` varchar(32) DEFAULT 'name' ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1' `TABLE_TYPE`='MYSQL' @@ -31,15 +25,12 @@ id group a\\b a\\ name 1 1 2 NULL foo 2 1 2 NULL fee DROP TABLE t1; -connection slave; SELECT * FROM t1; id group a\\b a\\ name 1 1 2 NULL foo 2 1 2 NULL fee DROP TABLE t1; -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; diff --git a/storage/connect/mysql-test/connect/r/mysql_exec.result b/storage/connect/mysql-test/connect/r/mysql_exec.result index c0400bc82e7..483fbd9e6a6 100644 --- a/storage/connect/mysql-test/connect/r/mysql_exec.result +++ b/storage/connect/mysql-test/connect/r/mysql_exec.result @@ -1,13 +1,8 @@ -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; # # Checking Sending Commands # -connection master; CREATE TABLE t1 ( command VARCHAR(128) NOT NULL, warnings INT(4) NOT NULL FLAG=3, @@ -53,7 +48,6 @@ command warnings number message update t1 set msg = "Five" where id = 5 0 1 Affected rows DROP PROCEDURE p1; DROP TABLE t1; -connection slave; SELECT * FROM t1; id msg 1 One @@ -62,9 +56,7 @@ id msg 4 Four 5 Five DROP TABLE t1; -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; diff --git a/storage/connect/mysql-test/connect/r/mysql_grant.result b/storage/connect/mysql-test/connect/r/mysql_grant.result index 11a3dbba36c..5f630834392 100644 --- a/storage/connect/mysql-test/connect/r/mysql_grant.result +++ b/storage/connect/mysql-test/connect/r/mysql_grant.result @@ -5,14 +5,11 @@ set sql_mode=""; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; set sql_mode=default; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=PORT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -24,7 +21,6 @@ a 10 20 30 -connection user; SELECT user(); user() user@localhost @@ -43,12 +39,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -60,8 +54,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -disconnect user; -connection default; SELECT user(); user() root@localhost diff --git a/storage/connect/mysql-test/connect/r/mysql_new.result b/storage/connect/mysql-test/connect/r/mysql_new.result index 69402ff7532..4dc394b8960 100644 --- a/storage/connect/mysql-test/connect/r/mysql_new.result +++ b/storage/connect/mysql-test/connect/r/mysql_new.result @@ -1,10 +1,5 @@ -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 slave; CREATE TABLE t1 (a int, b char(10)); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); SELECT * FROM t1; @@ -17,7 +12,6 @@ NULL NULL # # Testing errors # -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://unknown@127.0.0.1:SLAVE_PORT/test/t1'; ERROR HY000: (1045) Access denied for user 'unknown'@'localhost' (using password: NO) @@ -29,7 +23,7 @@ OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT' DBNAME='unknown' TABNAME= ERROR HY000: (1049) Unknown database 'unknown' CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/unknown'; -ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM unknown FROM test] +ERROR HY000: (1146) Table 'test.unknown' doesn't exist [SHOW FULL COLUMNS FROM `unknown` FROM test] SHOW CREATE TABLE t1; ERROR 42S02: Table 'test.t1' doesn't exist CREATE TABLE t1 (x int, y char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL @@ -45,14 +39,10 @@ ERROR HY000: Got error 174 '(1054) Unknown column 'x' in 'field list' [SELECT `x DROP TABLE t1; CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT/test/t1'; -connection slave; ALTER TABLE t1 RENAME t1backup; -connection master; SELECT * FROM t1; ERROR HY000: Got error 174 '(1146) Table 'test.t1' doesn't exist [SELECT `a`, `b` FROM `t1`]' from CONNECT -connection slave; ALTER TABLE t1backup RENAME t1; -connection master; DROP TABLE t1; # # Testing SELECT, etc. @@ -121,7 +111,6 @@ NULL NULL 2 0 3 0 DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing numeric data types @@ -140,7 +129,6 @@ t1 CREATE TABLE `t1` ( `h` decimal(20,5) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT INTO t1 VALUES(100,3333,41235,1234567890,235000000000,3.14159265,3.14159265,3141.59265); -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL OPTION_LIST='host=127.0.0.1,user=root,port=SLAVE_PORT'; SHOW CREATE TABLE t1; @@ -159,7 +147,6 @@ SELECT * FROM t1; a b c d e f g h 100 3333 41235 1234567890 235000000000 3.14159 3.14159265 3141.59265 DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing character data types @@ -175,7 +162,6 @@ INSERT INTO t1 VALUES('Welcome','Hello, World'); SELECT * FROM t1; a b Welcome Hello, World -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; SHOW CREATE TABLE t1; @@ -188,7 +174,6 @@ SELECT * FROM t1; a b Welcome Hello, World DROP TABLE t1; -connection slave; DROP TABLE t1; # # Testing temporal data types @@ -200,7 +185,7 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `e` year(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 INSERT IGNORE INTO t1 VALUES('2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23','2003-05-27 10:45:23'); @@ -211,7 +196,6 @@ Warning 1265 Data truncated for column 'e' at row 1 SELECT * FROM t1; a b c d e 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 -connection master; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT'; SHOW CREATE TABLE t1; @@ -220,18 +204,15 @@ t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `e` year(4) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='mysql://root@127.0.0.1:SLAVE_PORT' `TABLE_TYPE`='MYSQL' SELECT * FROM t1; a b c d e 2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 2003 DROP TABLE t1; -connection slave; DROP TABLE t1; -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; diff --git a/storage/connect/mysql-test/connect/r/tbl_thread.result b/storage/connect/mysql-test/connect/r/tbl_thread.result index 32602e3fbe4..9e8c610dfd2 100644 --- a/storage/connect/mysql-test/connect/r/tbl_thread.result +++ b/storage/connect/mysql-test/connect/r/tbl_thread.result @@ -1,10 +1,5 @@ -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 # @@ -16,7 +11,6 @@ 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; @@ -25,7 +19,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'); SELECT * FROM rt3; @@ -34,7 +28,6 @@ a b 9 test09 10 test10 11 test11 -connection default; CREATE TABLE t2 ENGINE=CONNECT TABLE_TYPE=MYSQL CONNECTION='mysql://root@localhost:MASTER_PORT/test/rt2'; SELECT * FROM t2; @@ -68,11 +61,8 @@ a b 2 test02 1 test01 0 test00 -connection master; DROP TABLE rt2; -connection slave; DROP TABLE rt3; -connection default; DROP TABLE t1,t2,t3,total; # # Old thread TBL tables test modified @@ -110,9 +100,7 @@ v 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; diff --git a/storage/connect/mysql-test/connect/r/xml_grant.result b/storage/connect/mysql-test/connect/r/xml_grant.result index 950ae4a3b35..9d8cb64b60a 100644 --- a/storage/connect/mysql-test/connect/r/xml_grant.result +++ b/storage/connect/mysql-test/connect/r/xml_grant.result @@ -4,8 +4,6 @@ CREATE USER user@localhost; GRANT ALL PRIVILEGES ON *.* TO user@localhost; REVOKE FILE ON *.* FROM user@localhost; -connect user,localhost,user,,; -connection user; SELECT user(); user() user@localhost @@ -34,13 +32,11 @@ DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=domdoc,rownode=row' FILE_NAME='t1.EXT'; INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost @@ -63,12 +59,10 @@ ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) CREATE VIEW v1 AS SELECT * FROM t1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) # Testing a VIEW created with FILE privileges but accessed with no FILE -connection default; SELECT user(); user() root@localhost CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; -connection user; SELECT user(); user() user@localhost @@ -80,7 +74,6 @@ UPDATE v1 SET a=123; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) DELETE FROM v1; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; SELECT user(); user() root@localhost @@ -90,15 +83,12 @@ CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmls Warnings: Warning 1105 No file name. Table will use t1.xml INSERT INTO t1 VALUES (10); -connection user; SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) -connection default; DROP TABLE t1; -disconnect user; DROP USER user@localhost; # # End of grant.inc diff --git a/storage/connect/mysql-test/connect/r/xml_mdev5261.result b/storage/connect/mysql-test/connect/r/xml_mdev5261.result index b5ae32c7784..10959eab951 100644 --- a/storage/connect/mysql-test/connect/r/xml_mdev5261.result +++ b/storage/connect/mysql-test/connect/r/xml_mdev5261.result @@ -17,7 +17,7 @@ SELECT * FROM t1 WHERE i = 5; i 5 ALTER TABLE t1 DROP INDEX i; -ERROR 42000: Can't DROP INDEX `i`; check that it exists +ERROR 42000: Can't DROP 'i'; check that column/key exists DROP INDEX i ON t1; -ERROR 42000: Can't DROP INDEX `i`; check that it exists +ERROR 42000: Can't DROP 'i'; check that column/key exists DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/dir.test b/storage/connect/mysql-test/connect/t/dir.test index 684b5522b08..fb69813d9f0 100644 --- a/storage/connect/mysql-test/connect/t/dir.test +++ b/storage/connect/mysql-test/connect/t/dir.test @@ -23,7 +23,9 @@ ALTER TABLE t1 OPTION_LIST='subdir=0'; SHOW CREATE TABLE t1; --replace_result $MYSQLD_DATADIR DATADIR/ SELECT fname, ftype, size FROM t1 ORDER BY fname, ftype, size; ---error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD + +# TODO: add a better error message +--error ER_GET_ERRMSG INSERT INTO t1 VALUES ('','','',''); DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/tbl_thread.test b/storage/connect/mysql-test/connect/t/tbl_thread.test index 233d4149507..c7003cdaffa 100644 --- a/storage/connect/mysql-test/connect/t/tbl_thread.test +++ b/storage/connect/mysql-test/connect/t/tbl_thread.test @@ -19,6 +19,7 @@ SELECT * FROM rt2; connection slave; +USE test; CREATE TABLE rt3 (a int, b char(10)); INSERT INTO rt3 VALUES (8,'test08'),(9,'test09'),(10,'test10'),(11,'test11'); SELECT * FROM rt3; diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index f29fb6b430b..70a0a6a1450 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -55,6 +55,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle TYPCONV GetTypeConv(); int GetConvSize(); +void OdbcClose(PGLOBAL g, PFBLOCK fp); /***********************************************************************/ /* Some macro's (should be defined elsewhere to be more accessible) */ @@ -302,6 +303,13 @@ static void ResetNullValues(CATPARM *cap) #endif /***********************************************************************/ +/* Close an ODBC table after a thrown error (called by PlugCloseFile) */ +/***********************************************************************/ +void OdbcClose(PGLOBAL g, PFBLOCK fp) { + ((ODBConn*)fp->File)->Close(); +} // end of OdbcClose + +/***********************************************************************/ /* ODBCColumns: constructs the result blocks containing all columns */ /* of an ODBC table that will be retrieved by GetData commands. */ /***********************************************************************/ diff --git a/storage/connect/os.h b/storage/connect/os.h index e2b165fb3f5..797692d47b2 100644 --- a/storage/connect/os.h +++ b/storage/connect/os.h @@ -46,7 +46,7 @@ typedef int INT; sqltypes.h (through sql.h or sqlext.h). */ typedef unsigned long DWORD; -#endif /* !NODW */ +#endif // !NODW #undef HANDLE typedef int HANDLE; diff --git a/storage/connect/plgdbutl.cpp b/storage/connect/plgdbutl.cpp index 691e6ce1a7d..0943ce9f222 100644 --- a/storage/connect/plgdbutl.cpp +++ b/storage/connect/plgdbutl.cpp @@ -68,12 +68,6 @@ #include "tabcol.h" // header of XTAB and COLUMN classes #include "valblk.h" #include "rcmsg.h" -#if defined(ODBC_SUPPORT) -#define NODW // See comment in os.h -#include "tabext.h" -#include "odbccat.h" -#include "tabodbc.h" -#endif // ODBC_SUPPORT #ifdef ZIP_SUPPORT #include "filamzip.h" #endif // ZIP_SUPPORT @@ -120,6 +114,9 @@ void CloseXMLFile(PGLOBAL, PFBLOCK, bool); #include "libdoc.h" #endif // LIBXML2_SUPPORT +#ifdef ODBC_SUPPORT +void OdbcClose(PGLOBAL g, PFBLOCK fp); +#endif // ODBC_SUPPORT /***********************************************************************/ /* Routines for file IO with error reporting to g->Message */ @@ -886,7 +883,7 @@ FILE *PlugReopenFile(PGLOBAL g, PFBLOCK fp, LPCSTR md) /* Close file routine: the purpose of this routine is to avoid */ /* double closing that freeze the system on some Unix platforms. */ /***********************************************************************/ -int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all) +int PlugCloseFile(PGLOBAL g, PFBLOCK fp, bool all) { int rc = 0; @@ -937,7 +934,7 @@ int PlugCloseFile(PGLOBAL g __attribute__((unused)), PFBLOCK fp, bool all) #endif // LIBXML2_SUPPORT #ifdef ODBC_SUPPORT case TYPE_FB_ODBC: - ((ODBConn*)fp->File)->Close(); + OdbcClose(g, fp); fp->Count = 0; fp->File = NULL; break; diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 26cc27b1b01..718da35c7ce 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -227,10 +227,10 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, { int poff = 0; - Name = (PSZ)name; - Schema = (PSZ)schema; + Hc = ((MYCAT*)cat)->GetHandler(); + Name = (PSZ)name; + Schema = (PSZ)Hc->GetDBName(schema); Cat = cat; - Hc = ((MYCAT*)cat)->GetHandler(); Catfunc = GetFuncID(GetStringCatInfo(g, "Catfunc", NULL)); Elemt = GetIntCatInfo("Elements", 0); Multiple = GetIntCatInfo("Multiple", 0); diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 5c79e62b514..1b7ab8ca952 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -54,8 +54,6 @@ /* External functions. */ /***********************************************************************/ USETEMP UseTemp(void); -bool IsNum(PSZ s); -char *NextChr(PSZ s, char sep); char *GetJsonNull(void); typedef struct _jncol { @@ -500,7 +498,7 @@ JSONDEF::JSONDEF(void) Sep = '.'; #if defined(MONGO_SUPPORT) Uri = NULL; - Collname = Schema = Options = Filter = NULL; + Collname = Options = Filter = NULL; Pipe = false; Driver = NULL; Version = 0; @@ -515,7 +513,8 @@ JSONDEF::JSONDEF(void) /***********************************************************************/ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) { - Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT); + Schema = GetStringCatInfo(g, "DBname", Schema); + Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT); Objname = GetStringCatInfo(g, "Object", NULL); Xcol = GetStringCatInfo(g, "Expand", NULL); Pretty = GetIntCatInfo("Pretty", 2); @@ -528,7 +527,6 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) Collname = GetStringCatInfo(g, "Name", (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name); Collname = GetStringCatInfo(g, "Tabname", Collname); - Schema = GetStringCatInfo(g, "Dbname", "test"); Options = GetStringCatInfo(g, "Colist", NULL); Filter = GetStringCatInfo(g, "Filter", NULL); Pipe = GetBoolCatInfo("Pipeline", false); @@ -1592,18 +1590,20 @@ PVAL JSONCOL::ExpandArray(PGLOBAL g, PJAR arp, int n) /***********************************************************************/ PVAL JSONCOL::CalculateArray(PGLOBAL g, PJAR arp, int n) { - int i, ars, nv = 0, nextsame = Tjp->NextSame; - bool err; +//int i, ars, nv = 0, nextsame = Tjp->NextSame; + int i, nv = 0, nextsame = Tjp->NextSame; + bool err; OPVAL op = Nodes[n].Op; PVAL val[2], vp = Nodes[n].Valp; PJVAL jvrp, jvp; JVALUE jval; vp->Reset(); - ars = MY_MIN(Tjp->Limit, arp->size()); +//ars = MY_MIN(Tjp->Limit, arp->size()); - for (i = 0; i < ars; i++) { - jvrp = arp->GetValue(i); +//for (i = 0; i < ars; i++) { + for (i = 0; i < arp->size(); i++) { + jvrp = arp->GetValue(i); if (!jvrp->IsNull() || (op == OP_CNC && GetJsonNull())) do { if (jvrp->IsNull()) { @@ -2278,11 +2278,7 @@ void TDBJSON::CloseDB(PGLOBAL g) TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp) { Topt = tdp->GetTopt(); -#if defined(MONGO_SUPPORT) Db = tdp->Schema; -#else - Db = NULL; -#endif Dsn = tdp->Uri; } // end of TDBJCL constructor diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index eec1f0e355e..00e2f4614e7 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -70,7 +70,6 @@ public: const char *Uri; /* MongoDB connection URI */ #if defined(MONGO_SUPPORT) PCSZ Collname; /* External collection name */ - PCSZ Schema; /* External schema (DB) name */ PSZ Options; /* Colist ; Pipe */ PSZ Filter; /* Filter */ PSZ Driver; /* MongoDB Driver (C or JAVA) */ |