@@ -18,7 +18,6 @@ import (
1818 "math"
1919
2020 "github.com/dolthub/go-mysql-server/sql"
21- "github.com/dolthub/go-mysql-server/sql/plan"
2221 "github.com/dolthub/go-mysql-server/sql/types"
2322)
2423
@@ -661,267 +660,3 @@ var VariableErrorTests = []QueryErrorTest{
661660 ExpectedErr : sql .ErrSyntaxError ,
662661 },
663662}
664-
665- var StatusVariableScripts = []ScriptTest {
666- {
667- Name : "Com_delete" ,
668- SetUpScript : []string {
669- "create table t (i int primary key)" ,
670- "insert into t values (1), (2), (3)" ,
671- },
672- Assertions : []ScriptTestAssertion {
673- {
674- Query : "show status like 'Com_delete'" ,
675- Expected : []sql.Row {
676- {"Com_delete" , uint64 (0 )},
677- },
678- },
679- {
680- // syntax errors do not trigger the status variable
681- Query : "delete abc" ,
682- ExpectedErrStr : "syntax error at position 11 near 'abc'" ,
683- },
684- {
685- Query : "show status like 'Com_delete'" ,
686- Expected : []sql.Row {
687- {"Com_delete" , uint64 (0 )},
688- },
689- },
690-
691- {
692- // delete 1 row
693- Query : "delete from t where i = 1" ,
694- Expected : []sql.Row {
695- {types .NewOkResult (1 )},
696- },
697- },
698- {
699- Query : "show status like 'Com_delete'" ,
700- Expected : []sql.Row {
701- {"Com_delete" , uint64 (1 )},
702- },
703- },
704-
705- {
706- // delete 2 rows
707- Query : "delete from t where i > 0" ,
708- Expected : []sql.Row {
709- {types .NewOkResult (2 )},
710- },
711- },
712- {
713- Query : "show status like 'Com_delete'" ,
714- Expected : []sql.Row {
715- {"Com_delete" , uint64 (2 )},
716- },
717- },
718-
719- {
720- // delete 0 rows
721- Query : "delete from t where false" ,
722- Expected : []sql.Row {
723- {types .NewOkResult (0 )},
724- },
725- },
726- {
727- Query : "show status like 'Com_delete'" ,
728- Expected : []sql.Row {
729- {"Com_delete" , uint64 (3 )},
730- },
731- },
732-
733- {
734- Query : "delete from t where notarealcolumn > 0" ,
735- ExpectedErr : sql .ErrColumnNotFound ,
736- },
737- {
738- Query : "show status like 'Com_delete'" ,
739- Expected : []sql.Row {
740- {"Com_delete" , uint64 (4 )},
741- },
742- },
743-
744- {
745- Query : "delete from notarealtable" ,
746- ExpectedErr : sql .ErrTableNotFound ,
747- },
748- {
749- Query : "show status like 'Com_delete'" ,
750- Expected : []sql.Row {
751- {"Com_delete" , uint64 (5 )},
752- },
753- },
754- },
755- },
756- {
757- Name : "Com_insert" ,
758- SetUpScript : []string {
759- "create table t (i int primary key)" ,
760- },
761- Assertions : []ScriptTestAssertion {
762- {
763- Query : "show status like 'Com_insert'" ,
764- Expected : []sql.Row {
765- {"Com_insert" , uint64 (0 )},
766- },
767- },
768-
769- {
770- Query : "insert syntax error" ,
771- ExpectedErrStr : "syntax error at position 20 near 'error'" ,
772- },
773- {
774- Query : "show status like 'Com_insert'" ,
775- Expected : []sql.Row {
776- {"Com_insert" , uint64 (0 )},
777- },
778- },
779-
780- {
781- Query : "insert into t values (1)" ,
782- Expected : []sql.Row {
783- {types .NewOkResult (1 )},
784- },
785- },
786- {
787- Query : "show status like 'Com_insert'" ,
788- Expected : []sql.Row {
789- {"Com_insert" , uint64 (1 )},
790- },
791- },
792-
793- {
794- Query : "insert into t values (2), (3)" ,
795- Expected : []sql.Row {
796- {types .NewOkResult (2 )},
797- },
798- },
799- {
800- Query : "show status like 'Com_insert'" ,
801- Expected : []sql.Row {
802- {"Com_insert" , uint64 (2 )},
803- },
804- },
805-
806- {
807- Query : "insert into faketable values (2), (3)" ,
808- ExpectedErr : sql .ErrTableNotFound ,
809- },
810- {
811- Query : "show status like 'Com_insert'" ,
812- Expected : []sql.Row {
813- {"Com_insert" , uint64 (3 )},
814- },
815- },
816-
817- {
818- Query : "insert into t values (1)" ,
819- ExpectedErr : sql .ErrPrimaryKeyViolation ,
820- },
821- {
822- Query : "show status like 'Com_insert'" ,
823- Expected : []sql.Row {
824- {"Com_insert" , uint64 (4 )},
825- },
826- },
827-
828- {
829- Query : "insert into t(bad) values (1)" ,
830- ExpectedErr : sql .ErrUnknownColumn ,
831- },
832- {
833- Query : "show status like 'Com_insert'" ,
834- Expected : []sql.Row {
835- {"Com_insert" , uint64 (5 )},
836- },
837- },
838- },
839- },
840- {
841- Name : "Com_update" ,
842- SetUpScript : []string {
843- "create table t (i int primary key)" ,
844- "insert into t values (1), (2), (3)" ,
845- },
846- Assertions : []ScriptTestAssertion {
847- {
848- Query : "show status like 'Com_update'" ,
849- Expected : []sql.Row {
850- {"Com_update" , uint64 (0 )},
851- },
852- },
853-
854- {
855- Query : "update t abc" ,
856- ExpectedErrStr : "syntax error at position 13 near 'abc'" ,
857- },
858- {
859- Query : "show status like 'Com_update'" ,
860- Expected : []sql.Row {
861- {"Com_update" , uint64 (0 )},
862- },
863- },
864-
865- {
866- Query : "update t set i = 10 where i = 1" ,
867- Expected : []sql.Row {
868- {types.OkResult {RowsAffected : 1 , Info : plan.UpdateInfo {Matched : 1 , Updated : 1 }}},
869- },
870- },
871- {
872- Query : "show status like 'Com_update'" ,
873- Expected : []sql.Row {
874- {"Com_update" , uint64 (1 )},
875- },
876- },
877-
878- {
879- Query : "update t set i = i * 10 where i < 10" ,
880- Expected : []sql.Row {
881- {types.OkResult {RowsAffected : 2 , Info : plan.UpdateInfo {Matched : 2 , Updated : 2 }}},
882- },
883- },
884- {
885- Query : "show status like 'Com_update'" ,
886- Expected : []sql.Row {
887- {"Com_update" , uint64 (2 )},
888- },
889- },
890-
891- {
892- Query : "update t set i = 1000 where false" ,
893- Expected : []sql.Row {
894- {types.OkResult {Info : plan.UpdateInfo {}}},
895- },
896- },
897- {
898- Query : "show status like 'Com_update'" ,
899- Expected : []sql.Row {
900- {"Com_update" , uint64 (3 )},
901- },
902- },
903-
904- {
905- Query : "update badtbl set i = 1000" ,
906- ExpectedErr : sql .ErrTableNotFound ,
907- },
908- {
909- Query : "show status like 'Com_update'" ,
910- Expected : []sql.Row {
911- {"Com_update" , uint64 (4 )},
912- },
913- },
914-
915- {
916- Query : "update t set badcol = 1000" ,
917- ExpectedErr : sql .ErrColumnNotFound ,
918- },
919- {
920- Query : "show status like 'Com_update'" ,
921- Expected : []sql.Row {
922- {"Com_update" , uint64 (5 )},
923- },
924- },
925- },
926- },
927- }
0 commit comments