Commit 5dfdc8bf authored by kostja@bodhi.local's avatar kostja@bodhi.local

Manual merge 5.0->5.1. Post-merge fixes.

parent 04c97488
......@@ -1333,7 +1333,7 @@ static uint dump_events_for_db(char *db)
DBUG_ENTER("dump_events_for_db");
DBUG_PRINT("enter", ("db: '%s'", db));
mysql_real_escape_string(sock, db_name_buff, db, strlen(db));
mysql_real_escape_string(mysql, db_name_buff, db, strlen(db));
/* nice comments */
if (opt_comments)
......@@ -1344,9 +1344,9 @@ static uint dump_events_for_db(char *db)
enough privileges to lock mysql.events.
*/
if (lock_tables)
mysql_query(sock, "LOCK TABLES mysql.event READ");
mysql_query(mysql, "LOCK TABLES mysql.event READ");
if (mysql_query_with_error_report(sock, &event_list_res, "show events"))
if (mysql_query_with_error_report(mysql, &event_list_res, "show events"))
{
safe_exit(EX_MYSQLERR);
DBUG_RETURN(0);
......@@ -1362,7 +1362,7 @@ static uint dump_events_for_db(char *db)
my_snprintf(query_buff, sizeof(query_buff), "SHOW CREATE EVENT %s",
event_name);
if (mysql_query_with_error_report(sock, &event_res, query_buff))
if (mysql_query_with_error_report(mysql, &event_res, query_buff))
DBUG_RETURN(1);
while ((row= mysql_fetch_row(event_res)) != NULL)
......@@ -1395,7 +1395,7 @@ static uint dump_events_for_db(char *db)
mysql_free_result(event_list_res);
if (lock_tables)
VOID(mysql_query_with_error_report(sock, 0, "UNLOCK TABLES"));
VOID(mysql_query_with_error_report(mysql, 0, "UNLOCK TABLES"));
DBUG_RETURN(0);
}
......@@ -2738,7 +2738,7 @@ static int dump_all_tablespaces()
char buf[FN_REFLEN];
int first;
if (mysql_query_with_error_report(sock, &tableres,
if (mysql_query_with_error_report(mysql, &tableres,
"SELECT DISTINCT"
" LOGFILE_GROUP_NAME,"
" FILE_NAME,"
......@@ -2792,7 +2792,7 @@ static int dump_all_tablespaces()
}
}
if (mysql_query_with_error_report(sock, &tableres,
if (mysql_query_with_error_report(mysql, &tableres,
"SELECT DISTINCT"
" TABLESPACE_NAME,"
" FILE_NAME,"
......@@ -3035,7 +3035,7 @@ static int dump_all_tables_in_db(char *database)
}
}
if (opt_events && !opt_xml &&
mysql_get_server_version(sock) >= 50106)
mysql_get_server_version(mysql) >= 50106)
{
DBUG_PRINT("info", ("Dumping events for database %s", database));
dump_events_for_db(database);
......@@ -3251,7 +3251,7 @@ static int dump_selected_tables(char *db, char **table_names, int tables)
get_view_structure(*pos, db);
}
if (opt_events && !opt_xml &&
mysql_get_server_version(sock) >= 50106)
mysql_get_server_version(mysql) >= 50106)
{
DBUG_PRINT("info", ("Dumping events for database %s", db));
dump_events_for_db(db);
......
......@@ -106,9 +106,9 @@ set global event_scheduler= 1;
select /*2*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_2*/
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_3*/
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60) /*ee_16407_4*/
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60)
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60)
root localhost events_test Connect User lock select get_lock('ee_16407_2', 60)
select release_lock('ee_16407_2');
release_lock('ee_16407_2')
1
......@@ -154,8 +154,8 @@ set global event_scheduler= 1;
select /*4*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
user host db command state info
event_scheduler localhost NULL Connect Sleeping NULL
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_5*/
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60) /*ee_16407_6*/
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60)
root localhost events_test Connect User lock select get_lock('ee_16407_5', 60)
select release_lock('ee_16407_5');
release_lock('ee_16407_5')
1
......
......@@ -994,13 +994,13 @@ create table t1 select variance(0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`variance(0)` double(8,4) default NULL
`variance(0)` double(8,4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
create table t1 select stddev(0);
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`stddev(0)` double(8,4) default NULL
`stddev(0)` double(8,4) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
--------------------------------------------------------------------
-- 1.1.1.
--------------------------------------------------------------------
Success: the process has been started.
SHOW VARIABLES LIKE 'server_id';
Variable_name Value
server_id 1
SHOW INSTANCES;
instance_name state
mysqld1 online
......@@ -40,10 +39,6 @@ ERROR HY000: Bad instance name. Check that the instance with such a name exists
--------------------------------------------------------------------
-- 1.1.6.
--------------------------------------------------------------------
SHOW INSTANCES;
instance_name state
mysqld1 online
mysqld2 offline
Killing the process...
Sleeping...
Success: the process was restarted.
......
drop database if exists client_test_db;
DROP SCHEMA test;
CREATE SCHEMA test;
use test;
cluster.binlog_index OK
mysql.columns_priv OK
mysql.db OK
......
......@@ -2923,11 +2923,6 @@ grant RELOAD on *.* to mysqltest_1@localhost;
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
mysqldump: Couldn't execute 'SHOW MASTER STATUS': Access denied; you need the SUPER,REPLICATION CLIENT privilege for this operation (1227)
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
CHANGE MASTER TO MASTER_LOG_FILE='master-bin.000001', MASTER_LOG_POS=537;
CREATE TABLE `t1` (
`a` int(11) default NULL,
`b` varchar(34) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
drop table t1;
drop user mysqltest_1;
End of 5.0 tests
......
......@@ -84,7 +84,14 @@ Database: information_schema
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| KEY_COLUMN_USAGE |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
......@@ -105,7 +112,14 @@ Database: INFORMATION_SCHEMA
| COLLATION_CHARACTER_SET_APPLICABILITY |
| COLUMNS |
| COLUMN_PRIVILEGES |
| ENGINES |
| EVENTS |
| FILES |
| KEY_COLUMN_USAGE |
| PARTITIONS |
| PLUGINS |
| PROCESSLIST |
| REFERENTIAL_CONSTRAINTS |
| ROUTINES |
| SCHEMATA |
| SCHEMA_PRIVILEGES |
......
......@@ -474,3 +474,4 @@ a D
1 1
1 4
drop table t1;
End of 5.1 tests
......@@ -749,7 +749,7 @@ f1 f2 f3
222222 bbbbbb 2
drop table t1;
Illegal ndb error code: 1186
Enf of 5.0 tests
End of 5.0 tests
CREATE TABLE t1 (a VARCHAR(255) NOT NULL,
CONSTRAINT pk_a PRIMARY KEY (a))engine=ndb;
CREATE TABLE t2(a VARCHAR(255) NOT NULL,
......@@ -758,3 +758,4 @@ c VARCHAR(255) NOT NULL,
CONSTRAINT pk_b_c_id PRIMARY KEY (b,c),
CONSTRAINT fk_a FOREIGN KEY(a) REFERENCES t1(a))engine=ndb;
drop table t1, t2;
End of 5.1 tests
......@@ -416,7 +416,7 @@ master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t2` (
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t2)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
master-bin.000001 # Query 1 # use `mysqltest1`; CREATE TABLE `t3` (
`1` varbinary(108) NOT NULL DEFAULT ''
`1` varbinary(36) NOT NULL DEFAULT ''
)
master-bin.000001 # Table_map 1 # table_id: # (mysqltest1.t3)
master-bin.000001 # Write_rows 1 # table_id: # flags: STMT_END_F
......
......@@ -80,3 +80,4 @@ c
---> Cleaning up...
DROP VIEW v1;
DROP TABLE t1;
End of 5.0 tests
......@@ -668,6 +668,10 @@ View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1`
DROP PROCEDURE p1;
DROP VIEW v1;
SHOW TABLES FROM no_such_database;
ERROR 42000: Unknown database 'no_such_database'
SHOW COLUMNS FROM no_such_table;
ERROR 42S02: Table 'test.no_such_table' doesn't exist
End of 5.0 tests.
SHOW AUTHORS;
create database mysqltest;
......@@ -692,20 +696,3 @@ Warning 1541 The syntax 'SHOW PLUGIN' is deprecated and will be removed in MySQL
show plugin;
show plugins;
End of 5.1 tests
CREATE PROCEDURE p1()
BEGIN
SET @s= 'CREATE VIEW v1 AS SELECT SQL_CACHE 1';
PREPARE stmt FROM @s;
EXECUTE stmt;
DROP PREPARE stmt;
END |
CALL p1();
SHOW CREATE VIEW v1;
View Create View
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select sql_cache 1 AS `1`
DROP PROCEDURE p1;
DROP VIEW v1;
SHOW TABLES FROM no_such_database;
ERROR 42000: Unknown database 'no_such_database'
SHOW COLUMNS FROM no_such_table;
ERROR 42S02: Table 'test.no_such_table' doesn't exist
......@@ -1187,6 +1187,7 @@ END;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'IF NOT EXISTS bug14702()
BEGIN
END' at line 1
End of 5.0 tests
drop function if exists bug16164;
create function bug16164() returns int
begin
......@@ -1199,3 +1200,4 @@ create function bug20701() returns varchar(25) binary return "test"|
ERROR 42000: This version of MySQL doesn't yet support 'return value collation'
create function bug20701() returns varchar(25) return "test"|
drop function bug20701|
End of 5.1 tests
......@@ -441,6 +441,7 @@ SELECT Host,User,Password FROM mysql.user WHERE User='user19857';
Host User Password
localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C
DROP USER user19857@localhost;
use test;
DROP TABLE IF EXISTS t1;
DROP VIEW IF EXISTS v1;
DROP FUNCTION IF EXISTS f_suid;
......
......@@ -5222,40 +5222,6 @@ CHARSET(p3) COLLATION(p3)
greek greek_general_ci
use test|
DROP DATABASE mysqltest1|
drop procedure if exists bug19862|
CREATE TABLE t11 (a INT)|
CREATE TABLE t12 (a INT)|
CREATE FUNCTION bug19862(x INT) RETURNS INT
BEGIN
INSERT INTO t11 VALUES (x);
RETURN x+1;
END|
INSERT INTO t12 VALUES (1), (2)|
SELECT bug19862(a) FROM t12 ORDER BY 1|
bug19862(a)
2
3
SELECT * FROM t11|
a
1
2
DROP TABLE t11, t12|
DROP FUNCTION bug19862|
drop table if exists t3|
drop database if exists mysqltest1|
create table t3 (a int)|
insert into t3 (a) values (1), (2)|
create database mysqltest1|
use mysqltest1|
drop database mysqltest1|
select database()|
database()
NULL
select * from (select 1 as a) as t1 natural join (select * from test.t3) as t2|
a
1
use test|
drop table t3|
drop table if exists t3|
drop database if exists mysqltest1|
create table t3 (a int)|
......@@ -5290,4 +5256,5 @@ a
2
DROP TABLE t11, t12|
DROP FUNCTION bug19862|
End of 5.0 tests
drop table t1,t2;
......@@ -259,7 +259,7 @@ INSERT INTO t1 (col1) VALUES (CAST('2004-10-15' AS DATE));
INSERT INTO t1 (col2) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col3) VALUES (CAST('2004-10-15 10:15' AS DATETIME));
INSERT INTO t1 (col1) VALUES(CAST('0000-10-31' AS DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CAST('2004-10-0' AS DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('2004-0-10' AS DATE));
......@@ -267,7 +267,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CAST('0000-00-00' AS DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
......@@ -275,7 +275,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME));
......@@ -288,7 +288,7 @@ INSERT INTO t1 (col1) VALUES (CONVERT('2004-10-15',DATE));
INSERT INTO t1 (col2) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col3) VALUES (CONVERT('2004-10-15 10:15',DATETIME));
INSERT INTO t1 (col1) VALUES(CONVERT('0000-10-31' , DATE));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31'
ERROR 22007: Incorrect datetime value: '0000-10-31'
INSERT INTO t1 (col1) VALUES(CONVERT('2004-10-0' , DATE));
ERROR 22007: Incorrect date value: '2004-10-00' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE));
......@@ -296,7 +296,7 @@ ERROR 22007: Incorrect date value: '2004-00-10' for column 'col1' at row 1
INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col2) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col2' at row 1
INSERT INTO t1 (col2) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
......@@ -304,7 +304,7 @@ ERROR 22007: Incorrect datetime value: '2004-00-10 15:30:00' for column 'col2' a
INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME));
ERROR 22007: Incorrect datetime value: '0000-00-00'
INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME));
ERROR 22007: Truncated incorrect datetime value: '0000-10-31 15:30'
ERROR 22007: Incorrect datetime value: '0000-10-31 15:30'
INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME));
ERROR 22007: Incorrect datetime value: '2004-10-00 15:30:00' for column 'col3' at row 1
INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME));
......
......@@ -27,7 +27,7 @@ test.t1 check status OK
delete from t1;
insert into t1 values("000101"),("691231"),("700101"),("991231"),("00000101"),("00010101"),("99991231"),("00101000000"),("691231000000"),("700101000000"),("991231235959"),("10000101000000"),("99991231235959"),("20030100000000"),("20030000000000");
Warnings:
Warning 1264 Out of range value adjusted for column 't' at row 5
Warning 1264 Out of range value for column 't' at row 5
insert into t1 values ("2003-003-03");
insert into t1 values ("20030102T131415"),("2001-01-01T01:01:01"), ("2001-1-1T1:01:01");
select * from t1;
......
......@@ -1318,7 +1318,7 @@ t2 CREATE TABLE `t2` (
`f5` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`f6` varchar(1) CHARACTER SET utf8 DEFAULT NULL,
`f7` text,
`f8` mediumtext character set utf8
`f8` mediumtext CHARACTER SET utf8
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1, t2;
(select avg(1)) union (select avg(1)) union (select avg(1)) union
......
......@@ -11,6 +11,7 @@ drop database if exists client_test_db;
DROP SCHEMA test;
CREATE SCHEMA test;
use test;
#
# Bug #13783 mysqlcheck tries to optimize and analyze information_schema
#
......
......@@ -1318,7 +1318,9 @@ grant RELOAD on *.* to mysqltest_1@localhost;
grant REPLICATION CLIENT on *.* to mysqltest_1@localhost;
# Execute mysqldump, should now succeed
--disable_result_log
--exec $MYSQL_DUMP --compact --master-data -u mysqltest_1 test 2>&1
--enable_result_log
# Clean up
drop table t1;
......
......@@ -720,7 +720,6 @@ DROP USER mysqltest_2@localhost;
DROP DATABASE mysqltest;
#
# Bug#19857 - When a user with CREATE ROUTINE priv creates a routine,
# it results in NULL p/w
......@@ -769,7 +768,7 @@ DROP USER user19857@localhost;
--disconnect con1root
--connection default
use test;
#
# BUG#18630: Arguments of suid routine calculated in wrong security
......
......@@ -1280,7 +1280,7 @@ Field *Item_sum_variance::create_tmp_field(bool group, TABLE *table,
}
else
{
field= new Field_double(max_length, maybe_null,name,table,decimals);
field= new Field_double(max_length, maybe_null,name, decimals);
}
if (field)
field->init(table);
......
......@@ -519,6 +519,8 @@ sp_head::init_sp_name(THD *thd, sp_name *spname)
m_qname.length= spname->m_qname.length;
m_qname.str= strmake_root(thd->mem_root, spname->m_qname.str,
m_qname.length);
DBUG_VOID_RETURN;
}
......@@ -1284,29 +1286,6 @@ sp_head::execute_trigger(THD *thd, const char *db, const char *table,
DBUG_ENTER("sp_head::execute_trigger");
DBUG_PRINT("info", ("trigger %s", m_name.str));
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *save_ctx;
if (sp_change_security_context(thd, this, &save_ctx))
DBUG_RETURN(TRUE);
/*
NOTE: TRIGGER_ACL should be used here.
*/
if (check_global_access(thd, SUPER_ACL))
{
sp_restore_security_context(thd, save_ctx);
DBUG_RETURN(TRUE);
}
/*
Fetch information about table-level privileges to GRANT_INFO
structure for subject table. Check of privileges that will use it
and information about column-level privileges will happen in
Item_trigger_field::fix_fields().
*/
fill_effective_table_privileges(thd, grant_info, db, table);
#endif // NO_EMBEDDED_ACCESS_CHECKS
/*
Prepare arena and memroot for objects which lifetime is whole
duration of trigger call (sp_rcontext, it's tables and items,
......@@ -1339,9 +1318,6 @@ sp_head::execute_trigger(THD *thd, const char *db, const char *table,
err_with_cleanup:
thd->restore_active_arena(&call_arena, &backup_arena);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, save_ctx);
#endif // NO_EMBEDDED_ACCESS_CHECKS
delete nctx;
call_arena.free_items();
free_root(&call_mem_root, MYF(0));
......@@ -1810,6 +1786,7 @@ sp_head::reset_lex(THD *thd)
sublex->ptr= oldlex->ptr;
sublex->end_of_query= oldlex->end_of_query;
sublex->tok_start= oldlex->tok_start;
sublex->tok_end= oldlex->tok_end;
sublex->yylineno= oldlex->yylineno;
/* And keep the SP stuff too */
sublex->sphead= oldlex->sphead;
......@@ -1845,6 +1822,7 @@ sp_head::restore_lex(THD *thd)
// Update some state in the old one first
oldlex->ptr= sublex->ptr;
oldlex->tok_end= sublex->tok_end;
oldlex->next_state= sublex->next_state;
oldlex->trg_table_fields.push_back(&sublex->trg_table_fields);
......
......@@ -530,10 +530,12 @@ bool load_db_opt_by_name(THD *thd, const char *db_name,
{
char db_opt_path[FN_REFLEN];
strxnmov(db_opt_path, sizeof (db_opt_path) - 1, mysql_data_home, "/",
db_name, "/", MY_DB_OPT_FILE, NullS);
unpack_filename(db_opt_path, db_opt_path);
/*
Pass an empty file name, and the database options file name as extension
to avoid table name to file name encoding.
*/
(void) build_table_filename(db_opt_path, sizeof(db_opt_path),
db_name, "", MY_DB_OPT_FILE);
return load_db_opt(thd, db_opt_path, db_create_info);
}
......@@ -1726,8 +1728,8 @@ bool check_db_dir_existence(const char *db_name)
char db_dir_path[FN_REFLEN];
uint db_dir_path_len;
db_dir_path_length= build_table_filename(path, sizeof(path),
db_name, "", "", 0);
db_dir_path_len= build_table_filename(db_dir_path, sizeof(db_dir_path),
db_name, "", "");
if (db_dir_path_len && db_dir_path[db_dir_path_len - 1] == FN_LIBCHAR)
db_dir_path[db_dir_path_len - 1]= 0;
......
......@@ -1077,7 +1077,7 @@ int MYSQLlex(void *arg, void *yythd)
Pointer to the last non-comment symbol of the statement.
*/
uchar *skip_rear_comments(uchar *begin, uchar *end)
const uchar *skip_rear_comments(const uchar *begin, const uchar *end)
{
while (begin < end && (end[-1] <= ' ' || end[-1] == '*' ||
end[-1] == '/' || end[-1] == ';'))
......
......@@ -1190,6 +1190,6 @@ extern void lex_free(void);
extern void lex_start(THD *thd, const uchar *buf, uint length);
extern void lex_end(LEX *lex);
extern int MYSQLlex(void *arg, void *yythd);
extern uchar *skip_rear_comments(uchar *begin, uchar *end);
extern const uchar *skip_rear_comments(const uchar *ubegin, const uchar *uend);
#endif /* MYSQL_SERVER */
......@@ -716,22 +716,6 @@ bool mysqld_show_create_db(THD *thd, char *dbname,
}
else
{
(void) sprintf(path,"%s/%s",mysql_data_home, dbname);
length=unpack_dirname(path,path); // Convert if not unix
found_libchar= 0;
if (length && path[length-1] == FN_LIBCHAR)
{
found_libchar= 1;
path[length-1]=0; // remove ending '\'
}
if (access(path,F_OK))
length= build_table_filename(path, sizeof(path), dbname, "", "");
found_libchar= 0;
if (length && path[length-1] == FN_LIBCHAR)
{
found_libchar= 1;
path[length-1]=0; // remove ending '\'
}
if (check_db_dir_existence(dbname))
{
my_error(ER_BAD_DB_ERROR, MYF(0), dbname);
......@@ -2603,7 +2587,7 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
may have dropped database, and we may still have a name
for that directory.
*/
if (res == FIND_FILES_DIR && lex->orig_sql_command == SQLCOM_END)
if (res == FIND_FILES_DIR && lex->sql_command == SQLCOM_END)
{
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
......
......@@ -1499,12 +1499,47 @@ bool Table_triggers_list::process_triggers(THD *thd, trg_event_type event,
new_field= record1_field;
old_field= table->field;
}
#ifndef NO_EMBEDDED_ACCESS_CHECKS
Security_context *save_ctx;
if (sp_change_security_context(thd, sp_trigger, &save_ctx))
return TRUE;
/*
Fetch information about table-level privileges to GRANT_INFO structure for
subject table. Check of privileges that will use it and information about
column-level privileges will happen in Item_trigger_field::fix_fields().
*/
fill_effective_table_privileges(thd,
&subject_table_grants[event][time_type],
table->s->db.str, table->s->table_name.str);
/* Check that the definer has TRIGGER privilege on the subject table. */
if (!(subject_table_grants[event][time_type].privilege & TRIGGER_ACL))
{
char priv_desc[128];
get_privilege_desc(priv_desc, sizeof(priv_desc), TRIGGER_ACL);
my_error(ER_TABLEACCESS_DENIED_ERROR, MYF(0), priv_desc,
thd->security_ctx->priv_user, thd->security_ctx->host_or_ip,
table->s->table_name.str);
sp_restore_security_context(thd, save_ctx);
return TRUE;
}
#endif // NO_EMBEDDED_ACCESS_CHECKS
thd->reset_sub_statement_state(&statement_state, SUB_STMT_TRIGGER);
err_status= sp_trigger->execute_trigger
(thd, table->s->db, table->s->table_name,
(thd, table->s->db.str, table->s->table_name.str,
&subject_table_grants[event][time_type]);
thd->restore_sub_statement_state(&statement_state);
#ifndef NO_EMBEDDED_ACCESS_CHECKS
sp_restore_security_context(thd, save_ctx);
#endif // NO_EMBEDDED_ACCESS_CHECKS
}
return err_status;
......
......@@ -648,6 +648,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
char md5[MD5_BUFF_LENGTH];
bool can_be_merged;
char dir_buff[FN_REFLEN], file_buff[FN_REFLEN], path_buff[FN_REFLEN];
const uchar *endp;
LEX_STRING dir, file, path;
DBUG_ENTER("mysql_register_view");
......@@ -731,10 +732,9 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
view->query.str= (char*)str.ptr();
view->query.length= str.length()-1; // we do not need last \0
view->source.str= thd->query + thd->lex->create_view_select_start;
view->source.length= (char *)skip_rear_comments((uchar *)view->source.str,
(uchar *)thd->query +
thd->query_length) -
view->source.str;
endp= (uchar*) view->source.str;
endp= skip_rear_comments(endp, (uchar*) (thd->query + thd->query_length));
view->source.length= endp - (uchar*) view->source.str;
view->file_version= 1;
view->calc_md5(md5);
view->md5.str= md5;
......
......@@ -1530,7 +1530,7 @@ ev_sql_stmt:
{
sp_head *sp= lex->sphead;
// return back to the original memory root ASAP
sp->init_strings(YYTHD, lex, NULL);
sp->init_strings(YYTHD, lex);
sp->restore_thd_mem_root(YYTHD);
lex->sp_chistics.suid= SP_IS_SUID;//always the definer!
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment