mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
Bug fixes, TRUNCATE, safer passwords on command line and connect timeout
Docs/manual.texi: Update of safe_mysqld, TRUNCATE and changes for 3.23.28 client/mysql.cc: Added --timeout client/mysqladmin.c: Safer password handling client/mysqldump.c: Safer password handling client/mysqlimport.c: Safer password handling client/mysqlshow.c: Safer password handling configure.in: Fixes for Darwin and added test of poll include/my_pthread.h: Fixes for darwin include/violite.h: Added test for polling libmysql/libmysql.c: connect timeout libmysql/violite.c: connect timeout mysys/hash.c: Fix when delting from empty table scripts/safe_mysqld.sh: Added --open-files, --core-file-size and --timezone sql-bench/bench-init.pl.sh: Function print_time sql-bench/crash-me.sh: Added test of truncate sql-bench/test-insert.sh: More "estimated" tests sql-bench/test-select.sh: More "estimated" tests sql/filesort.cc: Removed allocation of extra memory sql/ha_berkeley.cc: Better estimation of number of rows sql/item_create.cc: Truncate sql/item_create.h: Truncate sql/item_strfunc.cc: Removed usage of MY_FAE sql/lex.h: Truncate sql/lock.cc: Fixed possible loop bug sql/log.cc: Removed usage of FILE:s sql/mysqld.cc: Print of more server variables sql/sql_class.h: Changed FILE -> File sql/sql_insert.cc: Fixed bug in temptable handling sql/sql_lex.h: Cleanup sql/sql_load.cc: Removed usage of MY_FAE sql/sql_parse.cc: Cleanup + TRUNCATE sql/sql_select.cc: Cleanup + fix for INSERT ... SELECT sql/sql_yacc.yy: TRUNCATE sql/violite.c: Merge with client/violite.c strings/strstr-sparc.s: Fixed wrong register usage
This commit is contained in:
@@ -71,6 +71,20 @@ static void init_signals(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline bool end_active_trans(THD *thd)
|
||||
{
|
||||
if (!(thd->options & OPTION_AUTO_COMMIT) ||
|
||||
(thd->options & OPTION_BEGIN))
|
||||
{
|
||||
if (ha_commit(thd))
|
||||
return 1;
|
||||
thd->options&= ~OPTION_BEGIN;
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** Check if user is ok
|
||||
** Updates:
|
||||
@@ -1143,7 +1157,7 @@ mysql_execute_command(void)
|
||||
}
|
||||
}
|
||||
/* ALTER TABLE ends previous transaction */
|
||||
if (!(thd->options & OPTION_AUTO_COMMIT) && ha_commit(thd))
|
||||
if (end_active_trans(thd))
|
||||
res= -1;
|
||||
else
|
||||
res= mysql_alter_table(thd, lex->db, lex->name,
|
||||
@@ -1347,6 +1361,7 @@ mysql_execute_command(void)
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DELETE:
|
||||
case SQLCOM_TRUNCATE:
|
||||
{
|
||||
if (check_access(thd,DELETE_ACL,tables->db,&tables->grant.privilege))
|
||||
goto error; /* purecov: inspected */
|
||||
@@ -1354,11 +1369,12 @@ mysql_execute_command(void)
|
||||
goto error;
|
||||
// Set privilege for the WHERE clause
|
||||
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||
res = mysql_delete(thd,tables,lex->where,lex->select_limit,
|
||||
lex->lock_option, lex->options);
|
||||
#ifdef DELETE_ITEMS
|
||||
delete lex->where;
|
||||
#endif
|
||||
/* TRUNCATE ends previous transaction */
|
||||
if (lex->sql_command == SQLCOM_TRUNCATE && end_active_trans(thd))
|
||||
res= -1;
|
||||
else
|
||||
res = mysql_delete(thd,tables,lex->where,lex->select_limit,
|
||||
lex->lock_option, lex->options);
|
||||
break;
|
||||
}
|
||||
case SQLCOM_DROP_TABLE:
|
||||
@@ -1699,6 +1715,11 @@ mysql_execute_command(void)
|
||||
thd->server_status|= SERVER_STATUS_IN_TRANS;
|
||||
break;
|
||||
case SQLCOM_COMMIT:
|
||||
/*
|
||||
We don't use end_active_trans() here to ensure that this works
|
||||
even if there is a problem with the OPTION_AUTO_COMMIT flag
|
||||
(Which of course should never happen...)
|
||||
*/
|
||||
thd->options&= ~OPTION_BEGIN;
|
||||
thd->server_status&= ~SERVER_STATUS_IN_TRANS;
|
||||
if (!ha_commit(thd))
|
||||
|
Reference in New Issue
Block a user