summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorunknown <monty@narttu.mysql.fi>2003-05-19 12:01:38 +0300
committerunknown <monty@narttu.mysql.fi>2003-05-19 12:01:38 +0300
commit18dd37b8a101dab654a896eabd9e73bc71aed8ca (patch)
treeb1314e66378a9b302524b86c567ccb38a119223a /sql/sql_parse.cc
parent43d371409589e835779a6236050ce92bb7344dae (diff)
downloadmariadb-git-18dd37b8a101dab654a896eabd9e73bc71aed8ca.tar.gz
Added option --read-only (Thanks to Markus Benning)
myisam/myisamchk.c: Removed warning from fulltext when repairing many tables with fulltext index sql/init.cc: Remove not used variables sql/mysql_priv.h: Remove not used variables sql/mysqld.cc: Removed not used variables Added option --read-only Change opt_do_pstack and master_ssl to get them to work with my_getopt sql/set_var.cc: Option --read-only sql/sql_parse.cc: Option --read-only
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index e69d260bf11..d9060b4b26e 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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) {