1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Added option --read-only (Thanks to Markus Benning)

This commit is contained in:
monty@narttu.mysql.fi
2003-05-19 12:01:38 +03:00
parent a46c0a7cac
commit c01678bc3d
6 changed files with 29 additions and 9 deletions

View File

@@ -1329,6 +1329,18 @@ mysql_execute_command(void)
(table_rules_on && tables && thd->slave_thread &&
!tables_ok(thd,tables)))
DBUG_VOID_RETURN;
/*
When option readonly is set deny operations which change tables.
Except for the replication thread and the 'super' users.
*/
if (opt_readonly &&
!(thd->slave_thread || (thd->master_access & SUPER_ACL)) &&
(uc_update_queries[lex->sql_command] > 0))
{
send_error(&thd->net,ER_CANT_UPDATE_WITH_READLOCK);
DBUG_VOID_RETURN;
}
statistic_increment(com_stat[lex->sql_command],&LOCK_status);
switch (lex->sql_command) {