import sys def main(): print "# this test is generated by change_text.py" print "# generate hot text expansion test cases" print "--disable_warnings" print "DROP TABLE IF EXISTS t;" print "--enable_warnings" print "SET SESSION DEFAULT_STORAGE_ENGINE=\"TokuDB\";" print "SET SESSION TOKUDB_DISABLE_SLOW_ALTER=1;" gen_tests([ "TINY", "", "MEDIUM", "LONG" ], [ "NULL", "NOT NULL"]) return 0 def gen_tests(base_types, null_types): for from_index in range(len(base_types)): for to_index in range(len(base_types)): for from_null in range(len(null_types)): for to_null in range(len(null_types)): print "CREATE TABLE t (a %sTEXT %s);" % (base_types[from_index], null_types[from_null]) print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" print "--error ER_UNSUPPORTED_EXTENSION" print "ALTER TABLE t CHANGE COLUMN a a %sBLOB %s;" % (base_types[to_index], null_types[to_null]); # if from_null != to_null or from_index > to_index if from_null != to_null or from_index != to_index: print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" print "--error ER_UNSUPPORTED_EXTENSION" print "ALTER TABLE t CHANGE COLUMN a a %sTEXT %s;" % (base_types[to_index], null_types[to_null]); print "DROP TABLE t;" sys.exit(main())