diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2019-10-31 10:58:06 +0100 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2019-10-31 10:58:06 +0100 |
commit | 55b2281a5da38f66dca5e2180672f570c33676df (patch) | |
tree | 9cbb719b71ff8f29e657ff1d468f4270c714d5b5 /storage | |
parent | d6d621cec18251b55202bbd362315b3c1ed90181 (diff) | |
parent | 259edb1f60b5d4e9061a81e90c5a8ec9d0741751 (diff) | |
download | mariadb-git-55b2281a5da38f66dca5e2180672f570c33676df.tar.gz |
Merge branch '10.2' into 10.3
Diffstat (limited to 'storage')
58 files changed, 1225 insertions, 1209 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index 133892b5755..e66247edc68 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -324,7 +324,12 @@ IF(CONNECT_WITH_REST) # INCLUDE_DIRECTORIES(${CPPRESTSDK_INCLUDE_DIR}) # If needed edit next line to set the path to libcpprest.so SET(REST_LIBRARY -lcpprest) -# MESSAGE (STATUS ${REST_LIBRARY}) + MESSAGE (STATUS ${REST_LIBRARY}) + ELSE(NOT UNIX) +# Next line sets debug compile mode matching cpprest_2_10d.dll +# when it was binary installed (can be change later in Visual Studio) +# Comment it out if not needed depending on your cpprestsdk installation. + SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") ENDIF(UNIX) IF(REST_LIBRARY) SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h) diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index b1078de8eaa..461391d2896 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -16,7 +16,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA */ /***********************************************************************/ -/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2017 */ +/* Author Olivier BERTRAND bertrandop@gmail.com 2004-2019 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -389,6 +389,9 @@ RCODE EvalColumns(PGLOBAL g, PTDB tdbp, bool reset, bool mrr) try { for (colp = tdbp->GetColumns(); rc == RC_OK && colp; colp = colp->GetNext()) { + xtrc(2, "Going to read column %s of table %s\n", + colp->GetName(), tdbp->GetName()); + if (reset) colp->Reset(); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 0fc3b7c321f..05d15b41728 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -4501,34 +4501,13 @@ bool ha_connect::check_privileges(THD *thd, PTOS options, const char *dbn, bool case TAB_DIR: case TAB_ZIP: case TAB_OEM: -#ifdef NO_EMBEDDED_ACCESS_CHECKS - return false; - #endif - - /* - Check FILE_ACL - If table or table->mdl_ticket is NULL - it's a DLL, e.g. CREATE TABLE. - if the table has an MDL_EXCLUSIVE lock - it's a DDL too, e.g. the - insert step of CREATE ... SELECT. - - Otherwise it's a DML, the table was normally opened, locked, - privilege were already checked, and table->grant.privilege is set. - With SQL SECURITY DEFINER, table->grant.privilege has definer's privileges. - - Unless we're in prelocking mode, in this case table->grant.privilege - is only checked in start_stmt(), not in external_lock(). - */ - if (!table || !table->mdl_ticket || table->mdl_ticket->get_type() == MDL_EXCLUSIVE) - return check_access(thd, FILE_ACL, db, NULL, NULL, 0, 0); - - if ((!quick && thd->lex->requires_prelocking()) || table->grant.privilege & FILE_ACL) - return false; - - status_var_increment(thd->status_var.access_denied_errors); - my_error(access_denied_error_code(thd->password), MYF(0), - thd->security_ctx->priv_user, thd->security_ctx->priv_host, - (thd->password ? ER(ER_YES) : ER(ER_NO))); - return true; + if (table && table->pos_in_table_list) // if SELECT + { + Switch_to_definer_security_ctx backup_ctx(thd, table->pos_in_table_list); + return check_global_access(thd, FILE_ACL); + } + else + return check_global_access(thd, FILE_ACL); case TAB_ODBC: case TAB_JDBC: case TAB_MONGO: diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp index dacab3c485c..8e79aeac7ef 100644 --- a/storage/connect/inihandl.cpp +++ b/storage/connect/inihandl.cpp @@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section ) } for (key = section->key; key; key = key->next) - if (key->name[0]) { + if (key->name && key->name[0]) { fprintf(file, "%s", SVP(key->name)); if (key->value) diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index e0aca3333e6..2cb75e0adc1 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -1196,9 +1196,14 @@ int JDBConn::GetResultSize(PCSZ sql, PCOL colp) if ((rc = ExecuteQuery(sql)) != RC_OK) return -1; - if ((rc = Fetch()) > 0) - SetColumnValue(1, NULL, colp->GetValue()); - else + if ((rc = Fetch()) > 0) { + try { + SetColumnValue(1, NULL, colp->GetValue()); + } catch (...) { + return -4; + } // end catch + + } else return -2; if ((rc = Fetch()) != 0) diff --git a/storage/connect/mysql-test/connect/r/grant.result b/storage/connect/mysql-test/connect/r/grant.result index c43ad3a5b79..2e7f0e4b2bc 100644 --- a/storage/connect/mysql-test/connect/r/grant.result +++ b/storage/connect/mysql-test/connect/r/grant.result @@ -15,7 +15,7 @@ fname VARCHAR(256) NOT NULL, 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -34,19 +34,19 @@ SELECT user(); user() user@localhost SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO t1 VALUES (); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1 WHERE path='xxx'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET path='yyy' WHERE path='xxx'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -58,13 +58,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (1,1,1,1); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET path=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation disconnect user; connection default; SELECT user(); @@ -111,7 +111,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -123,23 +123,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -151,13 +151,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -173,7 +173,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; @@ -216,7 +216,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -228,23 +228,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -256,13 +256,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -278,7 +278,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; @@ -321,7 +321,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -333,23 +333,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -361,13 +361,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -383,7 +383,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; @@ -426,7 +426,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -438,23 +438,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -466,13 +466,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -488,7 +488,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; @@ -531,7 +531,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -543,23 +543,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -571,13 +571,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -593,7 +593,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; diff --git a/storage/connect/mysql-test/connect/r/grant2.result b/storage/connect/mysql-test/connect/r/grant2.result index 73e41f49256..2e20dc39596 100644 --- a/storage/connect/mysql-test/connect/r/grant2.result +++ b/storage/connect/mysql-test/connect/r/grant2.result @@ -21,12 +21,12 @@ SELECT * FROM v1_definer; a 10 SELECT * FROM v1_baddefiner; -ERROR 28000: Access denied for user 'root'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connect user,localhost,user,,; SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM v1_invoker; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM v1_definer; a 10 @@ -44,9 +44,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker SET a=22; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer SET a=23; connection default; DROP VIEW v1_invoker, v1_definer; @@ -62,9 +62,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_invoker VALUES (22); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_definer VALUES (23); connection default; DROP VIEW v1_invoker, v1_definer; @@ -83,9 +83,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_invoker VALUES (22); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_definer VALUES (23); ERROR 42000: CONNECT Unsupported command connection default; @@ -102,9 +102,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1_invoker WHERE a=22; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1_definer WHERE a=23; connection default; DROP VIEW v1_invoker, v1_definer; @@ -120,9 +120,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation LOAD DATA LOCAL INFILE 'MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer; connection default; DROP VIEW v1_invoker, v1_definer; @@ -135,7 +135,7 @@ TRUNCATE TABLE t1; INSERT INTO t1 VALUES (11); connection user; TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_DROP_TABLE @@ -144,7 +144,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_DROP_VIEW @@ -165,7 +165,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; # Testing SQLCOM_LOCK_TABLES connection default; @@ -187,13 +187,13 @@ LOCK TABLE v1_definer WRITE; UNLOCK TABLES; connection user; LOCK TABLE t1 READ; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation LOCK TABLE t1 WRITE; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation LOCK TABLE v1_invoker READ; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation LOCK TABLE v1_invoker WRITE; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation LOCK TABLE v1_definer READ; UNLOCK TABLES; LOCK TABLE v1_definer WRITE; @@ -264,93 +264,93 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation 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; @@ -418,93 +418,93 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a; DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,v1_invoker a2 WHERE a1.a=a2.a; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation 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; @@ -521,9 +521,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v2 AS SELECT * FROM v1_invoker; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v2 AS SELECT * FROM v1_definer; DROP VIEW v2; connection default; @@ -546,21 +546,21 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; connection default; DROP VIEW v1_invoker, v1_definer; @@ -591,17 +591,17 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20; ERROR 42000: CONNECT Unsupported command REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; @@ -624,7 +624,7 @@ t2 CREATE TABLE `t2` ( RENAME TABLE t2 TO t1; connection user; RENAME TABLE t1 TO t2; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (for ALTER..RENAME) @@ -640,7 +640,7 @@ t2 CREATE TABLE `t2` ( 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (changing ENGINE to non-CONNECT) @@ -653,7 +653,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (changing ENGINE to CONNECT) @@ -669,7 +669,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_OPTIMIZE @@ -682,7 +682,7 @@ 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 Access denied; you need (at least one of) the FILE privilege(s) for this operation test.t1 optimize Error Got error 122 'This operation requires the FILE privilege' from CONNECT test.t1 optimize error Corrupt connection default; @@ -696,7 +696,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (removing columns) @@ -708,7 +708,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (adding keys) @@ -718,7 +718,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_ALTER_TABLE (removing keys) @@ -728,7 +728,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing SQLCOM_CREATE_INDEX and SQLCOM_DROP_INDEX @@ -740,9 +740,9 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP INDEX a ON t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; # Testing stored procedures @@ -757,10 +757,10 @@ DROP TABLE t1; CALL p_invoker(); DROP TABLE t1; CALL p_baddefiner(); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection user; CALL p_invoker(); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CALL p_definer(); connection default; DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/r/ini_grant.result b/storage/connect/mysql-test/connect/r/ini_grant.result index 8cbf88123fb..96d5e192c7d 100644 --- a/storage/connect/mysql-test/connect/r/ini_grant.result +++ b/storage/connect/mysql-test/connect/r/ini_grant.result @@ -34,7 +34,7 @@ sec val 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -46,21 +46,21 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES ('sec2','val2'); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET val='val11'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -72,13 +72,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES ('sec3','val3'); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET val='val11'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation disconnect user; connection default; DROP VIEW v1; diff --git a/storage/connect/mysql-test/connect/r/mysql_grant.result b/storage/connect/mysql-test/connect/r/mysql_grant.result index 11a3dbba36c..83a906afed5 100644 --- a/storage/connect/mysql-test/connect/r/mysql_grant.result +++ b/storage/connect/mysql-test/connect/r/mysql_grant.result @@ -11,7 +11,7 @@ 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -29,19 +29,19 @@ SELECT user(); user() user@localhost SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO t1 VALUES ('xxx'); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1 WHERE a='xxx'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a='yyy' WHERE a='xxx'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -53,13 +53,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation disconnect user; connection default; SELECT user(); diff --git a/storage/connect/mysql-test/connect/r/xml2_grant.result b/storage/connect/mysql-test/connect/r/xml2_grant.result index 817d3f5bf57..a6e6c150b59 100644 --- a/storage/connect/mysql-test/connect/r/xml2_grant.result +++ b/storage/connect/mysql-test/connect/r/xml2_grant.result @@ -35,7 +35,7 @@ a DROP VIEW v1; DROP TABLE t1; CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2,rownode=row' FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -47,23 +47,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -75,13 +75,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -97,7 +97,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; diff --git a/storage/connect/mysql-test/connect/r/xml_grant.result b/storage/connect/mysql-test/connect/r/xml_grant.result index 950ae4a3b35..f1a6ad101cb 100644 --- a/storage/connect/mysql-test/connect/r/xml_grant.result +++ b/storage/connect/mysql-test/connect/r/xml_grant.result @@ -33,7 +33,7 @@ a 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) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -45,23 +45,23 @@ SELECT user(); user() user@localhost INSERT INTO t1 VALUES (10); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE t1 SET a=20; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation TRUNCATE TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 READONLY=1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation ALTER TABLE t1 FILE_NAME='t2.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DROP TABLE t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation CREATE VIEW v1 AS SELECT * FROM t1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation # Testing a VIEW created with FILE privileges but accessed with no FILE connection default; SELECT user(); @@ -73,13 +73,13 @@ SELECT user(); user() user@localhost SELECT * FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation INSERT INTO v1 VALUES (2); -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation UPDATE v1 SET a=123; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation DELETE FROM v1; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; SELECT user(); user() @@ -95,7 +95,7 @@ SELECT user(); user() user@localhost ALTER TABLE t1 FILE_NAME='t1.EXT'; -ERROR 28000: Access denied for user 'user'@'localhost' (using password: NO) +ERROR 42000: Access denied; you need (at least one of) the FILE privilege(s) for this operation connection default; DROP TABLE t1; disconnect user; diff --git a/storage/connect/mysql-test/connect/t/grant.inc b/storage/connect/mysql-test/connect/t/grant.inc index 6580c845b56..ef6e0cec297 100644 --- a/storage/connect/mysql-test/connect/t/grant.inc +++ b/storage/connect/mysql-test/connect/t/grant.inc @@ -25,7 +25,7 @@ DROP TABLE t1; # Making sure DROP erased the data file --error 1 --remove_file $MYSQLD_DATADIR/test/t1.$FILE_EXT ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR --eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT $TABLE_OPTIONS FILE_NAME='t1.EXT' --connection default SELECT user(); @@ -33,23 +33,23 @@ SELECT user(); INSERT INTO t1 VALUES (10); --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 VALUES (10); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 SET a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR TRUNCATE TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 READONLY=1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 FILE_NAME='t2.EXT'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DROP TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v1 AS SELECT * FROM t1; --echo # Testing a VIEW created with FILE privileges but accessed with no FILE --connection default @@ -57,13 +57,13 @@ SELECT user(); CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1 VALUES (2); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1 SET a=123; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM v1; --connection default SELECT user(); @@ -74,7 +74,7 @@ DROP TABLE t1; INSERT INTO t1 VALUES (10); --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 FILE_NAME='t1.EXT'; --connection default DROP TABLE t1; diff --git a/storage/connect/mysql-test/connect/t/grant.test b/storage/connect/mysql-test/connect/t/grant.test index c4a91904e73..afe550267c4 100644 --- a/storage/connect/mysql-test/connect/t/grant.test +++ b/storage/connect/mysql-test/connect/t/grant.test @@ -11,7 +11,7 @@ REVOKE FILE ON *.* FROM user@localhost; --connect(user,localhost,user,,) --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE TABLE t1 ( path VARCHAR(256) NOT NULL flag=1, fname VARCHAR(256) NOT NULL, @@ -32,19 +32,19 @@ SELECT fname, ftype, size FROM t1 WHERE size>0 AND ftype!='.opt'; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 VALUES (); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM t1 WHERE path='xxx'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 SET path='yyy' WHERE path='xxx'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR TRUNCATE TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 READONLY=1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v1 AS SELECT * FROM t1; --echo # Testing a VIEW created with FILE privileges but accessed with no FILE @@ -53,13 +53,13 @@ SELECT user(); CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1 VALUES (1,1,1,1); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1 SET path=123; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM v1; --disconnect user diff --git a/storage/connect/mysql-test/connect/t/grant2.test b/storage/connect/mysql-test/connect/t/grant2.test index 8e7d9453e70..351eb97f11a 100644 --- a/storage/connect/mysql-test/connect/t/grant2.test +++ b/storage/connect/mysql-test/connect/t/grant2.test @@ -23,13 +23,13 @@ CREATE DEFINER=user@localhost SQL SECURITY DEFINER VIEW v1_baddefiner AS SELECT SELECT * FROM t1; SELECT * FROM v1_invoker; SELECT * FROM v1_definer; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1_baddefiner; --connect(user,localhost,user,,) ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1_invoker; SELECT * FROM v1_definer; --connection default @@ -47,9 +47,9 @@ UPDATE t1 SET a=11; UPDATE v1_invoker SET a=12; UPDATE v1_definer SET a=13; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 SET a=21; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker SET a=22; UPDATE v1_definer SET a=23; --connection default @@ -67,9 +67,9 @@ INSERT INTO t1 VALUES (11); INSERT INTO v1_invoker VALUES (12); INSERT INTO v1_definer VALUES (13); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 VALUES (21); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_invoker VALUES (22); INSERT INTO v1_definer VALUES (23); --connection default @@ -79,7 +79,7 @@ DROP TABLE t1; --echo # Testing SQLCOM_REPLACE # REPLACE is not supported by ConnectSE, so we're testing the difference -# between ER_ACCESS_DENIED_ERROR vs ER_NOT_ALLOWED_COMMAND +# between ER_SPECIFIC_ACCESS_DENIED_ERROR vs ER_NOT_ALLOWED_COMMAND --connection default CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); @@ -92,9 +92,9 @@ REPLACE INTO v1_invoker VALUES (12); --error ER_NOT_ALLOWED_COMMAND REPLACE INTO v1_definer VALUES (13); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO t1 VALUES (21); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO v1_invoker VALUES (22); --error ER_NOT_ALLOWED_COMMAND REPLACE INTO v1_definer VALUES (23); @@ -113,9 +113,9 @@ DELETE FROM t1 WHERE a=11; DELETE FROM v1_invoker WHERE a=12; DELETE FROM v1_definer WHERE a=13; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM t1 WHERE a=21; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM v1_invoker WHERE a=22; DELETE FROM v1_definer WHERE a=23; --connection default @@ -137,10 +137,10 @@ CREATE SQL SECURITY DEFINER VIEW v1_definer AS SELECT * FROM t1; --eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer --connection user --replace_result $MTR_SUITE_DIR MTR_SUITE_DIR ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR --eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE t1 --replace_result $MTR_SUITE_DIR MTR_SUITE_DIR ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR --eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_invoker --replace_result $MTR_SUITE_DIR MTR_SUITE_DIR --eval LOAD DATA LOCAL INFILE '$MTR_SUITE_DIR/std_data/boys.txt' INTO TABLE v1_definer @@ -156,7 +156,7 @@ INSERT INTO t1 VALUES (10); TRUNCATE TABLE t1; INSERT INTO t1 VALUES (11); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR TRUNCATE TABLE t1; --connection default DROP TABLE t1; @@ -168,7 +168,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DROP TABLE t1; --connection default DROP TABLE t1; @@ -193,7 +193,7 @@ DROP TABLE t1; --echo # Testing SQLCOM_CREATE_TABLE --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; --connection default @@ -216,13 +216,13 @@ UNLOCK TABLES; LOCK TABLE v1_definer WRITE; UNLOCK TABLES; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR LOCK TABLE t1 READ; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR LOCK TABLE t1 WRITE; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR LOCK TABLE v1_invoker READ; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR LOCK TABLE v1_invoker WRITE; LOCK TABLE v1_definer READ; UNLOCK TABLES; @@ -299,108 +299,108 @@ UPDATE v2_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; --connection user # All queries with t1 should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # All queries with t2 should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t2 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # t3 does not need FILE_ALC ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t3 a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t3 a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; # This is OK: UPDATE t3 a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t3 a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; # This is OK: UPDATE t3 a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t3 a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; # This is OK: UPDATE t3 a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # All queries with v1_invoker should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # v1_definer does not need FILE_ACL from the invoker ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_definer a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_definer a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1_definer a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v1_definer a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # All queries with v2_invoker should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,v1_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,v1_definer a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,v2_invoker a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_invoker a1,v2_definer a2 SET a1.a=50 WHERE a1.a=a2.a; # v2_definer does not need FILE_ACL from the invoker ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_definer a1,t1 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v2_definer a1,t2 a2 SET a1.a=50 WHERE a1.a=a2.a; UPDATE v2_definer a1,t3 a2 SET a1.a=50 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR 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; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR 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; @@ -476,108 +476,108 @@ DELETE a1 FROM v2_definer a1,v2_definer a2 WHERE a1.a=a2.a; --connection user # All queries with t1 should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,t2 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,v1_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,v2_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t1 a1,v2_definer a2 WHERE a1.a=a2.a; # All queries with t2 should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,t2 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,v1_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,v2_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t2 a1,v2_definer a2 WHERE a1.a=a2.a; # t3 does not need FILE_ALC ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t3 a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t3 a1,t2 a2 WHERE a1.a=a2.a; # This is OK: DELETE a1 FROM t3 a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t3 a1,v1_invoker a2 WHERE a1.a=a2.a; # This is OK: DELETE a1 FROM t3 a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM t3 a1,v2_invoker a2 WHERE a1.a=a2.a; # This is OK: DELETE a1 FROM t3 a1,v2_definer a2 WHERE a1.a=a2.a; # All queries with v1_invoker should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,t2 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,v1_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,v2_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_invoker a1,v2_definer a2 WHERE a1.a=a2.a; # v1_definer does not need FILE_ACL from the invoker ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_definer a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_definer a1,t2 a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_definer a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_definer a1,v1_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_definer a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v1_definer a1,v2_invoker a2 WHERE a1.a=a2.a; DELETE a1 FROM v1_definer a1,v2_definer a2 WHERE a1.a=a2.a; # All queries with v2_invoker should fail ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,t2 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,v1_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,v1_definer a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,v2_invoker a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_invoker a1,v2_definer a2 WHERE a1.a=a2.a; # v2_definer does not need FILE_ACL from the invoker ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_definer a1,t1 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE a1 FROM v2_definer a1,t2 a2 WHERE a1.a=a2.a; DELETE a1 FROM v2_definer a1,t3 a2 WHERE a1.a=a2.a; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR 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; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR 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; @@ -598,9 +598,9 @@ DROP VIEW v2; CREATE VIEW v2 AS SELECT * FROM v1_definer; DROP VIEW v2; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v2 AS SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v2 AS SELECT * FROM v1_invoker; CREATE VIEW v2 AS SELECT * FROM v1_definer; DROP VIEW v2; @@ -625,21 +625,21 @@ 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 ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 SELECT * FROM t1 WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 SELECT * FROM v1_invoker WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 SELECT * FROM v1_definer WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_invoker SELECT * FROM t1 WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_definer SELECT * FROM t1 WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; # This is OK: INSERT INTO v1_definer SELECT * FROM v1_definer WHERE a=20; @@ -650,7 +650,7 @@ DROP TABLE t1; --echo # Testing SQLCOM_REPLACE_SELECT # REPLACE is not supported by CONNECT -# so we're testing ER_NOT_ALLOWED_COMMAND vs ER_ACCESS_DENIED_ERROR here +# so we're testing ER_NOT_ALLOWED_COMMAND vs ER_SPECIFIC_ACCESS_DENIED_ERROR here --connection default CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); @@ -676,17 +676,17 @@ REPLACE INTO v1_definer SELECT * FROM v1_invoker WHERE a=20; REPLACE INTO v1_definer SELECT * FROM v1_definer WHERE a=20; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO t1 SELECT * FROM t1 WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO t1 SELECT * FROM v1_invoker WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO t1 SELECT * FROM v1_definer WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO v1_invoker SELECT * FROM t1 WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO v1_invoker SELECT * FROM v1_invoker WHERE a=20; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR REPLACE INTO v1_invoker SELECT * FROM v1_definer WHERE a=20; --error ER_NOT_ALLOWED_COMMAND REPLACE INTO v1_definer SELECT * FROM t1 WHERE a=20; @@ -708,7 +708,7 @@ SHOW CREATE TABLE t2; RENAME TABLE t2 TO t1; --connection user # TODO: Perhaps FILE_ACL is needed for RENAME. Discuss with Oliver. ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR RENAME TABLE t1 TO t2; --connection default DROP TABLE t1; @@ -723,7 +723,7 @@ SHOW CREATE TABLE t2; ALTER TABLE t2 RENAME TO t1; --connection user # TODO: Perhaps FILE_ACL is not needed for ALTER..RENAME. Discuss with Olivier. ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 RENAME TO t2; --connection default DROP TABLE t1; @@ -739,7 +739,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; INSERT INTO t1 VALUES (10); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 ENGINE=MyISAM; --connection default DROP TABLE t1; @@ -756,7 +756,7 @@ DROP TABLE t1; CREATE TABLE t1 (a INT) ENGINE=MyISAM; INSERT INTO t1 VALUES (10); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1.fix'; --connection default DROP TABLE t1; @@ -779,7 +779,7 @@ 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; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 ADD c INT; --connection default DROP TABLE t1; @@ -791,7 +791,7 @@ CREATE TABLE t1 (a INT,b INT,c INT) ENGINE=CONNECT TABLE_TYPE=fix FILE_NAME='t1. INSERT INTO t1 VALUES (10,10,10); ALTER TABLE t1 DROP b; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 DROP c; --connection default DROP TABLE t1; @@ -803,7 +803,7 @@ CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=fix FI INSERT INTO t1 VALUES (10,10); ALTER TABLE t1 ADD KEY(a); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 ADD KEY(b); --connection default DROP TABLE t1; @@ -816,7 +816,7 @@ CREATE TABLE t1 (a INT NOT NULL,b INT NOT NULL, KEY a(a), KEY b(b)) ENGINE=CONNE INSERT INTO t1 VALUES (10,10); ALTER TABLE t1 DROP KEY a; --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 DROP KEY b; --connection default DROP TABLE t1; @@ -831,9 +831,9 @@ CREATE INDEX a ON t1 (a); DROP INDEX a ON t1; CREATE INDEX a ON t1 (a); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE INDEX b ON t1 (b); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DROP INDEX a ON t1; --connection default DROP TABLE t1; @@ -852,11 +852,11 @@ CALL p_definer(); DROP TABLE t1; CALL p_invoker(); DROP TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CALL p_baddefiner(); --connection user ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CALL p_invoker(); CALL p_definer(); diff --git a/storage/connect/mysql-test/connect/t/ini_grant.test b/storage/connect/mysql-test/connect/t/ini_grant.test index b0ddcb57979..bbf85e5f794 100644 --- a/storage/connect/mysql-test/connect/t/ini_grant.test +++ b/storage/connect/mysql-test/connect/t/ini_grant.test @@ -29,7 +29,7 @@ DROP TABLE t1; # Making sure DROP erased the data file --error 1 --remove_file $MYSQLD_DATADIR/test/t1.ini ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CONNECT TABLE_TYPE=INI FILE_NAME='t1.EXT'; --connection default SELECT user(); @@ -37,21 +37,21 @@ CREATE TABLE t1 (sec CHAR(10) NOT NULL FLAG=1, val CHAR(10) NOT NULL) ENGINE=CON INSERT INTO t1 VALUES ('sec1','val1'); --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 VALUES ('sec2','val2'); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 SET val='val11'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR TRUNCATE TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 READONLY=1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DROP TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v1 AS SELECT * FROM t1; --echo # Testing a VIEW created with FILE privileges but accessed with no FILE --connection default @@ -59,13 +59,13 @@ SELECT user(); CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1 VALUES ('sec3','val3'); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1 SET val='val11'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM v1; --disconnect user --connection default diff --git a/storage/connect/mysql-test/connect/t/mysql_grant.test b/storage/connect/mysql-test/connect/t/mysql_grant.test index 7d3d05cb8fd..30737258a1f 100644 --- a/storage/connect/mysql-test/connect/t/mysql_grant.test +++ b/storage/connect/mysql-test/connect/t/mysql_grant.test @@ -27,7 +27,7 @@ set sql_mode=default; --connection user SELECT user(); --replace_result $PORT PORT ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR --eval CREATE TABLE t1 (a INT NOT NULL) ENGINE=CONNECT TABLE_TYPE=MySQL OPTION_LIST='host=localhost,user=root1,port=$PORT' --connection default SELECT user(); @@ -38,19 +38,19 @@ INSERT INTO t1remote VALUES (10),(20),(30); SELECT * FROM t1; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO t1 VALUES ('xxx'); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM t1 WHERE a='xxx'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE t1 SET a='yyy' WHERE a='xxx'; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR TRUNCATE TABLE t1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR ALTER TABLE t1 READONLY=1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR CREATE VIEW v1 AS SELECT * FROM t1; --echo # Testing a VIEW created with FILE privileges but accessed with no FILE @@ -59,13 +59,13 @@ SELECT user(); CREATE SQL SECURITY INVOKER VIEW v1 AS SELECT * FROM t1; --connection user SELECT user(); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR SELECT * FROM v1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR INSERT INTO v1 VALUES (2); ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR UPDATE v1 SET a=123; ---error ER_ACCESS_DENIED_ERROR +--error ER_SPECIFIC_ACCESS_DENIED_ERROR DELETE FROM v1; --disconnect user diff --git a/storage/connect/rest.h b/storage/connect/rest.h deleted file mode 100644 index f1d77e0a279..00000000000 --- a/storage/connect/rest.h +++ /dev/null @@ -1,33 +0,0 @@ -/***********************************************************************/ -/* Definitions needed by the included files. */ -/***********************************************************************/ -#if !defined(MY_GLOBAL_H) -#define MY_GLOBAL_H -typedef unsigned int uint; -typedef unsigned int uint32; -typedef unsigned short ushort; -typedef unsigned long ulong; -typedef unsigned long DWORD; -typedef char *LPSTR; -typedef const char *LPCSTR; -typedef int BOOL; -#if defined(_WINDOWS) -typedef void *HANDLE; -#else -typedef int HANDLE; -#endif -typedef char *PSZ; -typedef const char *PCSZ; -typedef unsigned char BYTE; -typedef unsigned char uchar; -typedef long long longlong; -typedef unsigned long long ulonglong; -typedef char my_bool; -struct charset_info_st {}; -typedef const charset_info_st CHARSET_INFO; -#define FALSE 0 -#define TRUE 1 -#define Item char -#define MY_MAX(a,b) ((a>b)?(a):(b)) -#define MY_MIN(a,b) ((a<b)?(a):(b)) -#endif // MY_GLOBAL_H
\ No newline at end of file diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index 0fa117c3d2f..ba5c65e2c94 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -605,8 +605,10 @@ bool TDBODBC::OpenDB(PGLOBAL g) Cnp->InitValue(g); if ((n = Ocp->GetResultSize(Query->GetStr(), Cnp)) < 0) { - strcpy(g->Message, "Cannot get result size"); - return true; + char* msg = PlugDup(g, g->Message); + + sprintf(g->Message, "Get result size: %s (rc=%d)", msg, n); + return true; } else if (n) { Ocp->m_Rows = n; diff --git a/storage/connect/valblk.cpp b/storage/connect/valblk.cpp index 5179fa654cf..b7c8c704e65 100644 --- a/storage/connect/valblk.cpp +++ b/storage/connect/valblk.cpp @@ -206,6 +206,7 @@ void VALBLK::ChkIndx(int n) { if (n < 0 || n >= Nval) { PGLOBAL& g = Global; + xtrc(1, "ChkIndx: n=%d Nval=%d\n", n, Nval); strcpy(g->Message, MSG(BAD_VALBLK_INDX)); throw Type; } // endif n @@ -216,7 +217,8 @@ void VALBLK::ChkTyp(PVAL v) { if (Check && (Type != v->GetType() || Unsigned != v->IsUnsigned())) { PGLOBAL& g = Global; - strcpy(g->Message, MSG(VALTYPE_NOMATCH)); + xtrc(1, "ChkTyp: Type=%d valType=%d\n", Type, v->GetType()); + strcpy(g->Message, MSG(VALTYPE_NOMATCH)); throw Type; } // endif Type diff --git a/storage/connect/value.cpp b/storage/connect/value.cpp index d9330a68a15..df75722d0e8 100644 --- a/storage/connect/value.cpp +++ b/storage/connect/value.cpp @@ -123,7 +123,7 @@ ulonglong CharToNumber(const char *p, int n, ulonglong maxval, case '+': p++; break; - } // endswitch *p + } // endswitch *p for (val = 0; p < p2 && (c = (uchar)(*p - '0')) < 10; p++) if (val > (maxval - c) / 10) { @@ -140,7 +140,7 @@ ulonglong CharToNumber(const char *p, int n, ulonglong maxval, /* GetTypeName: returns the PlugDB internal type name. */ /***********************************************************************/ PCSZ GetTypeName(int type) - { +{ PCSZ name; switch (type) { @@ -155,17 +155,17 @@ PCSZ GetTypeName(int type) case TYPE_BIN: name = "BINARY"; break; case TYPE_PCHAR: name = "PCHAR"; break; default: name = "UNKNOWN"; break; - } // endswitch type + } // endswitch type return name; - } // end of GetTypeName +} // end of GetTypeName /***********************************************************************/ /* GetTypeSize: returns the PlugDB internal type size. */ /***********************************************************************/ int GetTypeSize(int type, int len) { - switch (type) { + switch (type) { case TYPE_DECIM: case TYPE_BIN: case TYPE_STRING: len = len * sizeof(char); break; @@ -177,16 +177,16 @@ int GetTypeSize(int type, int len) case TYPE_TINY: len = sizeof(char); break; case TYPE_PCHAR: len = sizeof(char*); break; default: len = -1; - } // endswitch type + } // endswitch type return len; - } // end of GetTypeSize +} // end of GetTypeSize /***********************************************************************/ /* GetFormatType: returns the FORMAT character(s) according to type. */ /***********************************************************************/ const char *GetFormatType(int type) - { +{ const char *c = "X"; switch (type) { @@ -200,16 +200,16 @@ const char *GetFormatType(int type) case TYPE_DECIM: c = "M"; break; case TYPE_BIN: c = "B"; break; case TYPE_PCHAR: c = "P"; break; - } // endswitch type + } // endswitch type return c; - } // end of GetFormatType +} // end of GetFormatType /***********************************************************************/ /* GetFormatType: returns the FORMAT type according to character. */ /***********************************************************************/ int GetFormatType(char c) - { +{ int type = TYPE_ERROR; switch (c) { @@ -223,31 +223,31 @@ int GetFormatType(char c) case 'M': type = TYPE_DECIM; break; case 'B': type = TYPE_BIN; break; case 'P': type = TYPE_PCHAR; break; - } // endswitch type + } // endswitch type return type; - } // end of GetFormatType +} // end of GetFormatType /***********************************************************************/ /* IsTypeChar: returns true for character type(s). */ /***********************************************************************/ bool IsTypeChar(int type) - { +{ switch (type) { case TYPE_STRING: case TYPE_DECIM: case TYPE_BIN: return true; - } // endswitch type + } // endswitch type return false; - } // end of IsTypeChar +} // end of IsTypeChar /***********************************************************************/ /* IsTypeNum: returns true for numeric types. */ /***********************************************************************/ bool IsTypeNum(int type) - { +{ switch (type) { case TYPE_INT: case TYPE_BIGINT: @@ -258,16 +258,16 @@ bool IsTypeNum(int type) case TYPE_TINY: case TYPE_DECIM: return true; - } // endswitch type + } // endswitch type return false; - } // end of IsTypeNum +} // end of IsTypeNum /***********************************************************************/ /* GetFmt: returns the format to use with a typed value. */ /***********************************************************************/ const char *GetFmt(int type, bool un) - { +{ const char *fmt; switch (type) { @@ -278,10 +278,10 @@ const char *GetFmt(int type, bool un) case TYPE_DOUBLE: fmt = "%.*lf"; break; case TYPE_BIN: fmt = "%*x"; break; default: fmt = (un) ? "%u" : "%d"; break; - } // endswitch Type + } // endswitch Type return fmt; - } // end of GetFmt +} // end of GetFmt /***********************************************************************/ /* ConvertType: what this function does is to determine the type to */ @@ -293,7 +293,7 @@ const char *GetFmt(int type, bool un) /* IsType... functions so match does not prevent correct setting. */ /***********************************************************************/ int ConvertType(int target, int type, CONV kind, bool match) - { +{ switch (kind) { case CNV_CHAR: if (match && (!IsTypeChar(target) || !IsTypeChar(type))) @@ -326,15 +326,15 @@ int ConvertType(int target, int type, CONV kind, bool match) : (target == TYPE_STRING || type == TYPE_STRING) ? TYPE_STRING : (target == TYPE_TINY || type == TYPE_TINY) ? TYPE_TINY : TYPE_ERROR; - } // endswitch kind + } // endswitch kind - } // end of ConvertType +} // end of ConvertType /***********************************************************************/ /* AllocateConstant: allocates a constant Value. */ /***********************************************************************/ PVAL AllocateValue(PGLOBAL g, void *value, short type, short prec) - { +{ PVAL valp; if (trace(1)) @@ -362,18 +362,18 @@ PVAL AllocateValue(PGLOBAL g, void *value, short type, short prec) default: sprintf(g->Message, MSG(BAD_VALUE_TYPE), type); return NULL; - } // endswitch Type + } // endswitch Type valp->SetGlobal(g); return valp; - } // end of AllocateValue +} // end of AllocateValue /***********************************************************************/ /* Allocate a variable Value according to type, length and precision. */ /***********************************************************************/ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, bool uns, PCSZ fmt) - { +{ PVAL valp; switch (type) { @@ -423,18 +423,18 @@ PVAL AllocateValue(PGLOBAL g, int type, int len, int prec, default: sprintf(g->Message, MSG(BAD_VALUE_TYPE), type); return NULL; - } // endswitch type + } // endswitch type valp->SetGlobal(g); return valp; - } // end of AllocateValue +} // end of AllocateValue /***********************************************************************/ /* Allocate a constant Value converted to newtype. */ /* Can also be used to copy a Value eventually converted. */ /***********************************************************************/ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) - { +{ PSZ p, sp; bool un = (uns < 0) ? false : (uns > 0) ? true : valp->IsUnsigned(); PVAL vp; @@ -495,13 +495,13 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) default: sprintf(g->Message, MSG(BAD_VALUE_TYPE), newtype); return NULL; - } // endswitch type + } // endswitch type vp->SetNullable(valp->GetNullable()); vp->SetNull(valp->IsNull()); vp->SetGlobal(g); return vp; - } // end of AllocateValue +} // end of AllocateValue /* -------------------------- Class VALUE ---------------------------- */ @@ -509,7 +509,7 @@ PVAL AllocateValue(PGLOBAL g, PVAL valp, int newtype, int uns) /* Class VALUE protected constructor. */ /***********************************************************************/ VALUE::VALUE(int type, bool un) : Type(type) - { +{ Null = false; Nullable = false; Unsigned = un; @@ -517,13 +517,13 @@ VALUE::VALUE(int type, bool un) : Type(type) Prec = 0; Fmt = GetFmt(Type, Unsigned); Xfmt = GetXfmt(); - } // end of VALUE constructor +} // end of VALUE constructor /***********************************************************************/ /* VALUE GetXfmt: returns the extended format to use with typed value. */ /***********************************************************************/ const char *VALUE::GetXfmt(void) - { +{ const char *fmt; switch (Type) { @@ -537,7 +537,7 @@ const char *VALUE::GetXfmt(void) } // endswitch Type return fmt; - } // end of GetFmt +} // end of GetXFmt /***********************************************************************/ /* Returns a BYTE indicating the comparison between two values. */ @@ -545,20 +545,20 @@ const char *VALUE::GetXfmt(void) /* More than 1 bit can be set only in the case of TYPE_LIST. */ /***********************************************************************/ BYTE VALUE::TestValue(PVAL vp) - { +{ int n = CompareValue(vp); return (n > 0) ? 0x04 : (n < 0) ? 0x02 : 0x01; - } // end of TestValue +} // end of TestValue /***********************************************************************/ /* Compute a function on a string. */ /***********************************************************************/ bool VALUE::Compute(PGLOBAL g, PVAL *, int, OPVAL) - { +{ strcpy(g->Message, "Compute not implemented for this value type"); return true; - } // end of Compute +} // end of Compute /***********************************************************************/ /* Make file output of an object value. */ @@ -600,11 +600,11 @@ void VALUE::Prints(PGLOBAL g, char *ps, uint z) template <class TYPE> TYPVAL<TYPE>::TYPVAL(TYPE n, int type, int prec, bool un) : VALUE(type, un) - { +{ Tval = n; Clen = sizeof(TYPE); Prec = prec; - } // end of TYPVAL constructor +} // end of TYPVAL constructor /***********************************************************************/ /* Return unsigned max value for the type. */ @@ -641,19 +641,19 @@ ulonglong TYPVAL<ulonglong>::MaxVal(void) {return ULONGLONG_MAX;} /***********************************************************************/ template <class TYPE> int TYPVAL<TYPE>::GetValLen(void) - { +{ char c[32]; - return sprintf(c, Fmt, Tval); - } // end of GetValLen + return snprintf(c, 32, Fmt, Tval); +} // end of GetValLen template <> int TYPVAL<double>::GetValLen(void) - { +{ char c[32]; - return sprintf(c, Fmt, Prec, Tval); - } // end of GetValLen + return snprintf(c, 32, Fmt, Prec, Tval); +} // end of GetValLen /***********************************************************************/ /* TYPVAL SetValue: copy the value of another Value object. */ @@ -661,7 +661,7 @@ int TYPVAL<double>::GetValLen(void) /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype) - { +{ if (valp != this) { if (chktype && Type != valp->GetType()) return true; @@ -671,10 +671,10 @@ bool TYPVAL<TYPE>::SetValue_pval(PVAL valp, bool chktype) else Reset(); - } // endif valp + } // endif valp return false; - } // end of SetValue +} // end of SetValue template <> short TYPVAL<short>::GetTypedValue(PVAL valp) @@ -717,7 +717,7 @@ uchar TYPVAL<uchar>::GetTypedValue(PVAL valp) /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::SetValue_char(const char *p, int n) - { +{ bool rc, minus; ulonglong maxval = MaxVal(); ulonglong val = CharToNumber(p, n, maxval, Unsigned, &minus, &rc); @@ -731,15 +731,15 @@ bool TYPVAL<TYPE>::SetValue_char(const char *p, int n) char buf[64]; htrc(strcat(strcat(strcpy(buf, " setting %s to: "), Fmt), "\n"), GetTypeName(Type), Tval); - } // endif trace + } // endif trace Null = false; return rc; - } // end of SetValue +} // end of SetValue template <> bool TYPVAL<double>::SetValue_char(const char *p, int n) - { +{ if (p && n > 0) { char buf[64]; @@ -760,14 +760,14 @@ bool TYPVAL<double>::SetValue_char(const char *p, int n) } // endif p return false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* TYPVAL SetValue: fill a typed value from a string. */ /***********************************************************************/ template <class TYPE> void TYPVAL<TYPE>::SetValue_psz(PCSZ s) - { +{ if (s) { SetValue_char(s, (int)strlen(s)); Null = false; @@ -776,17 +776,17 @@ void TYPVAL<TYPE>::SetValue_psz(PCSZ s) Null = Nullable; } // endif p - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* TYPVAL SetValue: set value with a TYPE extracted from a block. */ /***********************************************************************/ template <class TYPE> void TYPVAL<TYPE>::SetValue_pvblk(PVBLK blk, int n) - { +{ Tval = GetTypedValue(blk, n); Null = false; - } // end of SetValue +} // end of SetValue template <> int TYPVAL<int>::GetTypedValue(PVBLK blk, int n) @@ -852,7 +852,7 @@ void TYPVAL<TYPE>::SetBinValue(void *p) /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go) - { +{ // Test on length was removed here until a variable in column give the // real field length. For BIN files the field length logically cannot // be different from the variable length because no conversion is done. @@ -876,40 +876,41 @@ bool TYPVAL<TYPE>::GetBinValue(void *buf, int buflen, bool go) Null = false; return false; - } // end of GetBinValue +} // end of GetBinValue /***********************************************************************/ /* TYPVAL ShowValue: get string representation of a typed value. */ /***********************************************************************/ template <class TYPE> int TYPVAL<TYPE>::ShowValue(char *buf, int len) - { +{ return snprintf(buf, len + 1, Xfmt, len, Tval); - } // end of ShowValue +} // end of ShowValue template <> int TYPVAL<double>::ShowValue(char *buf, int len) - { +{ // TODO: use a more appropriate format to avoid possible truncation return snprintf(buf, len + 1, Xfmt, len, Prec, Tval); - } // end of ShowValue +} // end of ShowValue /***********************************************************************/ /* TYPVAL GetCharString: get string representation of a typed value. */ /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetCharString(char *p) - { +{ sprintf(p, Fmt, Tval); return p; - } // end of GetCharString +} // end of GetCharString template <> char *TYPVAL<double>::GetCharString(char *p) - { - sprintf(p, Fmt, Prec, Tval); +{ + // Most callers use a 32 long buffer + snprintf(p, 32, Fmt, Prec, Tval); return p; - } // end of GetCharString +} // end of GetCharString #if 0 /***********************************************************************/ @@ -917,50 +918,50 @@ char *TYPVAL<double>::GetCharString(char *p) /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetShortString(char *p, int n) - { +{ sprintf(p, "%*hd", n, (short)Tval); return p; - } // end of GetShortString +} // end of GetShortString /***********************************************************************/ /* TYPVAL GetIntString: get int representation of a typed value. */ /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetIntString(char *p, int n) - { +{ sprintf(p, "%*d", n, (int)Tval); return p; - } // end of GetIntString +} // end of GetIntString /***********************************************************************/ /* TYPVAL GetBigintString: get big int representation of a TYPE value.*/ /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetBigintString(char *p, int n) - { +{ sprintf(p, "%*lld", n, (longlong)Tval); return p; - } // end of GetBigintString +} // end of GetBigintString /***********************************************************************/ /* TYPVAL GetFloatString: get double representation of a typed value. */ /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetFloatString(char *p, int n, int prec) - { +{ sprintf(p, "%*.*lf", n, (prec < 0) ? 2 : prec, (double)Tval); return p; - } // end of GetFloatString +} // end of GetFloatString /***********************************************************************/ /* TYPVAL GetTinyString: get char representation of a typed value. */ /***********************************************************************/ template <class TYPE> char *TYPVAL<TYPE>::GetTinyString(char *p, int n) - { +{ sprintf(p, "%*d", n, (int)(char)Tval); return p; - } // end of GetIntString +} // end of GetIntString #endif // 0 /***********************************************************************/ @@ -968,7 +969,7 @@ char *TYPVAL<TYPE>::GetTinyString(char *p, int n) /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype) - { +{ if (this == vp) return true; else if (chktype && Type != vp->GetType()) @@ -980,7 +981,7 @@ bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype) else return (Tval == GetTypedValue(vp)); - } // end of IsEqual +} // end of IsEqual /***********************************************************************/ /* Compare values and returns 1, 0 or -1 according to comparison. */ @@ -988,7 +989,7 @@ bool TYPVAL<TYPE>::IsEqual(PVAL vp, bool chktype) /***********************************************************************/ template <class TYPE> int TYPVAL<TYPE>::CompareValue(PVAL vp) - { +{ //assert(vp->GetType() == Type); // Process filtering on numeric values. @@ -998,7 +999,7 @@ int TYPVAL<TYPE>::CompareValue(PVAL vp) // htrc(" Comparing: val=%d,%d\n", Tval, n); return (Tval > n) ? 1 : (Tval < n) ? (-1) : 0; - } // end of CompareValue +} // end of CompareValue /***********************************************************************/ /* Return max type value if b is true, else min type value. */ @@ -1044,7 +1045,7 @@ uchar TYPVAL<uchar>::MinMaxVal(bool b) /***********************************************************************/ template <class TYPE> TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2) - { +{ PGLOBAL& g = Global; TYPE n = n1 + n2; @@ -1059,20 +1060,20 @@ TYPE TYPVAL<TYPE>::SafeAdd(TYPE n1, TYPE n2) } // endif's n2 return n; - } // end of SafeAdd +} // end of SafeAdd template <> inline double TYPVAL<double>::SafeAdd(double n1, double n2) - { +{ return n1 + n2; - } // end of SafeAdd +} // end of SafeAdd /***********************************************************************/ /* SafeMult: multiply values and test whether overflow occurred. */ /***********************************************************************/ template <class TYPE> TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2) - { +{ PGLOBAL& g = Global; double n = (double)n1 * (double)n2; @@ -1087,20 +1088,20 @@ TYPE TYPVAL<TYPE>::SafeMult(TYPE n1, TYPE n2) } // endif's n2 return (TYPE)n; - } // end of SafeMult +} // end of SafeMult template <> inline double TYPVAL<double>::SafeMult(double n1, double n2) - { +{ return n1 * n2; - } // end of SafeMult +} // end of SafeMult /***********************************************************************/ /* Compute defined functions for the type. */ /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) - { +{ bool rc = false; TYPE val[2]; @@ -1127,14 +1128,14 @@ bool TYPVAL<TYPE>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) default: rc = Compall(g, vp, np, op); break; - } // endswitch op + } // endswitch op return rc; - } // end of Compute +} // end of Compute template <> bool TYPVAL<double>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) - { +{ bool rc = false; double val[2]; @@ -1152,17 +1153,17 @@ bool TYPVAL<double>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) break; default: rc = Compall(g, vp, np, op); - } // endswitch op + } // endswitch op return rc; - } // end of Compute +} // end of Compute /***********************************************************************/ /* Compute a function for all types. */ /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op) - { +{ TYPE val[2]; for (int i = 0; i < np; i++) @@ -1191,10 +1192,10 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op) // sprintf(g->Message, MSG(BAD_EXP_OPER), op); strcpy(g->Message, "Function not supported"); return true; - } // endswitch op + } // endswitch op return false; - } // end of Compall +} // end of Compall /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ @@ -1203,26 +1204,28 @@ bool TYPVAL<TYPE>::Compall(PGLOBAL g, PVAL *vp, int np, OPVAL op) /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::FormatValue(PVAL vp, PCSZ fmt) - { - char *buf = (char*)vp->GetTo_Val(); // Should be big enough +{ + // This function is wrong and should never be called + assert(false); + char *buf = (char*)vp->GetTo_Val(); // Not big enough int n = sprintf(buf, fmt, Tval); return (n > vp->GetValLen()); - } // end of FormatValue +} // end of FormatValue /***********************************************************************/ /* TYPVAL SetFormat function (used to set SELECT output format). */ /***********************************************************************/ template <class TYPE> bool TYPVAL<TYPE>::SetConstFormat(PGLOBAL g, FORMAT& fmt) - { +{ char c[32]; fmt.Type[0] = *GetFormatType(Type); fmt.Length = sprintf(c, Fmt, Tval); fmt.Prec = Prec; return false; - } // end of SetConstFormat +} // end of SetConstFormat /* -------------------------- Class STRING --------------------------- */ @@ -1230,19 +1233,19 @@ bool TYPVAL<TYPE>::SetConstFormat(PGLOBAL g, FORMAT& fmt) /* STRING public constructor from a constant string. */ /***********************************************************************/ TYPVAL<PSZ>::TYPVAL(PSZ s, short c) : VALUE(TYPE_STRING) - { +{ Strp = s; Len = strlen(s); Clen = Len; Ci = (c == 1); - } // end of STRING constructor +} // end of STRING constructor /***********************************************************************/ /* STRING public constructor from char. */ /***********************************************************************/ TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c) : VALUE(TYPE_STRING) - { +{ Len = (g) ? n : (s) ? strlen(s) : 0; if (!s) { @@ -1260,89 +1263,89 @@ TYPVAL<PSZ>::TYPVAL(PGLOBAL g, PSZ s, int n, int c) Clen = Len; Ci = (c != 0); - } // end of STRING constructor +} // end of STRING constructor /***********************************************************************/ /* Get the tiny value represented by the Strp string. */ /***********************************************************************/ char TYPVAL<PSZ>::GetTinyValue(void) - { +{ bool m; ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX8, false, &m); return (m && val < INT_MAX8) ? (char)(-(signed)val) : (char)val; - } // end of GetTinyValue +} // end of GetTinyValue /***********************************************************************/ /* Get the unsigned tiny value represented by the Strp string. */ /***********************************************************************/ uchar TYPVAL<PSZ>::GetUTinyValue(void) - { +{ return (uchar)CharToNumber(Strp, strlen(Strp), UINT_MAX8, true); - } // end of GetUTinyValue +} // end of GetUTinyValue /***********************************************************************/ /* Get the short value represented by the Strp string. */ /***********************************************************************/ short TYPVAL<PSZ>::GetShortValue(void) - { +{ bool m; ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX16, false, &m); return (m && val < INT_MAX16) ? (short)(-(signed)val) : (short)val; - } // end of GetShortValue +} // end of GetShortValue /***********************************************************************/ /* Get the unsigned short value represented by the Strp string. */ /***********************************************************************/ ushort TYPVAL<PSZ>::GetUShortValue(void) - { +{ return (ushort)CharToNumber(Strp, strlen(Strp), UINT_MAX16, true); - } // end of GetUshortValue +} // end of GetUshortValue /***********************************************************************/ /* Get the integer value represented by the Strp string. */ /***********************************************************************/ int TYPVAL<PSZ>::GetIntValue(void) - { +{ bool m; ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX32, false, &m); return (m && val < INT_MAX32) ? (int)(-(signed)val) : (int)val; - } // end of GetIntValue +} // end of GetIntValue /***********************************************************************/ /* Get the unsigned integer value represented by the Strp string. */ /***********************************************************************/ uint TYPVAL<PSZ>::GetUIntValue(void) - { +{ return (uint)CharToNumber(Strp, strlen(Strp), UINT_MAX32, true); - } // end of GetUintValue +} // end of GetUintValue /***********************************************************************/ /* Get the big integer value represented by the Strp string. */ /***********************************************************************/ longlong TYPVAL<PSZ>::GetBigintValue(void) - { +{ bool m; ulonglong val = CharToNumber(Strp, strlen(Strp), INT_MAX64, false, &m); return (m && val < INT_MAX64) ? (-(signed)val) : (longlong)val; - } // end of GetBigintValue +} // end of GetBigintValue /***********************************************************************/ /* Get the unsigned big integer value represented by the Strp string. */ /***********************************************************************/ ulonglong TYPVAL<PSZ>::GetUBigintValue(void) - { +{ return CharToNumber(Strp, strlen(Strp), ULONGLONG_MAX, true); - } // end of GetUBigintValue +} // end of GetUBigintValue /***********************************************************************/ /* STRING SetValue: copy the value of another Value object. */ /***********************************************************************/ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype) - { +{ if (valp != this) { if (chktype && (valp->GetType() != Type || valp->GetSize() > Len)) return true; @@ -1354,16 +1357,16 @@ bool TYPVAL<PSZ>::SetValue_pval(PVAL valp, bool chktype) else Reset(); - } // endif valp + } // endif valp return false; - } // end of SetValue_pval +} // end of SetValue_pval /***********************************************************************/ /* STRING SetValue: fill string with chars extracted from a line. */ /***********************************************************************/ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n) - { +{ bool rc = false; if (!cp || n == 0) { @@ -1389,16 +1392,16 @@ bool TYPVAL<PSZ>::SetValue_char(const char *cp, int n) Reset(); Null = false; - } // endif p + } // endif cp return rc; - } // end of SetValue_char +} // end of SetValue_char /***********************************************************************/ /* STRING SetValue: fill string with another string. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue_psz(PCSZ s) - { +{ if (!s) { Reset(); Null = Nullable; @@ -1407,26 +1410,26 @@ void TYPVAL<PSZ>::SetValue_psz(PCSZ s) Null = false; } // endif s - } // end of SetValue_psz +} // end of SetValue_psz /***********************************************************************/ /* STRING SetValue: fill string with a string extracted from a block. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue_pvblk(PVBLK blk, int n) - { +{ // STRBLK's can return a NULL pointer PSZ vp = blk->GetCharString(Strp, n); if (vp != Strp) SetValue_psz(vp); - } // end of SetValue_pvblk +} // end of SetValue_pvblk /***********************************************************************/ /* STRING SetValue: get the character representation of an integer. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(int n) - { +{ char buf[16]; PGLOBAL& g = Global; int k = sprintf(buf, "%d", n); @@ -1438,13 +1441,13 @@ void TYPVAL<PSZ>::SetValue(int n) SetValue_psz(buf); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of an uint. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(uint n) - { +{ char buf[16]; PGLOBAL& g = Global; int k = sprintf(buf, "%u", n); @@ -1456,31 +1459,31 @@ void TYPVAL<PSZ>::SetValue(uint n) SetValue_psz(buf); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a short int. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(short i) - { +{ SetValue((int)i); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a ushort int. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(ushort i) - { +{ SetValue((uint)i); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a big integer.*/ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(longlong n) - { +{ char buf[24]; PGLOBAL& g = Global; int k = sprintf(buf, "%lld", n); @@ -1492,13 +1495,13 @@ void TYPVAL<PSZ>::SetValue(longlong n) SetValue_psz(buf); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a big integer.*/ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(ulonglong n) - { +{ char buf[24]; PGLOBAL& g = Global; int k = sprintf(buf, "%llu", n); @@ -1510,13 +1513,13 @@ void TYPVAL<PSZ>::SetValue(ulonglong n) SetValue_psz(buf); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a double. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(double f) - { +{ char *p, buf[64]; PGLOBAL& g = Global; int k = sprintf(buf, "%lf", f); @@ -1535,33 +1538,33 @@ void TYPVAL<PSZ>::SetValue(double f) SetValue_psz(buf); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a tiny int. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(char c) - { +{ SetValue((int)c); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetValue: get the character representation of a tiny int. */ /***********************************************************************/ void TYPVAL<PSZ>::SetValue(uchar c) - { +{ SetValue((uint)c); Null = false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* STRING SetBinValue: fill string with chars extracted from a line. */ /***********************************************************************/ void TYPVAL<PSZ>::SetBinValue(void *p) - { +{ SetValue_char((const char *)p, Len); - } // end of SetBinValue +} // end of SetBinValue /***********************************************************************/ /* GetBinValue: fill a buffer with the internal binary value. */ @@ -1570,7 +1573,7 @@ void TYPVAL<PSZ>::SetBinValue(void *p) /* Currently used by WriteColumn of binary files. */ /***********************************************************************/ bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go) - { +{ int len = (Null) ? 0 : strlen(Strp); if (len > buflen) @@ -1581,7 +1584,7 @@ bool TYPVAL<PSZ>::GetBinValue(void *buf, int buflen, bool go) } // endif go return false; - } // end of GetBinValue +} // end of GetBinValue /***********************************************************************/ /* STRING ShowValue: get string representation of a char value. */ @@ -1591,7 +1594,7 @@ int TYPVAL<PSZ>::ShowValue(char *buf, int buflen) int len = (Null) ? 0 : strlen(Strp); if (buf && buf != Strp) { - memset(buf, ' ', buflen + 1); + memset(buf, ' ', (size_t)buflen + 1); memcpy(buf, Strp, MY_MIN(len, buflen)); } // endif buf @@ -1602,15 +1605,15 @@ int TYPVAL<PSZ>::ShowValue(char *buf, int buflen) /* STRING GetCharString: get string representation of a char value. */ /***********************************************************************/ char *TYPVAL<PSZ>::GetCharString(char *) - { +{ return Strp; - } // end of GetCharString +} // end of GetCharString /***********************************************************************/ /* STRING compare value with another Value. */ /***********************************************************************/ bool TYPVAL<PSZ>::IsEqual(PVAL vp, bool chktype) - { +{ if (this == vp) return true; else if (chktype && Type != vp->GetType()) @@ -1625,14 +1628,14 @@ bool TYPVAL<PSZ>::IsEqual(PVAL vp, bool chktype) else // (!Ci) return !strcmp(Strp, vp->GetCharString(buf)); - } // end of IsEqual +} // end of IsEqual /***********************************************************************/ /* Compare values and returns 1, 0 or -1 according to comparison. */ /* This function is used for evaluation of numeric filters. */ /***********************************************************************/ int TYPVAL<PSZ>::CompareValue(PVAL vp) - { +{ int n; //assert(vp->GetType() == Type); @@ -1651,13 +1654,13 @@ int TYPVAL<PSZ>::CompareValue(PVAL vp) #endif // __WIN__ return (n > 0) ? 1 : (n < 0) ? -1 : 0; - } // end of CompareValue +} // end of CompareValue /***********************************************************************/ /* Compute a function on a string. */ /***********************************************************************/ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) - { +{ char *p[2], val[2][32]; int i; @@ -1704,7 +1707,7 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) Null = false; return false; - } // end of Compute +} // end of Compute /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ @@ -1712,23 +1715,23 @@ bool TYPVAL<PSZ>::Compute(PGLOBAL g, PVAL *vp, int np, OPVAL op) /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool TYPVAL<PSZ>::FormatValue(PVAL vp, PCSZ fmt) - { +{ char *buf = (char*)vp->GetTo_Val(); // Should be big enough int n = sprintf(buf, fmt, Strp); return (n > vp->GetValLen()); - } // end of FormatValue +} // end of FormatValue /***********************************************************************/ /* STRING SetFormat function (used to set SELECT output format). */ /***********************************************************************/ bool TYPVAL<PSZ>::SetConstFormat(PGLOBAL, FORMAT& fmt) - { +{ fmt.Type[0] = 'C'; fmt.Length = Len; fmt.Prec = 0; return false; - } // end of SetConstFormat +} // end of SetConstFormat /***********************************************************************/ /* Make string output of an object value. */ @@ -1748,38 +1751,38 @@ void TYPVAL<PSZ>::Prints(PGLOBAL g, char *ps, uint z) /* DECIMAL public constructor from a constant string. */ /***********************************************************************/ DECVAL::DECVAL(PSZ s) : TYPVAL<PSZ>(s) - { +{ if (s) { char *p = strchr(Strp, '.'); Prec = (p) ? (int)(Len - (p - Strp)) : 0; - } // endif s + } // endif s Type = TYPE_DECIM; - } // end of DECVAL constructor +} // end of DECVAL constructor /***********************************************************************/ /* DECIMAL public constructor from char. */ /***********************************************************************/ DECVAL::DECVAL(PGLOBAL g, PSZ s, int n, int prec, bool uns) : TYPVAL<PSZ>(g, s, n + (prec ? 1 : 0) + (uns ? 0 : 1), 0) - { +{ Prec = prec; Unsigned = uns; Type = TYPE_DECIM; - } // end of DECVAL constructor +} // end of DECVAL constructor /***********************************************************************/ /* DECIMAL: Check whether the numerica value is equal to 0. */ /***********************************************************************/ bool DECVAL::IsZero(void) - { +{ for (int i = 0; Strp[i]; i++) if (!strchr("0 +-.", Strp[i])) return false; return true; - } // end of IsZero +} // end of IsZero /***********************************************************************/ /* DECIMAL: Reset value to zero. */ @@ -1797,7 +1800,7 @@ void DECVAL::Reset(void) Strp[i++] = '0'; } while (i < Prec + 2); - } // endif Prec + } // endif Prec Strp[i] = 0; } // end of Reset @@ -1806,9 +1809,9 @@ void DECVAL::Reset(void) /* DECIMAL ShowValue: get string representation right justified. */ /***********************************************************************/ int DECVAL::ShowValue(char *buf, int len) - { +{ return snprintf(buf, len + 1, Xfmt, len, Strp); - } // end of ShowValue +} // end of ShowValue /***********************************************************************/ /* GetBinValue: fill a buffer with the internal binary value. */ @@ -1817,7 +1820,7 @@ int DECVAL::ShowValue(char *buf, int len) /* Currently used by WriteColumn of binary files. */ /***********************************************************************/ bool DECVAL::GetBinValue(void *buf, int buflen, bool go) - { +{ int len = (Null) ? 0 : strlen(Strp); if (len > buflen) @@ -1825,16 +1828,16 @@ bool DECVAL::GetBinValue(void *buf, int buflen, bool go) else if (go) { memset(buf, ' ', buflen - len); memcpy((char*)buf + buflen - len, Strp, len); - } // endif go + } // endif go return false; - } // end of GetBinValue +} // end of GetBinValue /***********************************************************************/ /* DECIMAL compare value with another Value. */ /***********************************************************************/ bool DECVAL::IsEqual(PVAL vp, bool chktype) - { +{ if (this == vp) return true; else if (chktype && Type != vp->GetType()) @@ -1845,14 +1848,14 @@ bool DECVAL::IsEqual(PVAL vp, bool chktype) char buf[64]; return !strcmp(Strp, vp->GetCharString(buf)); - } // end of IsEqual +} // end of IsEqual /***********************************************************************/ /* Compare values and returns 1, 0 or -1 according to comparison. */ /* This function is used for evaluation of numeric filters. */ /***********************************************************************/ int DECVAL::CompareValue(PVAL vp) - { +{ //assert(vp->GetType() == Type); // Process filtering on numeric values. @@ -1862,7 +1865,7 @@ int DECVAL::CompareValue(PVAL vp) // htrc(" Comparing: val=%d,%d\n", f, n); return (f > n) ? 1 : (f < n) ? (-1) : 0; - } // end of CompareValue +} // end of CompareValue /* -------------------------- Class BINVAL --------------------------- */ @@ -1870,7 +1873,7 @@ int DECVAL::CompareValue(PVAL vp) /* BINVAL public constructor from bytes. */ /***********************************************************************/ BINVAL::BINVAL(PGLOBAL g, void *p, int cl, int n) : VALUE(TYPE_BIN) - { +{ assert(g); Len = n; Clen = cl; @@ -1881,19 +1884,19 @@ BINVAL::BINVAL(PGLOBAL g, void *p, int cl, int n) : VALUE(TYPE_BIN) memcpy(Binp, p, MY_MIN(Len,Clen)); Chrp = NULL; - } // end of BINVAL constructor +} // end of BINVAL constructor /***********************************************************************/ /* BINVAL: Check whether the hexadecimal value is equal to 0. */ /***********************************************************************/ bool BINVAL::IsZero(void) - { +{ for (int i = 0; i < Len; i++) if (((char*)Binp)[i] != 0) return false; return true; - } // end of IsZero +} // end of IsZero /***********************************************************************/ /* BINVAL: Reset value to zero. */ @@ -1908,77 +1911,77 @@ void BINVAL::Reset(void) /* Get the tiny value pointed by Binp. */ /***********************************************************************/ char BINVAL::GetTinyValue(void) - { +{ return *(char*)Binp; - } // end of GetTinyValue +} // end of GetTinyValue /***********************************************************************/ /* Get the unsigned tiny value pointed by Binp. */ /***********************************************************************/ uchar BINVAL::GetUTinyValue(void) - { +{ return *(uchar*)Binp; - } // end of GetUTinyValue +} // end of GetUTinyValue /***********************************************************************/ /* Get the short value pointed by Binp. */ /***********************************************************************/ short BINVAL::GetShortValue(void) - { +{ if (Len >= 2) return *(short*)Binp; else return (short)GetTinyValue(); - } // end of GetShortValue +} // end of GetShortValue /***********************************************************************/ /* Get the unsigned short value pointed by Binp. */ /***********************************************************************/ ushort BINVAL::GetUShortValue(void) - { +{ return (ushort)GetShortValue(); - } // end of GetUshortValue +} // end of GetUshortValue /***********************************************************************/ /* Get the integer value pointed by Binp. */ /***********************************************************************/ int BINVAL::GetIntValue(void) - { +{ if (Len >= 4) return *(int*)Binp; else return (int)GetShortValue(); - } // end of GetIntValue +} // end of GetIntValue /***********************************************************************/ /* Get the unsigned integer value pointed by Binp. */ /***********************************************************************/ uint BINVAL::GetUIntValue(void) - { +{ return (uint)GetIntValue(); - } // end of GetUintValue +} // end of GetUintValue /***********************************************************************/ /* Get the big integer value pointed by Binp. */ /***********************************************************************/ longlong BINVAL::GetBigintValue(void) - { +{ if (Len >= 8) return *(longlong*)Binp; else return (longlong)GetIntValue(); - } // end of GetBigintValue +} // end of GetBigintValue /***********************************************************************/ /* Get the unsigned big integer value pointed by Binp. */ /***********************************************************************/ ulonglong BINVAL::GetUBigintValue(void) - { +{ return (ulonglong)GetBigintValue(); - } // end of GetUBigintValue +} // end of GetUBigintValue /***********************************************************************/ /* Get the double value pointed by Binp. */ @@ -1998,7 +2001,7 @@ double BINVAL::GetFloatValue(void) /* BINVAL SetValue: copy the value of another Value object. */ /***********************************************************************/ bool BINVAL::SetValue_pval(PVAL valp, bool chktype) - { +{ bool rc = false; if (valp != this) { @@ -2018,16 +2021,16 @@ bool BINVAL::SetValue_pval(PVAL valp, bool chktype) } else Reset(); - } // endif valp + } // endif valp return rc; - } // end of SetValue_pval +} // end of SetValue_pval /***********************************************************************/ /* BINVAL SetValue: fill value with chars extracted from a line. */ /***********************************************************************/ bool BINVAL::SetValue_char(const char *p, int n) - { +{ bool rc; if (p && n > 0) { @@ -2047,13 +2050,13 @@ bool BINVAL::SetValue_char(const char *p, int n) } // endif p return rc; - } // end of SetValue_char +} // end of SetValue_char /***********************************************************************/ /* BINVAL SetValue: fill value with another string. */ /***********************************************************************/ void BINVAL::SetValue_psz(PCSZ s) - { +{ if (s) { int len = Len; @@ -2068,13 +2071,13 @@ void BINVAL::SetValue_psz(PCSZ s) Null = Nullable; } // endif s - } // end of SetValue_psz +} // end of SetValue_psz /***********************************************************************/ /* BINVAL SetValue: fill value with bytes extracted from a block. */ /***********************************************************************/ void BINVAL::SetValue_pvblk(PVBLK blk, int n) - { +{ // STRBLK's can return a NULL pointer void *vp = blk->GetValPtrEx(n); @@ -2097,13 +2100,13 @@ void BINVAL::SetValue_pvblk(PVBLK blk, int n) Null = false; } // endif vp - } // end of SetValue_pvblk +} // end of SetValue_pvblk /***********************************************************************/ /* BINVAL SetValue: get the binary representation of an integer. */ /***********************************************************************/ void BINVAL::SetValue(int n) - { +{ if (Clen >= 4) { if (Len > 4) memset(Binp, 0, Len); @@ -2113,13 +2116,13 @@ void BINVAL::SetValue(int n) } else SetValue((short)n); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of an uint. */ /***********************************************************************/ void BINVAL::SetValue(uint n) - { +{ if (Clen >= 4) { if (Len > 4) memset(Binp, 0, Len); @@ -2129,13 +2132,13 @@ void BINVAL::SetValue(uint n) } else SetValue((ushort)n); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a short int. */ /***********************************************************************/ void BINVAL::SetValue(short i) - { +{ if (Clen >= 2) { if (Len > 2) memset(Binp, 0, Len); @@ -2145,13 +2148,13 @@ void BINVAL::SetValue(short i) } else SetValue((char)i); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a ushort int. */ /***********************************************************************/ void BINVAL::SetValue(ushort i) - { +{ if (Clen >= 2) { if (Len > 2) memset(Binp, 0, Len); @@ -2161,13 +2164,13 @@ void BINVAL::SetValue(ushort i) } else SetValue((uchar)i); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a big integer. */ /***********************************************************************/ void BINVAL::SetValue(longlong n) - { +{ if (Clen >= 8) { if (Len > 8) memset(Binp, 0, Len); @@ -2177,13 +2180,13 @@ void BINVAL::SetValue(longlong n) } else SetValue((int)n); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a big integer. */ /***********************************************************************/ void BINVAL::SetValue(ulonglong n) - { +{ if (Clen >= 8) { if (Len > 8) memset(Binp, 0, Len); @@ -2192,13 +2195,14 @@ void BINVAL::SetValue(ulonglong n) Len = 8; } else SetValue((uint)n); - } // end of SetValue + +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a double. */ /***********************************************************************/ void BINVAL::SetValue(double n) - { +{ if (Len > 8) memset(Binp, 0, Len); @@ -2211,40 +2215,40 @@ void BINVAL::SetValue(double n) } else Len = 0; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the character binary of a tiny int. */ /***********************************************************************/ void BINVAL::SetValue(char c) - { +{ if (Len > 1) memset(Binp, 0, Len); *((char*)Binp) = c; Len = 1; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetValue: get the binary representation of a tiny int. */ /***********************************************************************/ void BINVAL::SetValue(uchar c) - { +{ if (Len > 1) memset(Binp, 0, Len); *((uchar*)Binp) = c; Len = 1; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* BINVAL SetBinValue: fill string with bytes extracted from a line. */ /***********************************************************************/ void BINVAL::SetBinValue(void *p) - { +{ memcpy(Binp, p, Clen); Len = Clen; - } // end of SetBinValue +} // end of SetBinValue /***********************************************************************/ /* GetBinValue: fill a buffer with the internal binary value. */ @@ -2253,7 +2257,7 @@ void BINVAL::SetBinValue(void *p) /* Currently used by WriteColumn of binary files. */ /***********************************************************************/ bool BINVAL::GetBinValue(void *buf, int buflen, bool go) - { +{ if (Len > buflen) return true; else if (go) { @@ -2262,7 +2266,7 @@ bool BINVAL::GetBinValue(void *buf, int buflen, bool go) } // endif go return false; - } // end of GetBinValue +} // end of GetBinValue /***********************************************************************/ /* BINVAL ShowValue: get string representation of a binary value. */ @@ -2278,19 +2282,19 @@ int BINVAL::ShowValue(char *buf, int len) /* BINVAL GetCharString: get string representation of a binary value. */ /***********************************************************************/ char *BINVAL::GetCharString(char *) - { +{ if (!Chrp) Chrp = (char*)PlugSubAlloc(Global, NULL, Clen * 2 + 1); sprintf(Chrp, GetXfmt(), Len, Binp); return Chrp; - } // end of GetCharString +} // end of GetCharString /***********************************************************************/ /* BINVAL compare value with another Value. */ /***********************************************************************/ bool BINVAL::IsEqual(PVAL vp, bool chktype) - { +{ if (this == vp) return true; else if (chktype && Type != vp->GetType()) @@ -2308,7 +2312,7 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype) return false; return true; - } // end of IsEqual +} // end of IsEqual /***********************************************************************/ /* FormatValue: This function set vp (a STRING value) to the string */ @@ -2316,23 +2320,23 @@ bool BINVAL::IsEqual(PVAL vp, bool chktype) /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool BINVAL::FormatValue(PVAL vp, PCSZ fmt) - { +{ char *buf = (char*)vp->GetTo_Val(); // Should be big enough int n = sprintf(buf, fmt, Len, Binp); return (n > vp->GetValLen()); - } // end of FormatValue +} // end of FormatValue /***********************************************************************/ /* BINVAL SetFormat function (used to set SELECT output format). */ /***********************************************************************/ bool BINVAL::SetConstFormat(PGLOBAL, FORMAT& fmt) - { +{ fmt.Type[0] = 'B'; fmt.Length = Clen; fmt.Prec = 0; return false; - } // end of SetConstFormat +} // end of SetConstFormat /* -------------------------- Class DTVAL ---------------------------- */ @@ -2341,7 +2345,7 @@ bool BINVAL::SetConstFormat(PGLOBAL, FORMAT& fmt) /***********************************************************************/ DTVAL::DTVAL(PGLOBAL g, int n, int prec, PCSZ fmt) : TYPVAL<int>((int)0, TYPE_DATE) - { +{ if (!fmt) { Pdtp = NULL; Sdate = NULL; @@ -2351,37 +2355,37 @@ DTVAL::DTVAL(PGLOBAL g, int n, int prec, PCSZ fmt) SetFormat(g, fmt, n, prec); //Type = TYPE_DATE; - } // end of DTVAL constructor +} // end of DTVAL constructor /***********************************************************************/ /* DTVAL public constructor from int. */ /***********************************************************************/ DTVAL::DTVAL(int n) : TYPVAL<int>(n, TYPE_DATE) - { +{ Pdtp = NULL; Len = 19; //Type = TYPE_DATE; Sdate = NULL; DefYear = 0; - } // end of DTVAL constructor +} // end of DTVAL constructor /***********************************************************************/ /* Set format so formatted dates can be converted on input/output. */ /***********************************************************************/ bool DTVAL::SetFormat(PGLOBAL g, PCSZ fmt, int len, int year) - { +{ Pdtp = MakeDateFormat(g, fmt, true, true, (year > 9999) ? 1 : 0); Sdate = (char*)PlugSubAlloc(g, NULL, len + 1); DefYear = (int)((year > 9999) ? (year - 10000) : year); Len = len; return false; - } // end of SetFormat +} // end of SetFormat /***********************************************************************/ /* Set format from the format of another date value. */ /***********************************************************************/ bool DTVAL::SetFormat(PGLOBAL g, PVAL valp) - { +{ DTVAL *vp; if (valp->GetType() != TYPE_DATE) { @@ -2395,14 +2399,14 @@ bool DTVAL::SetFormat(PGLOBAL g, PVAL valp) Sdate = (char*)PlugSubAlloc(g, NULL, Len + 1); DefYear = vp->DefYear; return false; - } // end of SetFormat +} // end of SetFormat /***********************************************************************/ /* We need TimeShift because the mktime C function does a correction */ /* for local time zone that we want to override for DB operations. */ /***********************************************************************/ void DTVAL::SetTimeShift(void) - { +{ struct tm dtm; memset(&dtm, 0, sizeof(dtm)); dtm.tm_mday=2; @@ -2414,7 +2418,7 @@ void DTVAL::SetTimeShift(void) if (trace(1)) htrc("DTVAL Shift=%d\n", Shift); - } // end of SetTimeShift +} // end of SetTimeShift // Added by Alexander Barkov static void TIME_to_localtime(struct tm *tm, const MYSQL_TIME *ltime) @@ -2444,7 +2448,7 @@ static struct tm *gmtime_mysql(const time_t *timep, struct tm *tm) /* extend the range of valid dates by accepting negative time values. */ /***********************************************************************/ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer) - { +{ struct tm *datm; time_t t = (time_t)Tval; @@ -2463,7 +2467,7 @@ struct tm *DTVAL::GetGmTime(struct tm *tm_buffer) datm = gmtime_mysql(&t, tm_buffer); return datm; - } // end of GetGmTime +} // end of GetGmTime // Added by Alexander Barkov static time_t mktime_mysql(struct tm *ptm) @@ -2482,7 +2486,7 @@ static time_t mktime_mysql(struct tm *ptm) /* range of valid dates by accepting to set negative time values. */ /***********************************************************************/ bool DTVAL::MakeTime(struct tm *ptm) - { +{ int n, y = ptm->tm_year; time_t t = mktime_mysql(ptm); @@ -2498,7 +2502,7 @@ bool DTVAL::MakeTime(struct tm *ptm) for (n = 0; t == -1 && n < 20; n++) { ptm->tm_year += 4; t = mktime_mysql(ptm); - } // endfor t + } // endfor t if (t == -1) return true; @@ -2506,20 +2510,21 @@ bool DTVAL::MakeTime(struct tm *ptm) if ((t -= (n * FOURYEARS)) > 2000000000) return true; - } + } // endif t + Tval= (int) t; if (trace(2)) htrc("MakeTime Ival=%d\n", Tval); return false; - } // end of MakeTime +} // end of MakeTime /***********************************************************************/ /* Make a time_t datetime from its components (YY, MM, DD, hh, mm, ss) */ /***********************************************************************/ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval) - { +{ int i, m; int n; bool rc = false; @@ -2589,9 +2594,9 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval) case 3: datm.tm_hour = n; break; case 4: datm.tm_min = n; break; case 5: datm.tm_sec = n; break; - } // endswitch i + } // endswitch i - } // endfor i + } // endfor i if (trace(2)) htrc("MakeDate datm=(%d,%d,%d,%d,%d,%d)\n", @@ -2607,14 +2612,14 @@ bool DTVAL::MakeDate(PGLOBAL g, int *val, int nval) Tval = 0; return rc; - } // end of MakeDate +} // end of MakeDate /***********************************************************************/ /* DTVAL SetValue: copy the value of another Value object. */ /* This function allows conversion if chktype is false. */ /***********************************************************************/ bool DTVAL::SetValue_pval(PVAL valp, bool chktype) - { +{ if (valp != this) { if (chktype && Type != valp->GetType()) return true; @@ -2636,16 +2641,16 @@ bool DTVAL::SetValue_pval(PVAL valp, bool chktype) } else Reset(); - } // endif valp + } // endif valp return false; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* SetValue: convert chars extracted from a line to date value. */ /***********************************************************************/ bool DTVAL::SetValue_char(const char *p, int n) - { +{ bool rc= 0; if (Pdtp) { @@ -2661,7 +2666,7 @@ bool DTVAL::SetValue_char(const char *p, int n) n = Len; memcpy(Sdate, p, n); - } // endif n + } // endif n Sdate[n] = '\0'; @@ -2678,13 +2683,13 @@ bool DTVAL::SetValue_char(const char *p, int n) } // endif Pdtp return rc; - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* SetValue: convert a char string to date value. */ /***********************************************************************/ void DTVAL::SetValue_psz(PCSZ p) - { +{ if (Pdtp) { int ndv; int dval[6]; @@ -2704,13 +2709,13 @@ void DTVAL::SetValue_psz(PCSZ p) Null = (Nullable && Tval == 0); } // endif Pdtp - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* DTVAL SetValue: set value with a value extracted from a block. */ /***********************************************************************/ void DTVAL::SetValue_pvblk(PVBLK blk, int n) - { +{ if (Pdtp && !::IsTypeNum(blk->GetType())) { int ndv; int dval[6]; @@ -2720,13 +2725,13 @@ void DTVAL::SetValue_pvblk(PVBLK blk, int n) } else Tval = blk->GetIntValue(n); - } // end of SetValue +} // end of SetValue /***********************************************************************/ /* DTVAL GetCharString: get string representation of a date value. */ /***********************************************************************/ char *DTVAL::GetCharString(char *p) - { +{ if (Pdtp) { size_t n = 0; struct tm tm, *ptm= GetGmTime(&tm); @@ -2745,7 +2750,7 @@ char *DTVAL::GetCharString(char *p) //Null = false; ?????????????? return p; - } // end of GetCharString +} // end of GetCharString /***********************************************************************/ /* DTVAL ShowValue: get string representation of a date value. */ @@ -2783,7 +2788,7 @@ int DTVAL::ShowValue(char *buf, int len) /* Returns a member of the struct tm representation of the date. */ /***********************************************************************/ bool DTVAL::GetTmMember(OPVAL op, int& mval) - { +{ bool rc = false; struct tm tm, *ptm = GetGmTime(&tm); @@ -2796,10 +2801,10 @@ bool DTVAL::GetTmMember(OPVAL op, int& mval) case OP_QUART: mval = ptm->tm_mon / 3 + 1; break; default: rc = true; - } // endswitch op + } // endswitch op return rc; - } // end of GetTmMember +} // end of GetTmMember /***********************************************************************/ /* Calculates the week number of the year for the internal date value.*/ @@ -2810,7 +2815,7 @@ bool DTVAL::GetTmMember(OPVAL op, int& mval) /* the week that contains the January 4th. */ /***********************************************************************/ bool DTVAL::WeekNum(PGLOBAL g, int& nval) - { +{ // w is the start of the week SUN=0, MON=1, etc. int m, n, w = nval % 7; struct tm tm, *ptm = GetGmTime(&tm); @@ -2827,7 +2832,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval) // Everything should be Ok return false; - } // end of WeekNum +} // end of WeekNum #endif // 0 /***********************************************************************/ @@ -2836,7 +2841,7 @@ bool DTVAL::WeekNum(PGLOBAL g, int& nval) /* This function assumes that the format matches the value type. */ /***********************************************************************/ bool DTVAL::FormatValue(PVAL vp, PCSZ fmt) - { +{ char *buf = (char*)vp->GetTo_Val(); // Should be big enough struct tm tm, *ptm = GetGmTime(&tm); @@ -2853,6 +2858,6 @@ bool DTVAL::FormatValue(PVAL vp, PCSZ fmt) } else return true; - } // end of FormatValue +} // end of FormatValue /* -------------------------- End of Value --------------------------- */ diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 73857a14a2f..2ffe2da06b2 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -430,6 +430,10 @@ int ha_heap::reset_auto_increment(ulonglong value) int ha_heap::external_lock(THD *thd, int lock_type) { +#ifndef DBUG_OFF + if (lock_type == F_UNLCK && file->s->changed && heap_check_heap(file, 0)) + return HA_ERR_CRASHED; +#endif return 0; // No external locking } diff --git a/storage/heap/hp_close.c b/storage/heap/hp_close.c index 092048a7c1c..82d6186340a 100644 --- a/storage/heap/hp_close.c +++ b/storage/heap/hp_close.c @@ -35,12 +35,6 @@ int hp_close(register HP_INFO *info) { int error=0; DBUG_ENTER("hp_close"); -#ifndef DBUG_OFF - if (info->s->changed && heap_check_heap(info,0)) - { - error=my_errno=HA_ERR_CRASHED; - } -#endif info->s->changed=0; if (info->open_list.data) heap_open_list=list_delete(heap_open_list,&info->open_list); diff --git a/storage/innobase/.clang-format b/storage/innobase/.clang-format new file mode 100644 index 00000000000..54f7b47bc88 --- /dev/null +++ b/storage/innobase/.clang-format @@ -0,0 +1,11 @@ +UseTab: Always +TabWidth: 8 +IndentWidth: 8 +ContinuationIndentWidth: 8 +BreakBeforeBinaryOperators: All +PointerAlignment: Left +BreakBeforeBraces: Custom +ColumnLimit: 79 +BraceWrapping: + AfterFunction: true +AccessModifierOffset: -8 diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index 33330f329c3..71cdee691b8 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -43,8 +43,7 @@ Created 4/24/1996 Heikki Tuuri #include "rem0cmp.h" #include "srv0start.h" #include "srv0srv.h" -#include <stack> -#include <set> +#include "fts0opt.h" /** Following are the InnoDB system tables. The positions in this array are referenced by enum dict_system_table_id. */ @@ -3088,8 +3087,12 @@ func_exit: FTS */ fts_optimize_remove_table(table); fts_free(table); - } else { + } else if (fts_optimize_wq) { fts_optimize_add_table(table); + } else { + /* fts_optimize_thread is not started yet. + So make the table as non-evictable from cache. */ + dict_table_move_from_lru_to_non_lru(table); } } diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 9366cb34304..3ca539c5f22 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2685,6 +2685,10 @@ retry: } if (read_only) { + /* InnoDB stores actual synced_doc_id value + 1 in + FTS_CONFIG table. Reduce the value by 1 while reading + after startup. */ + if (*doc_id) *doc_id -= 1; goto func_exit; } @@ -5366,11 +5370,11 @@ fts_t::fts_t( const dict_table_t* table, mem_heap_t* heap) : - in_queue(0), added_synced(0), dict_locked(0), + added_synced(0), dict_locked(0), bg_threads(0), add_wq(NULL), cache(NULL), - doc_col(ULINT_UNDEFINED), + doc_col(ULINT_UNDEFINED), in_queue(false), fts_heap(heap) { ut_a(table->fts == NULL); diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 8b72bac6589..06cb70ed575 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -35,9 +35,10 @@ Completed 2011/7/10 Sunny and Jimmy Yang #include "srv0start.h" #include "ut0list.h" #include "zlib.h" +#include "fts0opt.h" /** The FTS optimize thread's work queue. */ -static ib_wqueue_t* fts_optimize_wq; +ib_wqueue_t* fts_optimize_wq; /** The FTS vector to store fts_slot_t */ static ib_vector_t* fts_slots; @@ -168,8 +169,8 @@ struct fts_encode_t { /** We use this information to determine when to start the optimize cycle for a table. */ struct fts_slot_t { - /** table identifier, or 0 if the slot is empty */ - table_id_t table_id; + /** table, or NULL if the slot is unused */ + dict_table_t* table; /** whether this slot is being processed */ bool running; @@ -2391,14 +2392,7 @@ fts_optimize_table_bk( return(DB_SUCCESS); } - dict_table_t* table = dict_table_open_on_id( - slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); - - if (!table) { - slot->last_run = now; - return DB_SUCCESS; - } - + dict_table_t* table = slot->table; dberr_t error; if (fil_table_accessible(table) @@ -2418,8 +2412,6 @@ fts_optimize_table_bk( error = DB_SUCCESS; } - dict_table_close(table, FALSE, FALSE); - return(error); } /*********************************************************************//** @@ -2564,11 +2556,13 @@ void fts_optimize_add_table(dict_table_t* table) msg = fts_optimize_create_msg(FTS_MSG_ADD_TABLE, table); - ib_wqueue_add(fts_optimize_wq, msg, msg->heap); + mutex_enter(&fts_optimize_wq->mutex); + + ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true); - mutex_enter(&table->fts->bg_threads_mutex); table->fts->in_queue = true; - mutex_exit(&table->fts->bg_threads_mutex); + + mutex_exit(&fts_optimize_wq->mutex); } /**********************************************************************//** @@ -2595,12 +2589,10 @@ fts_optimize_remove_table( return; } - fts_t* fts = table->fts; - mutex_enter(&fts->bg_threads_mutex); - bool is_in_optimize_queue = fts->in_queue; - mutex_exit(&fts->bg_threads_mutex); + mutex_enter(&fts_optimize_wq->mutex); - if (!is_in_optimize_queue) { + if (!table->fts->in_queue) { + mutex_exit(&fts_optimize_wq->mutex); return; } @@ -2616,15 +2608,17 @@ fts_optimize_remove_table( remove->event = event; msg->ptr = remove; - ib_wqueue_add(fts_optimize_wq, msg, msg->heap); + ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true); + + mutex_exit(&fts_optimize_wq->mutex); os_event_wait(event); os_event_destroy(event); - mutex_enter(&fts->bg_threads_mutex); - fts->in_queue = false; - mutex_exit(&fts->bg_threads_mutex); + ut_d(mutex_enter(&fts_optimize_wq->mutex)); + ut_ad(!table->fts->in_queue); + ut_d(mutex_exit(&fts_optimize_wq->mutex)); } /** Send sync fts cache for the table. @@ -2633,9 +2627,6 @@ void fts_optimize_request_sync_table( dict_table_t* table) { - fts_msg_t* msg; - table_id_t* table_id; - /* if the optimize system not yet initialized, return */ if (!fts_optimize_wq) { return; @@ -2648,39 +2639,36 @@ fts_optimize_request_sync_table( return; } - msg = fts_optimize_create_msg(FTS_MSG_SYNC_TABLE, NULL); + fts_msg_t* msg = fts_optimize_create_msg(FTS_MSG_SYNC_TABLE, table); - table_id = static_cast<table_id_t*>( - mem_heap_alloc(msg->heap, sizeof(table_id_t))); - *table_id = table->id; - msg->ptr = table_id; + mutex_enter(&fts_optimize_wq->mutex); - ib_wqueue_add(fts_optimize_wq, msg, msg->heap); + ib_wqueue_add(fts_optimize_wq, msg, msg->heap, true); - mutex_enter(&table->fts->bg_threads_mutex); table->fts->in_queue = true; - mutex_exit(&table->fts->bg_threads_mutex); + + mutex_exit(&fts_optimize_wq->mutex); } /** Add a table to fts_slots if it doesn't already exist. */ static bool fts_optimize_new_table(dict_table_t* table) { + ut_ad(table); + ulint i; fts_slot_t* slot; fts_slot_t* empty = NULL; - const table_id_t table_id = table->id; - ut_ad(table_id); /* Search for duplicates, also find a free slot if one exists. */ for (i = 0; i < ib_vector_size(fts_slots); ++i) { slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i)); - if (!slot->table_id) { + if (!slot->table) { empty = slot; - } else if (slot->table_id == table_id) { + } else if (slot->table == table) { /* Already exists in our optimize queue. */ - return(FALSE); + return false; } } @@ -2689,36 +2677,35 @@ static bool fts_optimize_new_table(dict_table_t* table) memset(slot, 0x0, sizeof(*slot)); - slot->table_id = table->id; - slot->running = false; - - return(TRUE); + slot->table = table; + return true; } /** Remove a table from fts_slots if it exists. @param[in,out] table table to be removed from fts_slots */ static bool fts_optimize_del_table(const dict_table_t* table) { - const table_id_t table_id = table->id; - ut_ad(table_id); - + ut_ad(table); for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { fts_slot_t* slot; slot = static_cast<fts_slot_t*>(ib_vector_get(fts_slots, i)); - if (slot->table_id == table_id) { + if (slot->table == table) { if (fts_enable_diag_print) { ib::info() << "FTS Optimize Removing table " << table->name; } - slot->table_id = 0; - return(TRUE); + mutex_enter(&fts_optimize_wq->mutex); + slot->table->fts->in_queue = false; + mutex_exit(&fts_optimize_wq->mutex); + slot->table = NULL; + return true; } } - return(FALSE); + return false; } /**********************************************************************//** @@ -2732,7 +2719,7 @@ static ulint fts_optimize_how_many() for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { const fts_slot_t* slot = static_cast<const fts_slot_t*>( ib_vector_get_const(fts_slots, i)); - if (slot->table_id == 0) { + if (!slot->table) { continue; } @@ -2768,22 +2755,14 @@ static bool fts_is_sync_needed() const fts_slot_t* slot = static_cast<const fts_slot_t*>( ib_vector_get_const(fts_slots, i)); - if (slot->table_id == 0) { - continue; - } - - dict_table_t* table = dict_table_open_on_id( - slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); - if (!table) { + if (!slot->table) { continue; } - if (table->fts && table->fts->cache) { - total_memory += table->fts->cache->total_size; + if (slot->table->fts && slot->table->fts->cache) { + total_memory += slot->table->fts->cache->total_size; } - dict_table_close(table, FALSE, FALSE); - if (total_memory > fts_max_total_cache_size) { return(true); } @@ -2793,22 +2772,14 @@ static bool fts_is_sync_needed() } /** Sync fts cache of a table -@param[in] table_id table id */ -static void fts_optimize_sync_table(table_id_t table_id) +@param[in,out] table table to be synced */ +static void fts_optimize_sync_table(dict_table_t* table) { - if (dict_table_t* table = dict_table_open_on_id( - table_id, FALSE, DICT_TABLE_OP_NORMAL)) { - if (fil_table_accessible(table) - && table->fts && table->fts->cache) { - fts_sync_table(table, false); - } - - DBUG_EXECUTE_IF( - "ib_optimize_wq_hang", - os_thread_sleep(6000000);); - - dict_table_close(table, FALSE, FALSE); + if (table->fts && table->fts->cache && fil_table_accessible(table)) { + fts_sync_table(table, false); } + + DBUG_EXECUTE_IF("ib_optimize_wq_hang", os_thread_sleep(6000000);); } /**********************************************************************//** @@ -2847,7 +2818,7 @@ DECLARE_THREAD(fts_optimize_thread)( ib_vector_get(fts_slots, current)); /* Handle the case of empty slots. */ - if (slot->table_id) { + if (slot->table) { slot->running = true; fts_optimize_table_bk(slot); } @@ -2906,7 +2877,7 @@ DECLARE_THREAD(fts_optimize_thread)( os_thread_sleep(300000);); fts_optimize_sync_table( - *static_cast<table_id_t*>(msg->ptr)); + static_cast<dict_table_t*>(msg->ptr)); break; default: @@ -2925,8 +2896,8 @@ DECLARE_THREAD(fts_optimize_thread)( fts_slot_t* slot = static_cast<fts_slot_t*>( ib_vector_get(fts_slots, i)); - if (table_id_t table_id = slot->table_id) { - fts_optimize_sync_table(table_id); + if (slot->table) { + fts_optimize_sync_table(slot->table); } } } @@ -2954,7 +2925,6 @@ fts_optimize_init(void) { mem_heap_t* heap; ib_alloc_t* heap_alloc; - dict_table_t* table; ut_ad(!srv_read_only_mode); @@ -2970,31 +2940,25 @@ fts_optimize_init(void) heap_alloc = ib_heap_allocator_create(heap); fts_slots = ib_vector_create(heap_alloc, sizeof(fts_slot_t), 4); - /* Add fts tables to the fts_slots vector which were skipped during restart */ - std::vector<dict_table_t*> table_vector; - std::vector<dict_table_t*>::iterator it; - + /* Add fts tables to fts_slots which could be skipped + during dict_load_table_one() because fts_optimize_thread + wasn't even started. */ mutex_enter(&dict_sys->mutex); - for (table = UT_LIST_GET_FIRST(dict_sys->table_LRU); - table != NULL; - table = UT_LIST_GET_NEXT(table_LRU, table)) { - if (table->fts && - dict_table_has_fts_index(table)) { - if (fts_optimize_new_table(table)){ - table_vector.push_back(table); - } + for (dict_table_t* table = UT_LIST_GET_FIRST(dict_sys->table_LRU); + table != NULL; + table = UT_LIST_GET_NEXT(table_LRU, table)) { + if (!table->fts || !dict_table_has_fts_index(table)) { + continue; } - } - /* It is better to call dict_table_prevent_eviction() - outside the above loop because it operates on - dict_sys->table_LRU list.*/ - for (it=table_vector.begin();it!=table_vector.end();++it) { - dict_table_prevent_eviction(*it); + /* fts_optimize_thread is not started yet. So there is no + need to acquire fts_optimize_wq->mutex for adding the fts + table to the fts slots. */ + ut_ad(!table->can_be_evicted); + fts_optimize_new_table(table); + table->fts->in_queue = true; } - mutex_exit(&dict_sys->mutex); - table_vector.clear(); fts_opt_shutdown_event = os_event_create(0); last_check_sync_time = time(NULL); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6dc01f9297b..ffa8bea1850 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2587,11 +2587,10 @@ innobase_next_autoinc( if (next_value == 0) { ulonglong next; - if (current >= offset) { + if (current > offset) { next = (current - offset) / step; } else { - next = 0; - block -= step; + next = (offset - current) / step; } ut_a(max_value > next); @@ -16539,7 +16538,7 @@ ha_innobase::get_auto_increment( if (increment > 1 && thd_sql_command(m_user_thd) != SQLCOM_ALTER_TABLE && autoinc < col_max_value) { - ulonglong prev_auto_inc = autoinc; + ulonglong prev_auto_inc = autoinc; autoinc = ((autoinc - 1) + increment - offset)/ increment; @@ -16593,27 +16592,6 @@ ha_innobase::get_auto_increment( current = *first_value; - if (m_prebuilt->autoinc_increment != increment) { - - WSREP_DEBUG("autoinc decrease: %llu -> %llu\n" - "THD: %ld, current: %llu, autoinc: %llu", - m_prebuilt->autoinc_increment, - increment, - thd_get_thread_id(m_user_thd), - current, autoinc); - if (!wsrep_on(m_user_thd)) { - current = autoinc - - m_prebuilt->autoinc_increment; - current = innobase_next_autoinc( - current, 1, increment, offset, col_max_value); - } - - dict_table_autoinc_initialize( - m_prebuilt->table, current); - - *first_value = current; - } - /* Compute the last value in the interval */ next_value = innobase_next_autoinc( current, *nb_reserved_values, increment, offset, @@ -19777,6 +19755,11 @@ static MYSQL_SYSVAR_ENUM(stats_method, srv_innodb_stats_method, NULL, NULL, SRV_STATS_NULLS_EQUAL, &innodb_stats_method_typelib); #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG +static MYSQL_SYSVAR_BOOL(change_buffer_dump, ibuf_dump, + PLUGIN_VAR_NOCMDARG | PLUGIN_VAR_READONLY, + "Dump the change buffer at startup.", + NULL, NULL, FALSE); + static MYSQL_SYSVAR_UINT(change_buffering_debug, ibuf_debug, PLUGIN_VAR_RQCMDARG, "Debug flags for InnoDB change buffering (0=none, 1=try to buffer)", @@ -20260,6 +20243,7 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(change_buffering), MYSQL_SYSVAR(change_buffer_max_size), #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + MYSQL_SYSVAR(change_buffer_dump), MYSQL_SYSVAR(change_buffering_debug), MYSQL_SYSVAR(disable_background_merge), #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 62aabe895b7..41ad08be63f 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -185,6 +185,8 @@ access order rules. */ ulong innodb_change_buffering; #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG +/** Dump the change buffer at startup */ +my_bool ibuf_dump; /** Flag to control insert buffer debugging. */ uint ibuf_debug; #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ @@ -506,6 +508,25 @@ ibuf_init_at_db_start(void) #endif /* BTR_CUR_ADAPT */ ibuf->index->page = FSP_IBUF_TREE_ROOT_PAGE_NO; ut_d(ibuf->index->cached = TRUE); + +#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG + if (!ibuf_dump) { + return error; + } + ib::info() << "Dumping the change buffer"; + ibuf_mtr_start(&mtr); + btr_pcur_t pcur; + if (DB_SUCCESS == btr_pcur_open_at_index_side( + true, ibuf->index, BTR_SEARCH_LEAF, &pcur, + true, 0, &mtr)) { + while (btr_pcur_move_to_next_user_rec(&pcur, &mtr)) { + rec_print_old(stderr, btr_pcur_get_rec(&pcur)); + } + } + ibuf_mtr_commit(&mtr); + ib::info() << "Dumped the change buffer"; +#endif + return (error); } diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index fec101529f9..1e16e501a48 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -142,6 +142,8 @@ struct table_name_t }; #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG +/** Dump the change buffer at startup */ +extern my_bool ibuf_dump; /** Flag to control insert buffer debugging. */ extern uint ibuf_debug; #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 30655b3934e..7924c9025cd 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -320,9 +320,6 @@ public: /** Mutex protecting bg_threads* and fts_add_wq. */ ib_mutex_t bg_threads_mutex; - /** Whether the table was added to fts_optimize_wq(); - protected by bg_threads_mutex */ - unsigned in_queue:1; /** Whether the ADDED table record sync-ed after crash recovery; protected by bg_threads_mutex */ unsigned added_synced:1; @@ -348,6 +345,10 @@ public: /** Vector of FTS indexes, this is mainly for caching purposes. */ ib_vector_t* indexes; + /** Whether the table exists in fts_optimize_wq; + protected by fts_optimize_wq mutex */ + bool in_queue; + /** Heap for fts_t allocation. */ mem_heap_t* fts_heap; }; diff --git a/storage/innobase/include/fts0opt.h b/storage/innobase/include/fts0opt.h index 4b4d1c4c84a..c527ad8e528 100644 --- a/storage/innobase/include/fts0opt.h +++ b/storage/innobase/include/fts0opt.h @@ -25,6 +25,9 @@ Created 2011-02-15 Jimmy Yang #ifndef INNODB_FTS0OPT_H #define INNODB_FTS0OPT_H +/** The FTS optimize thread's work queue. */ +extern ib_wqueue_t* fts_optimize_wq; + /******************************************************************** Callback function to fetch the rows in an FTS INDEX record. */ ibool diff --git a/storage/innobase/include/ut0mem.h b/storage/innobase/include/ut0mem.h index 49777495cae..32d557d4f2a 100644 --- a/storage/innobase/include/ut0mem.h +++ b/storage/innobase/include/ut0mem.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -83,29 +84,6 @@ UNIV_INLINE int ut_strcmp(const char* str1, const char* str2); -/**********************************************************************//** -Copies up to size - 1 characters from the NUL-terminated string src to -dst, NUL-terminating the result. Returns strlen(src), so truncation -occurred if the return value >= size. -@return strlen(src) */ -ulint -ut_strlcpy( -/*=======*/ - char* dst, /*!< in: destination buffer */ - const char* src, /*!< in: source buffer */ - ulint size); /*!< in: size of destination buffer */ - -/**********************************************************************//** -Like ut_strlcpy, but if src doesn't fit in dst completely, copies the last -(size - 1) bytes of src, not the first. -@return strlen(src) */ -ulint -ut_strlcpy_rev( -/*===========*/ - char* dst, /*!< in: destination buffer */ - const char* src, /*!< in: source buffer */ - ulint size); /*!< in: size of destination buffer */ - /******************************************************************** Concatenate 3 strings.*/ char* diff --git a/storage/innobase/include/ut0wqueue.h b/storage/innobase/include/ut0wqueue.h index 6a096a36894..5a895f4ea3c 100644 --- a/storage/innobase/include/ut0wqueue.h +++ b/storage/innobase/include/ut0wqueue.h @@ -38,7 +38,18 @@ processing. // Forward declaration struct ib_list_t; -struct ib_wqueue_t; + +/** Work queue */ +struct ib_wqueue_t +{ + /** Mutex protecting everything */ + ib_mutex_t mutex; + /** Work item list */ + ib_list_t* items; + /** event we use to signal additions to list; + os_event_set() and os_event_reset() are protected by the mutex */ + os_event_t event; +}; /****************************************************************//** Create a new work queue. @@ -54,15 +65,14 @@ ib_wqueue_free( /*===========*/ ib_wqueue_t* wq); /*!< in: work queue */ -/****************************************************************//** -Add a work item to the queue. */ +/** Add a work item to the queue. +@param[in,out] wq work queue +@param[in] item work item +@param[in,out] heap memory heap to use for allocating list node +@param[in] wq_locked work queue mutex locked */ void -ib_wqueue_add( -/*==========*/ - ib_wqueue_t* wq, /*!< in: work queue */ - void* item, /*!< in: work item */ - mem_heap_t* heap); /*!< in: memory heap to use for - allocating the list node */ +ib_wqueue_add(ib_wqueue_t* wq, void* item, mem_heap_t* heap, + bool wq_locked = false); /** Check if queue is empty. @param wq wait queue @@ -101,5 +111,4 @@ ib_wqueue_len( /*==========*/ ib_wqueue_t* wq); /*<! in: work queue */ - #endif /* IB_WORK_QUEUE_H */ diff --git a/storage/innobase/mem/mem0mem.cc b/storage/innobase/mem/mem0mem.cc index 759308faac8..a298a7c0b2f 100644 --- a/storage/innobase/mem/mem0mem.cc +++ b/storage/innobase/mem/mem0mem.cc @@ -228,6 +228,17 @@ mem_heap_validate( ut_ad(size == heap->total_size); } + +/** Copy the tail of a string. +@param[in,out] dst destination buffer +@param[in] src string whose tail to copy +@param[in] size size of dst buffer, in bytes, including NUL terminator +@return strlen(src) */ +static void ut_strlcpy_rev(char* dst, const char* src, ulint size) +{ + size_t src_size = strlen(src), n = std::min(src_size, size - 1); + memcpy(dst, src + src_size - n, n + 1); +} #endif /* UNIV_DEBUG */ /***************************************************************//** diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index dace9b54a0b..0f6c56a4a03 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -4695,19 +4695,23 @@ os_file_get_status_win32( CloseHandle(fh); } } + stat_info->block_size = 0; + /* What follows, is calculation of FS block size, which is not important + (it is just shown in I_S innodb tables). The error to calculate it will be ignored.*/ char volname[MAX_PATH]; BOOL result = GetVolumePathName(path, volname, MAX_PATH); - + static bool warned_once = false; if (!result) { - - ib::error() - << "os_file_get_status_win32: " - << "Failed to get the volume path name for: " - << path - << "- OS error number " << GetLastError(); - - return(DB_FAIL); + if (!warned_once) { + ib::warn() + << "os_file_get_status_win32: " + << "Failed to get the volume path name for: " + << path + << "- OS error number " << GetLastError(); + warned_once = true; + } + return(DB_SUCCESS); } DWORD sectorsPerCluster; @@ -4723,15 +4727,15 @@ os_file_get_status_win32( &totalNumberOfClusters); if (!result) { - - ib::error() - << "GetDiskFreeSpace(" << volname << ",...) " - << "failed " - << "- OS error number " << GetLastError(); - - return(DB_FAIL); + if (!warned_once) { + ib::warn() + << "GetDiskFreeSpace(" << volname << ",...) " + << "failed " + << "- OS error number " << GetLastError(); + warned_once = true; + } + return(DB_SUCCESS); } - stat_info->block_size = bytesPerSector * sectorsPerCluster; } else { stat_info->type = OS_FILE_TYPE_UNKNOWN; diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 0c8d8ed369d..404dcd491e2 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2697,7 +2697,7 @@ write_buffers: buf, fts_index, old_table, new_table, psort_info, row, ext, &doc_id, conv_heap, - &err, &v_heap, table, trx)))) { + &err, &v_heap, eval_table, trx)))) { /* An empty buffer should have enough room for at least one record. */ ut_error; diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index ad94b649397..d3d1c9a0fac 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2477,17 +2477,27 @@ row_upd_sec_index_entry( case DB_NO_REFERENCED_ROW: err = DB_SUCCESS; break; + case DB_LOCK_WAIT: + if (wsrep_debug) { + ib::warn() << "WSREP: sec index FK lock wait" + << " index " << index->name + << " table " << index->table->name + << " query " << wsrep_thd_query(trx->mysql_thd); + } + break; case DB_DEADLOCK: if (wsrep_debug) { ib::warn() << "WSREP: sec index FK check fail for deadlock" << " index " << index->name - << " table " << index->table->name; + << " table " << index->table->name + << " query " << wsrep_thd_query(trx->mysql_thd); } break; default: ib::error() << "WSREP: referenced FK check fail: " << ut_strerr(err) << " index " << index->name - << " table " << index->table->name; + << " table " << index->table->name + << " query " << wsrep_thd_query(trx->mysql_thd); break; } diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 2c672dd24fa..359ea694536 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -79,7 +79,8 @@ trx_set_detailed_error( trx_t* trx, /*!< in: transaction struct */ const char* msg) /*!< in: detailed error message */ { - ut_strlcpy(trx->detailed_error, msg, MAX_DETAILED_ERROR_LEN); + strncpy(trx->detailed_error, msg, MAX_DETAILED_ERROR_LEN - 1); + trx->detailed_error[MAX_DETAILED_ERROR_LEN - 1] = '\0'; } /*************************************************************//** diff --git a/storage/innobase/ut/ut0mem.cc b/storage/innobase/ut/ut0mem.cc index 32a90accd21..faade827283 100644 --- a/storage/innobase/ut/ut0mem.cc +++ b/storage/innobase/ut/ut0mem.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -24,55 +25,6 @@ Created 5/11/1994 Heikki Tuuri *************************************************************************/ #include "ut0mem.h" -#include "os0thread.h" -#include "srv0srv.h" -#include <stdlib.h> - -/**********************************************************************//** -Copies up to size - 1 characters from the NUL-terminated string src to -dst, NUL-terminating the result. Returns strlen(src), so truncation -occurred if the return value >= size. -@return strlen(src) */ -ulint -ut_strlcpy( -/*=======*/ - char* dst, /*!< in: destination buffer */ - const char* src, /*!< in: source buffer */ - ulint size) /*!< in: size of destination buffer */ -{ - ulint src_size = strlen(src); - - if (size != 0) { - ulint n = ut_min(src_size, size - 1); - - memcpy(dst, src, n); - dst[n] = '\0'; - } - - return(src_size); -} - -/**********************************************************************//** -Like ut_strlcpy, but if src doesn't fit in dst completely, copies the last -(size - 1) bytes of src, not the first. -@return strlen(src) */ -ulint -ut_strlcpy_rev( -/*===========*/ - char* dst, /*!< in: destination buffer */ - const char* src, /*!< in: source buffer */ - ulint size) /*!< in: size of destination buffer */ -{ - ulint src_size = strlen(src); - - if (size != 0) { - ulint n = ut_min(src_size, size - 1); - - memcpy(dst, src + src_size - n, n + 1); - } - - return(src_size); -} /******************************************************************** Concatenate 3 strings.*/ diff --git a/storage/innobase/ut/ut0wqueue.cc b/storage/innobase/ut/ut0wqueue.cc index 026431695ed..ae97009430e 100644 --- a/storage/innobase/ut/ut0wqueue.cc +++ b/storage/innobase/ut/ut0wqueue.cc @@ -28,15 +28,6 @@ A work queue Created 4/26/2006 Osku Salerma ************************************************************************/ -/* Work queue. */ -struct ib_wqueue_t { - ib_mutex_t mutex; /*!< mutex protecting everything */ - ib_list_t* items; /*!< work item list */ - os_event_t event; /*!< event we use to signal additions to list; - os_event_set() and os_event_reset() are - protected by ib_wqueue_t::mutex */ -}; - /****************************************************************//** Create a new work queue. @return work queue */ @@ -72,22 +63,24 @@ ib_wqueue_free( ut_free(wq); } -/****************************************************************//** -Add a work item to the queue. */ +/** Add a work item to the queue. +@param[in,out] wq work queue +@param[in] item work item +@param[in,out] heap memory heap to use for allocating list node +@param[in] wq_locked work queue mutex locked */ void -ib_wqueue_add( -/*==========*/ - ib_wqueue_t* wq, /*!< in: work queue */ - void* item, /*!< in: work item */ - mem_heap_t* heap) /*!< in: memory heap to use for allocating the - list node */ +ib_wqueue_add(ib_wqueue_t* wq, void* item, mem_heap_t* heap, bool wq_locked) { - mutex_enter(&wq->mutex); + if (!wq_locked) { + mutex_enter(&wq->mutex); + } ib_list_add_last(wq->items, item, heap); os_event_set(wq->event); - mutex_exit(&wq->mutex); + if (!wq_locked) { + mutex_exit(&wq->mutex); + } } /****************************************************************//** diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 3b4e4fb967e..f22f7c1d6b5 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -90,6 +90,7 @@ CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") +MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-cpp" DEBUG) ############################################ MARK_AS_ADVANCED(BUILDNAME) diff --git a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake index 9769b7db13d..b312111a3a2 100644 --- a/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake +++ b/storage/tokudb/PerconaFT/cmake_modules/TokuThirdParty.cmake @@ -1,39 +1,5 @@ include(ExternalProject) -if (CMAKE_PROJECT_NAME STREQUAL TokuDB) - ## add jemalloc with an external project - set(JEMALLOC_SOURCE_DIR "${TokuDB_SOURCE_DIR}/third_party/jemalloc" CACHE FILEPATH "Where to find jemalloc sources.") - if (EXISTS "${JEMALLOC_SOURCE_DIR}/configure") - set(jemalloc_configure_opts "CC=${CMAKE_C_COMPILER}" "--with-jemalloc-prefix=" "--with-private-namespace=tokudb_jemalloc_internal_" "--enable-cc-silence") - option(JEMALLOC_DEBUG "Build jemalloc with --enable-debug." OFF) - if (JEMALLOC_DEBUG) - list(APPEND jemalloc_configure_opts --enable-debug) - endif () - ExternalProject_Add(build_jemalloc - PREFIX jemalloc - SOURCE_DIR "${JEMALLOC_SOURCE_DIR}" - CONFIGURE_COMMAND - "${JEMALLOC_SOURCE_DIR}/configure" ${jemalloc_configure_opts} - "--prefix=${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc" - ) - - add_library(jemalloc STATIC IMPORTED GLOBAL) - set_target_properties(jemalloc PROPERTIES IMPORTED_LOCATION - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc_pic.a") - add_dependencies(jemalloc build_jemalloc) - add_library(jemalloc_nopic STATIC IMPORTED GLOBAL) - set_target_properties(jemalloc_nopic PROPERTIES IMPORTED_LOCATION - "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib/libjemalloc.a") - add_dependencies(jemalloc_nopic build_jemalloc) - - # detect when we are being built as a subproject - if (NOT DEFINED MYSQL_PROJECT_NAME_DOCSTRING) - install(DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/jemalloc/lib" DESTINATION . - COMPONENT tokukv_libs_extra) - endif () - endif () -endif () - ## add lzma with an external project set(xz_configure_opts --with-pic --enable-static) if (APPLE) diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash index cd5743cddf2..3daa87ce03c 100644 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-coverage-tests.bash @@ -26,7 +26,7 @@ if [ ! -d build ] ; then -D RUN_LONG_TESTS=ON \ -D TOKUDB_DATA=$tokudbdir/../tokudb.data \ .. - ninja build_jemalloc build_lzma build_snappy + ninja build_lzma build_snappy popd fi diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash index 3c688581385..1ef819d8e37 100644 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-drd-tests.bash @@ -25,7 +25,7 @@ if [ ! -d build ] ; then -D RUN_LONG_TESTS=ON \ -D TOKUDB_DATA=$tokudbdir/../tokudb.data \ .. - ninja build_jemalloc build_lzma build_snappy + ninja build_lzma build_snappy popd fi diff --git a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash index 80938bad8a6..c1039a0b28f 100644 --- a/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash +++ b/storage/tokudb/PerconaFT/scripts/run-nightly-release-tests.bash @@ -25,7 +25,7 @@ if [ ! -d build ] ; then -D RUN_LONG_TESTS=ON \ -D TOKUDB_DATA=$tokudbdir/../tokudb.data \ .. - ninja build_jemalloc build_lzma build_snappy + ninja build_lzma build_snappy popd fi diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc index ae816eb60a0..535b2189cad 100644 --- a/storage/tokudb/ha_tokudb.cc +++ b/storage/tokudb/ha_tokudb.cc @@ -1077,7 +1077,8 @@ static inline int tokudb_generate_row(DB* dest_db, } buff = (uchar *)dest_key->data; - assert_always(buff != NULL && max_key_len > 0); + assert_always(buff != nullptr); + assert_always(max_key_len > 0); } else { assert_unreachable(); } diff --git a/storage/tokudb/ha_tokudb.h b/storage/tokudb/ha_tokudb.h index 5d8137274a7..001df43defa 100644 --- a/storage/tokudb/ha_tokudb.h +++ b/storage/tokudb/ha_tokudb.h @@ -387,7 +387,8 @@ inline void TOKUDB_SHARE::init_cardinality_counts( assert_debug(_mutex.is_owned_by_me()); // can not change number of keys live - assert_always(_rec_per_key == NULL && _rec_per_keys == 0); + assert_always(_rec_per_key == nullptr); + assert_always(_rec_per_keys == 0); _rec_per_keys = rec_per_keys; _rec_per_key = rec_per_key; } diff --git a/storage/tokudb/hatoku_cmp.cc b/storage/tokudb/hatoku_cmp.cc index d4bfa4e5b27..5f82d1e48be 100644 --- a/storage/tokudb/hatoku_cmp.cc +++ b/storage/tokudb/hatoku_cmp.cc @@ -957,9 +957,8 @@ static inline int tokudb_compare_two_hidden_keys( const void* saved_key_data, const uint32_t saved_key_size ) { - assert_always( - (new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH) && - (saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH)); + assert_always(new_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH); + assert_always(saved_key_size >= TOKUDB_HIDDEN_PRIMARY_KEY_LENGTH); ulonglong a = hpk_char_to_num((uchar *) new_key_data); ulonglong b = hpk_char_to_num((uchar *) saved_key_data); return a < b ? -1 : (a > b ? 1 : 0); @@ -2537,7 +2536,8 @@ static uint32_t create_toku_secondary_key_pack_descriptor ( bool is_col_in_pk = false; if (bitmap_is_set(&kc_info->key_filters[pk_index],field_index)) { - assert_always(!has_hpk && prim_key != NULL); + assert_always(!has_hpk); + assert_always(prim_key != nullptr); is_col_in_pk = true; } else { diff --git a/storage/tokudb/tests/math_test_int.cc b/storage/tokudb/tests/math_test_int.cc index 10085dbd704..3313bdf5895 100644 --- a/storage/tokudb/tests/math_test_int.cc +++ b/storage/tokudb/tests/math_test_int.cc @@ -54,16 +54,20 @@ static void test_int8() { assert(over); else if (m < -max) assert(over); - else - assert(!over && n == m); + else { + assert(!over); + assert(n == m); + } n = int_sub(x, y, 8, &over); m = x - y; if (m > max-1) assert(over); else if (m < -max) assert(over); - else - assert(!over && n == m); + else { + assert(!over); + asset(n == m); + } } } } @@ -82,16 +86,20 @@ static void test_int16() { assert(over); else if (m < -max) assert(over); - else - assert(!over && n == m); + else { + assert(!over); + assert(n == m); + } n = int_sub(x, y, 16, &over); m = x - y; if (m > max-1) assert(over); else if (m < -max) assert(over); - else - assert(!over && n == m); + else { + assert(!over); + assert(n == m); + } } } } @@ -104,20 +112,42 @@ static void test_int24() { s = int_add(1, (1ULL<<23)-1, 24, &over); assert(over); s = int_add((1ULL<<23)-1, 1, 24, &over); assert(over); - s = int_sub(-1, (1ULL<<23), 24, &over); assert(!over && s == (1ULL<<23)-1); + s = int_sub(-1, (1ULL<<23), 24, &over); + assert(!over); + assert(s == (1ULL<<23)-1); s = int_sub((1ULL<<23), 1, 24, &over); assert(over); - s = int_add(0, 0, 24, &over); assert(!over && s == 0); - s = int_sub(0, 0, 24, &over); assert(!over && s == 0); - s = int_add(0, -1, 24, &over); assert(!over && s == -1); - s = int_sub(0, 1, 24, &over); assert(!over && s == -1); - s = int_add(0, (1ULL<<23), 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)); - s = int_sub(0, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)+1); - - s = int_add(-1, 0, 24, &over); assert(!over && s == -1); - s = int_add(-1, 1, 24, &over); assert(!over && s == 0); - s = int_sub(-1, -1, 24, &over); assert(!over && s == 0); - s = int_sub(-1, (1ULL<<23)-1, 24, &over); assert(!over && (s & ((1ULL<<24)-1)) == (1ULL<<23)); + s = int_add(0, 0, 24, &over); + assert(!over); + assert(s == 0); + s = int_sub(0, 0, 24, &over); + assert(!over); + assert(s == 0); + s = int_add(0, -1, 24, &over); + assert(!over); + assert(s == -1); + s = int_sub(0, 1, 24, &over); + assert(!over); + assert(s == -1); + s = int_add(0, (1ULL<<23), 24, &over); + assert(!over); + assert((s & ((1ULL<<24)-1)) == (1ULL<<23)); + s = int_sub(0, (1ULL<<23)-1, 24, &over); + assert(!over); + assert((s & ((1ULL<<24)-1)) == (1ULL<<23)+1); + + s = int_add(-1, 0, 24, &over); + assert(!over); + assert(s == -1); + s = int_add(-1, 1, 24, &over); + assert(!over); + assert(s == 0); + s = int_sub(-1, -1, 24, &over); + assert(!over); + assert(s == 0); + s = int_sub(-1, (1ULL<<23)-1, 24, &over); + assert(!over); + assert((s & ((1ULL<<24)-1)) == (1ULL<<23)); } static void test_int32() { @@ -128,20 +158,42 @@ static void test_int32() { s = int_add(1, (1ULL<<31)-1, 32, &over); assert(over); s = int_add((1ULL<<31)-1, 1, 32, &over); assert(over); - s = int_sub(-1, (1ULL<<31), 32, &over); assert(s == (1ULL<<31)-1 && !over); + s = int_sub(-1, (1ULL<<31), 32, &over); + assert(s == (1ULL<<31)-1); + assert(!over); s = int_sub((1ULL<<31), 1, 32, &over); assert(over); - s = int_add(0, 0, 32, &over); assert(s == 0 && !over); - s = int_sub(0, 0, 32, &over); assert(s == 0 && !over); - s = int_add(0, -1, 32, &over); assert(s == -1 && !over); - s = int_sub(0, 1, 32, &over); assert(s == -1 && !over); - s = int_add(0, (1ULL<<31), 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over); - s = int_sub(0, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1 && !over); - - s = int_add(-1, 0, 32, &over); assert(s == -1 && !over); - s = int_add(-1, 1, 32, &over); assert(s == 0 && !over); - s = int_sub(-1, -1, 32, &over); assert(s == 0 && !over); - s = int_sub(-1, (1ULL<<31)-1, 32, &over); assert((s & ((1ULL<<32)-1)) == (1ULL<<31) && !over); + s = int_add(0, 0, 32, &over); + assert(s == 0); + assert(!over); + s = int_sub(0, 0, 32, &over); + assert(s == 0); + assert(!over); + s = int_add(0, -1, 32, &over); + assert(s == -1); + assert(!over); + s = int_sub(0, 1, 32, &over); + assert(s == -1); + assert(!over); + s = int_add(0, (1ULL<<31), 32, &over); + assert((s & ((1ULL<<32)-1)) == (1ULL<<31)); + assert(!over); + s = int_sub(0, (1ULL<<31)-1, 32, &over); + assert((s & ((1ULL<<32)-1)) == (1ULL<<31)+1); + assert(!over); + + s = int_add(-1, 0, 32, &over); + assert(s == -1); + assert(!over); + s = int_add(-1, 1, 32, &over); + assert(s == 0); + assert(!over); + s = int_sub(-1, -1, 32, &over); + assert(s == 0); + assert(!over); + s = int_sub(-1, (1ULL<<31)-1, 32, &over); + assert((s & ((1ULL<<32)-1)) == (1ULL<<31)); + assert(!over); } static void test_int64() { @@ -152,20 +204,42 @@ static void test_int64() { s = int_add(1, (1ULL<<63)-1, 64, &over); assert(over); s = int_add((1ULL<<63)-1, 1, 64, &over); assert(over); - s = int_sub(-1, (1ULL<<63), 64, &over); assert(s == (1ULL<<63)-1 && !over); + s = int_sub(-1, (1ULL<<63), 64, &over); + assert(s == (1ULL<<63)-1); + assert(!over); s = int_sub((1ULL<<63), 1, 64, &over); assert(over); - s = int_add(0, 0, 64, &over); assert(s == 0 && !over); - s = int_sub(0, 0, 64, &over); assert(s == 0 && !over); - s = int_add(0, -1, 64, &over); assert(s == -1 && !over); - s = int_sub(0, 1, 64, &over); assert(s == -1 && !over); - s = int_add(0, (1ULL<<63), 64, &over); assert(s == (int64_t)(1ULL<<63) && !over); - s = int_sub(0, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)((1ULL<<63)+1) && !over); - - s = int_add(-1, 0, 64, &over); assert(s == -1 && !over); - s = int_add(-1, 1, 64, &over); assert(s == 0 && !over); - s = int_sub(-1, -1, 64, &over); assert(s == 0 && !over); - s = int_sub(-1, (1ULL<<63)-1, 64, &over); assert(s == (int64_t)(1ULL<<63) && !over); + s = int_add(0, 0, 64, &over); + assert(s == 0); + assert(!over); + s = int_sub(0, 0, 64, &over); + assert(s == 0); + assert(!over); + s = int_add(0, -1, 64, &over); + assert(s == -1); + assert(!over); + s = int_sub(0, 1, 64, &over); + assert(s == -1); + assert(!over); + s = int_add(0, (1ULL<<63), 64, &over); + assert(s == (int64_t)(1ULL<<63)); + assert(!over); + s = int_sub(0, (1ULL<<63)-1, 64, &over); + assert(s == (int64_t)((1ULL<<63)+1)); + assert(!over); + + s = int_add(-1, 0, 64, &over); + assert(s == -1); + assert(!over); + s = int_add(-1, 1, 64, &over); + assert(s == 0); + assert(!over); + s = int_sub(-1, -1, 64, &over); + assert(s == 0); + assert(!over); + s = int_sub(-1, (1ULL<<63)-1, 64, &over); + assert(s == (int64_t)(1ULL<<63)); + assert(!over); } static void test_int_sign(uint length_bits) { diff --git a/storage/tokudb/tests/math_test_uint.cc b/storage/tokudb/tests/math_test_uint.cc index 2fc8de8e093..2c5c9261c89 100644 --- a/storage/tokudb/tests/math_test_uint.cc +++ b/storage/tokudb/tests/math_test_uint.cc @@ -51,14 +51,18 @@ static void test_uint8() { m = x + y; if (m > (1ULL<<8)-1) assert(over); - else - assert(!over && n == (m % 256)); + else { + assert(!over); + assert(n == (m % 256)); + } n = uint_sub(x, y, 8, &over); m = x - y; if (m > x) assert(over); - else - assert(!over && n == (m % 256)); + else { + assert(!over); + assert(n == (m % 256)); + } } } } @@ -75,14 +79,18 @@ static void test_uint16() { m = x + y; if (m > (1ULL<<16)-1) assert(over); - else - assert(!over && n == (m % (1ULL<<16))); + else { + assert(!over); + assert(n == (m % (1ULL<<16))); + } n = uint_sub(x, y, 16, &over); m = x - y; if (m > x) assert(over); - else - assert(!over && n == (m % (1ULL<<16))); + else { + assert(!over); + assert(n == (m % (1ULL<<16))); + } } } } @@ -95,13 +103,23 @@ static void test_uint24() { s = uint_add((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(over); s = uint_add((1ULL<<24)-1, 1, 24, &over); assert(over); - s = uint_add((1ULL<<24)-1, 0, 24, &over); assert(!over && s == (1ULL<<24)-1); - s = uint_add(0, 1, 24, &over); assert(!over && s == 1); - s = uint_add(0, 0, 24, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 24, &over); assert(!over && s == 0); + s = uint_add((1ULL<<24)-1, 0, 24, &over); + assert(!over); + assert(s == (1ULL<<24)-1); + s = uint_add(0, 1, 24, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 24, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 24, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 24, &over); assert(over); s = uint_sub(0, (1ULL<<24)-1, 24, &over); assert(over); - s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); assert(!over && s == 0); + s = uint_sub((1ULL<<24)-1, (1ULL<<24)-1, 24, &over); + assert(!over); + assert(s == 0); } static void test_uint32() { @@ -112,13 +130,23 @@ static void test_uint32() { s = uint_add((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(over); s = uint_add((1ULL<<32)-1, 1, 32, &over); assert(over); - s = uint_add((1ULL<<32)-1, 0, 32, &over); assert(!over && s == (1ULL<<32)-1); - s = uint_add(0, 1, 32, &over); assert(!over && s == 1); - s = uint_add(0, 0, 32, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 32, &over); assert(!over && s == 0); + s = uint_add((1ULL<<32)-1, 0, 32, &over); + assert(!over); + assert(s == (1ULL<<32)-1); + s = uint_add(0, 1, 32, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 32, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 32, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 32, &over); assert(over); s = uint_sub(0, (1ULL<<32)-1, 32, &over); assert(over); - s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); assert(!over && s == 0); + s = uint_sub((1ULL<<32)-1, (1ULL<<32)-1, 32, &over); + assert(!over); + assert(s == 0); } static void test_uint64() { @@ -129,13 +157,23 @@ static void test_uint64() { s = uint_add(~0ULL, ~0ULL, 64, &over); assert(over); s = uint_add(~0ULL, 1, 64, &over); assert(over); - s = uint_add(~0ULL, 0, 64, &over); assert(!over && s == ~0ULL); - s = uint_add(0, 1, 64, &over); assert(!over && s == 1); - s = uint_add(0, 0, 64, &over); assert(!over && s == 0); - s = uint_sub(0, 0, 64, &over); assert(!over && s == 0); + s = uint_add(~0ULL, 0, 64, &over); + assert(!over); + assert(s == ~0ULL); + s = uint_add(0, 1, 64, &over); + assert(!over); + assert(s == 1); + s = uint_add(0, 0, 64, &over); + assert(!over); + assert(s == 0); + s = uint_sub(0, 0, 64, &over); + assert(!over); + assert(s == 0); s = uint_sub(0, 1, 64, &over); assert(over); s = uint_sub(0, ~0ULL, 64, &over); assert(over); - s = uint_sub(~0ULL, ~0ULL, 64, &over); assert(!over && s == 0); + s = uint_sub(~0ULL, ~0ULL, 64, &over); + assert(!over); + assert(s == 0); } int main() { diff --git a/storage/tokudb/tests/sint_test.cc b/storage/tokudb/tests/sint_test.cc index 9078ae87281..7823ee5a692 100644 --- a/storage/tokudb/tests/sint_test.cc +++ b/storage/tokudb/tests/sint_test.cc @@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <stdint.h> #include <inttypes.h> #include <stdlib.h> -#include <assert.h> #include <sys/types.h> #include <tokudb_math.h> diff --git a/storage/tokudb/tests/tokudb_buffer_test.cc b/storage/tokudb/tests/tokudb_buffer_test.cc index a786cdf4592..7e296790d39 100644 --- a/storage/tokudb/tests/tokudb_buffer_test.cc +++ b/storage/tokudb/tests/tokudb_buffer_test.cc @@ -32,9 +32,13 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. static void test_null() { tokudb::buffer b; - assert(b.data() == NULL && b.size() == 0 && b.limit() == 0); + assert(b.data() == nullptr); + assert(b.size() == 0); + assert(b.limit() == 0); b.append(NULL, 0); - assert(b.data() == NULL && b.size() == 0 && b.limit() == 0); + assert(b.data() == nullptr); + assert(b.size() == 0); + assert(b.limit() == 0); } static void append_az(tokudb::buffer &b) { @@ -132,7 +136,8 @@ static void test_replace_grow() { } for (size_t i = 0; i < a.size()/2; i++) { unsigned char *cp = (unsigned char *) a.data() + 2*i; - assert(cp[0] == 'a'+i && cp[1] == 'a'+i); + assert(cp[0] == 'a'+i); + assert(cp[1] == 'a'+i); } } diff --git a/storage/tokudb/tests/uint_test.cc b/storage/tokudb/tests/uint_test.cc index b2c653b8fdd..e3aa1a6fe2f 100644 --- a/storage/tokudb/tests/uint_test.cc +++ b/storage/tokudb/tests/uint_test.cc @@ -27,7 +27,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #include <stdint.h> #include <inttypes.h> #include <stdlib.h> -#include <assert.h> #include <sys/types.h> #include <tokudb_math.h> diff --git a/storage/tokudb/tests/vlq_test.cc b/storage/tokudb/tests/vlq_test.cc index 80d797339b4..12b222f06c1 100644 --- a/storage/tokudb/tests/vlq_test.cc +++ b/storage/tokudb/tests/vlq_test.cc @@ -52,7 +52,8 @@ static void test_vlq_uint32_error(void) { in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 1); assert(in_s == 0); in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, 2); - assert(in_s == 2 && n == 128); + assert(in_s == 2); + assert(n == 128); } static void test_80000000(void) { @@ -63,7 +64,8 @@ static void test_80000000(void) { out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b); assert(out_s == 5); in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } static void test_100000000(void) { @@ -74,7 +76,8 @@ static void test_100000000(void) { out_s = tokudb::vlq_encode_ui<uint64_t>(v, b, sizeof b); assert(out_s == 5); in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } int main(void) { diff --git a/storage/tokudb/tests/vlq_test_uint32.cc b/storage/tokudb/tests/vlq_test_uint32.cc index c5661b33ab5..3cc8af771a9 100644 --- a/storage/tokudb/tests/vlq_test_uint32.cc +++ b/storage/tokudb/tests/vlq_test_uint32.cc @@ -44,7 +44,8 @@ static void test_vlq_uint32(void) { assert(out_s == 1); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 1 && n == v); + assert(in_s == 1); + assert(n == v); } printf("%u\n", 1<<7); @@ -54,7 +55,8 @@ static void test_vlq_uint32(void) { assert(out_s == 2); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 2 && n == v); + assert(in_s == 2); + assert(n == v); } printf("%u\n", 1<<14); @@ -64,7 +66,8 @@ static void test_vlq_uint32(void) { assert(out_s == 3); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 3 && n == v); + assert(in_s == 3); + assert(n == v); } printf("%u\n", 1<<21); @@ -74,7 +77,8 @@ static void test_vlq_uint32(void) { assert(out_s == 4); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 4 && n == v); + assert(in_s == 4); + assert(n == v); } printf("%u\n", 1<<28); @@ -84,7 +88,8 @@ static void test_vlq_uint32(void) { assert(out_s == 5); uint32_t n; size_t in_s = tokudb::vlq_decode_ui<uint32_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } } diff --git a/storage/tokudb/tests/vlq_test_uint64.cc b/storage/tokudb/tests/vlq_test_uint64.cc index a626db69487..697c597756c 100644 --- a/storage/tokudb/tests/vlq_test_uint64.cc +++ b/storage/tokudb/tests/vlq_test_uint64.cc @@ -46,7 +46,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 1); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 1 && n == v); + assert(in_s == 1); + assert(n == v); } printf("%u\n", 1<<7); @@ -56,7 +57,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 2); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 2 && n == v); + assert(in_s == 2); + assert(n == v); } printf("%u\n", 1<<14); @@ -66,7 +68,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 3); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 3 && n == v); + assert(in_s == 3); + assert(n == v); } printf("%u\n", 1<<21); @@ -76,7 +79,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 4); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 4 && n == v); + assert(in_s == 4); + assert(n == v); } printf("%u\n", 1<<28); @@ -90,7 +94,8 @@ static void test_vlq_uint64(uint64_t start, uint64_t stride) { assert(out_s == 5); uint64_t n; size_t in_s = tokudb::vlq_decode_ui<uint64_t>(&n, b, out_s); - assert(in_s == 5 && n == v); + assert(in_s == 5); + assert(n == v); } } diff --git a/storage/tokudb/tokudb_buffer.h b/storage/tokudb/tokudb_buffer.h index 022f1b49643..1605543c378 100644 --- a/storage/tokudb/tokudb_buffer.h +++ b/storage/tokudb/tokudb_buffer.h @@ -134,8 +134,8 @@ public: char* data_offset = (char*)m_data + offset; if (new_s != old_s) { size_t n = m_size - (offset + old_s); - assert_always( - offset + new_s + n <= m_limit && offset + old_s + n <= m_limit); + assert_always(offset + new_s + n <= m_limit); + assert_always(offset + old_s + n <= m_limit); memmove(data_offset + new_s, data_offset + old_s, n); if (new_s > old_s) m_size += new_s - old_s; diff --git a/storage/tokudb/tokudb_math.h b/storage/tokudb/tokudb_math.h index 0338bf3871e..99cebd5b1d1 100644 --- a/storage/tokudb/tokudb_math.h +++ b/storage/tokudb/tokudb_math.h @@ -59,7 +59,8 @@ TOKUDB_UNUSED(static uint64_t uint_add( bool* over)); static uint64_t uint_add(uint64_t x, uint64_t y, uint length_bits, bool *over) { uint64_t mask = uint_mask(length_bits); - assert_always((x & ~mask) == 0 && (y & ~mask) == 0); + assert_always((x & ~mask) == 0); + assert_always((y & ~mask) == 0); uint64_t s = (x + y) & mask; *over = s < x; // check for overflow return s; @@ -75,7 +76,8 @@ TOKUDB_UNUSED(static uint64_t uint_sub( bool* over)); static uint64_t uint_sub(uint64_t x, uint64_t y, uint length_bits, bool *over) { uint64_t mask = uint_mask(length_bits); - assert_always((x & ~mask) == 0 && (y & ~mask) == 0); + assert_always((x & ~mask) == 0); + assert_always((y & ~mask) == 0); uint64_t s = (x - y) & mask; *over = s > x; // check for overflow return s; |