1import sys 2def main(): 3 print "source include/have_tokudb.inc;" 4 print "# this test is generated by change_text.py" 5 print "# generate hot text expansion test cases" 6 print "--disable_warnings" 7 print "DROP TABLE IF EXISTS t;" 8 print "--enable_warnings" 9 print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";" 10 print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;" 11 gen_tests([ "TINY", "", "MEDIUM", "LONG" ], [ "NULL", "NOT NULL"]) 12 return 0 13def gen_tests(base_types, null_types): 14 for from_index in range(len(base_types)): 15 for to_index in range(len(base_types)): 16 for from_null in range(len(null_types)): 17 for to_null in range(len(null_types)): 18 print "CREATE TABLE t (a %sTEXT %s);" % (base_types[from_index], null_types[from_null]) 19 print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" 20 print "--error ER_UNSUPPORTED_EXTENSION" 21 print "ALTER TABLE t CHANGE COLUMN a a %sBLOB %s;" % (base_types[to_index], null_types[to_null]); 22 if from_null != to_null or from_index > to_index: 23 print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" 24 print "--error ER_UNSUPPORTED_EXTENSION" 25 print "ALTER TABLE t CHANGE COLUMN a a %sTEXT %s;" % (base_types[to_index], null_types[to_null]); 26 print "DROP TABLE t;" 27 28sys.exit(main()) 29