mirror of
https://github.com/MariaDB/server.git
synced 2025-01-27 01:04:19 +01:00
6b27acbdf4
Now it supports queries returning several results (particularly important with the SP) include/mysql.h: embedded_query_result structure added libmysql/libmysql.c: embedded-server related fixes libmysqld/emb_qcache.cc: multiple-result support added libmysqld/embedded_priv.h: embedded_query_result struct implemented libmysqld/lib_sql.cc: multiple-result support added libmysqld/libmysqld.c: small fixes mysql-test/t/backup.test: test fixed mysql-test/t/binlog_stm_binlog.test: test fixed mysql-test/t/binlog_stm_blackhole.test: test fixed mysql-test/t/binlog_stm_ctype_cp932.test: test fixed mysql-test/t/compress.test: test fixed mysql-test/t/delayed.test: test fixed mysql-test/t/federated.test: test fixed mysql-test/t/federated_archive.test: test fixed mysql-test/t/federated_bug_13118.test: test fixed mysql-test/t/federated_transactions.test: test fixed mysql-test/t/flush_table.test: test fixed mysql-test/t/handler.test: test fixed mysql-test/t/init_connect.test: test fixed mysql-test/t/innodb.test: test fixed mysql-test/t/mysql.test: test fixed mysql-test/t/mysql_client_test.test: test fixed mysql-test/t/mysqltest.test: test fixed mysql-test/t/query_cache.test: test fixed mysql-test/t/query_cache_notembedded.test: test fixed mysql-test/t/read_only.test: test fixed mysql-test/t/skip_grants.test: test fixed mysql-test/t/sp-destruct.test: test fixed mysql-test/t/sp-error.test: test fixed mysql-test/t/sp-threads.test: test fixed mysql-test/t/sp.test: test fixed mysql-test/t/view.test: test fixed mysql-test/t/wait_timeout.test: test fixed sql-common/client.c: small fixes sql/mysqld.cc: embedded-server related fix sql/protocol.cc: embedded-server related fix sql/protocol.h: embedded-server related fix sql/sql_class.cc: embedded-server related fix sql/sql_class.h: embedded-server related fix sql/sql_cursor.cc: embedded-server related fix sql/sql_parse.cc: embedded-server related fix sql/sql_prepare.cc: embedded-server related fix
106 lines
2.1 KiB
Text
106 lines
2.1 KiB
Text
# Test of the READ_ONLY global variable:
|
|
# check that it blocks updates unless they are only on temporary tables.
|
|
|
|
# should work with embedded server after mysqltest is fixed
|
|
-- source include/not_embedded.inc
|
|
|
|
--disable_warnings
|
|
DROP TABLE IF EXISTS t1,t2,t3;
|
|
--enable_warnings
|
|
|
|
# READ_ONLY does nothing to SUPER users
|
|
# so we use a non-SUPER one:
|
|
|
|
grant CREATE, SELECT, DROP on *.* to test@localhost;
|
|
|
|
connect (con1,localhost,test,,test);
|
|
|
|
connection default;
|
|
|
|
set global read_only=0;
|
|
|
|
connection con1;
|
|
|
|
create table t1 (a int);
|
|
|
|
insert into t1 values(1);
|
|
|
|
create table t2 select * from t1;
|
|
|
|
connection default;
|
|
|
|
set global read_only=1;
|
|
|
|
# We check that SUPER can:
|
|
|
|
create table t3 (a int);
|
|
drop table t3;
|
|
|
|
connection con1;
|
|
|
|
select @@global.read_only;
|
|
|
|
--error 1290
|
|
create table t3 (a int);
|
|
|
|
--error 1290
|
|
insert into t1 values(1);
|
|
|
|
# if a statement, after parse stage, looks like it will update a
|
|
# non-temp table, it will be rejected, even if at execution it would
|
|
# have turned out that 0 rows would be updated
|
|
--error 1290
|
|
update t1 set a=1 where 1=0;
|
|
|
|
# multi-update is special (see sql_parse.cc) so we test it
|
|
--error 1290
|
|
update t1,t2 set t1.a=t2.a+1 where t1.a=t2.a;
|
|
|
|
# check multi-delete to be sure
|
|
--error 1290
|
|
delete t1,t2 from t1,t2 where t1.a=t2.a;
|
|
|
|
# With temp tables updates should be accepted:
|
|
|
|
create temporary table t3 (a int);
|
|
|
|
create temporary table t4 (a int) select * from t3;
|
|
|
|
insert into t3 values(1);
|
|
|
|
insert into t4 select * from t3;
|
|
|
|
# a non-temp table updated:
|
|
--error 1290
|
|
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
|
|
|
|
# no non-temp table updated (just swapped):
|
|
update t1,t3 set t3.a=t1.a+1 where t1.a=t3.a;
|
|
|
|
update t4,t3 set t4.a=t3.a+1 where t4.a=t3.a;
|
|
|
|
--error 1290
|
|
delete t1 from t1,t3 where t1.a=t3.a;
|
|
|
|
delete t3 from t1,t3 where t1.a=t3.a;
|
|
|
|
delete t4 from t3,t4 where t4.a=t3.a;
|
|
|
|
# and even homonymous ones
|
|
|
|
create temporary table t1 (a int);
|
|
|
|
insert into t1 values(1);
|
|
|
|
update t1,t3 set t1.a=t3.a+1 where t1.a=t3.a;
|
|
|
|
delete t1 from t1,t3 where t1.a=t3.a;
|
|
|
|
drop table t1;
|
|
|
|
--error 1290
|
|
insert into t1 values(1);
|
|
|
|
connection default;
|
|
drop table t1,t2;
|
|
drop user test@localhost;
|