Current Path : /home/usr.opt/mysql57/mysql-test/suite/x/t/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/x/t/insert_sql_o.test |
########### ../t/insert_sql_o.test ########### ### # ### This test runs aims to run INSERT operation statements with SQL # ### Test covers # ### - insert with different operators # ### - insert multiple rows # ### - insert with rollback transaction # ### # ######################################################################## # --echo ============================================== --echo SQL INSERT SCENARIOS --echo ============================================== --echo ## Preamble --echo ================================================================================ --echo PREAMBLE --echo ================================================================================ --source ../include/xplugin_preamble.inc create user insertsqluser@localhost identified by 'insertsqluser'; grant all on *.* to insertsqluser@localhost; ## TEST STARTS HERE --echo ================================================================================ --echo TEST START --echo ================================================================================ --write_file $MYSQL_TMP_DIR/mysqlx-insert_sql.tmp -->sql DROP SCHEMA if EXISTS mysqlxplugin; CREATE SCHEMA mysqlxplugin; USE mysqlxplugin; CREATE TABLE Categories ( CategoryID int NOT NULL AUTO_INCREMENT, CategoryName varchar(100), CategoryDescription varchar(200), CategoryIMEI tinyint, CategoryDecimal decimal(5,2), PRIMARY key (CategoryID) ); INSERT into Categories values (1,'Sports','Sports related category',1,235.15); START TRANSACTION; INSERT into Categories values (20,'Sports','Sports related category',1,235.15); SELECT * FROM Categories; ROLLBACK; SELECT * FROM Categories; INSERT into Categories values (2,'Entertaiment','Entertaiment related category',2,235.15); INSERT INTO Categories (CategoryID, CategoryName, CategoryDescription, CategoryIMEI, CategoryDecimal) VALUES (7, 'Videogames1','Videogames1 related category',7,235.15), (8, 'Videogames2','Videogames2 related category',8,235.15), (9, 'Videogames3','Videogames3 related category',9,235.15), (10, 'Videogames4','Videogames4 related category',10,235.15); ## Corner Values ## Insert Quotes INSERT into Categories values (3,'"Quotes"','Quote Categories',3,235.15); ## Insert NULL values INSERT into Categories values (NULL,NULL,NULL,NULL,NULL); ## Insert Corner decimal value INSERT into Categories values (6,'Kitchen','Kitchen related category',6,999.99); INSERT into Categories values (12,'Kitchen','Kitchen related category',11,-999.99); ## Insert Corner tiny int value INSERT into Categories values (13,'Kitchen','Kitchen related category',127,156.99); INSERT into Categories values (14,'Kitchen','Kitchen related category',-128,156.99); -->endsql EOF --exec $MYSQLXTEST -u insertsqluser --password='insertsqluser' --file=$MYSQL_TMP_DIR/mysqlx-insert_sql.tmp 2>&1 --remove_file $MYSQL_TMP_DIR/mysqlx-insert_sql.tmp --echo . --echo #---------- START NEGATIVE TEST ----------# --echo . ## ****************************************** ## 2. Negative Test starts here | ## | ## ****************************************** --write_file $MYSQL_TMP_DIR/mysqlx-insert_sql_negative.tmp -->sql USE mysqlxplugin; ## Negative Testing ## Missing insert parameter -->endsql -->expecterror 1136 -->sql INSERT into Categories values (3,'Home'); ## Repeat ID -->endsql -->expecterror 1062 -->sql INSERT into Categories values (1,'Home','Home related category',1,235.15); ## Correspondence between data and field types -->endsql -->expecterror 1366 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category','TinyInt',999.00); -->endsql -->expecterror 1366 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category',4,'Decimal'); ## Data types corner value plus 1 -->endsql -->expecterror 1264 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category',4,1000.00); -->endsql -->expecterror 1264 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category',4,-1000.00); -->endsql -->expecterror 1264 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category',128,999.00); -->endsql -->expecterror 1264 -->sql INSERT into Categories values ('5','Kitchen','Kitchen related category',-129,999.00); -->endsql ## Cleanup -->echo ================================================================================ -->echo CLEAN UP -->echo ================================================================================ -->sql DROP SCHEMA if EXISTS mysqlxplugin; DROP USER insertsqluser@localhost; -->endsql EOF --exec $MYSQLXTEST -u insertsqluser --password='insertsqluser' --file=$MYSQL_TMP_DIR/mysqlx-insert_sql_negative.tmp 2>&1 --remove_file $MYSQL_TMP_DIR/mysqlx-insert_sql_negative.tmp ## Postamble --echo ================================================================================ --echo POSTAMBLE --echo ================================================================================ uninstall plugin mysqlx;