From 36ae8846ca86bc82900f8c1b2bbad2666a3e9945 Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 3 Jun 2017 16:08:23 +0300 Subject: Fixed sequences based on comments from Peter Gulutzan and Andrii Nikitin - Changed names of SEQUENCE table columns to be more close to ANSI - Fixed error message for SHOW SEQUENCE non_existing_sequence - Allow syntax CACHE +1 - Fixed ALTER TABLE for TEMPORARY sequences. --- sql/sql_sequence.cc | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'sql/sql_sequence.cc') diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc index 35792bfe72e..be360c59e34 100644 --- a/sql/sql_sequence.cc +++ b/sql/sql_sequence.cc @@ -47,18 +47,19 @@ struct Field_definition static Field_definition sequence_structure[]= { - {"next_value", 21, &type_handler_longlong, {STRING_WITH_LEN("next not cached value")}, - FL}, - {"min_value", 21, &type_handler_longlong, {STRING_WITH_LEN("min value")}, FL}, - {"max_value", 21, &type_handler_longlong, {STRING_WITH_LEN("max value")}, FL}, - {"start", 21, &type_handler_longlong, {STRING_WITH_LEN("start value")}, FL}, + {"next_not_cached_value", 21, &type_handler_longlong, + {STRING_WITH_LEN("")}, FL}, + {"minimum_value", 21, &type_handler_longlong, STRING_WITH_LEN(""), FL}, + {"maximum_value", 21, &type_handler_longlong, STRING_WITH_LEN(""), FL}, + {"start_value", 21, &type_handler_longlong, {STRING_WITH_LEN("start value when sequences is created or value if RESTART is used")}, FL}, {"increment", 21, &type_handler_longlong, {C_STRING_WITH_LEN("increment value")}, FL}, - {"cache", 21, &type_handler_longlong, {STRING_WITH_LEN("cache size")}, FL}, - {"cycle", 1, &type_handler_tiny, {STRING_WITH_LEN("cycle state")}, + {"cache_size", 21, &type_handler_longlong, STRING_WITH_LEN(""), + FL | UNSIGNED_FLAG}, + {"cycle_option", 1, &type_handler_tiny, {STRING_WITH_LEN("0 if no cycles are allowed, 1 if the sequence should begin a new cycle when maximum_value is passed")}, FL | UNSIGNED_FLAG }, - {"round", 21, &type_handler_longlong, - {STRING_WITH_LEN("How many cycles has been done")}, FL}, + {"cycle_count", 21, &type_handler_longlong, + {STRING_WITH_LEN("How many cycles have been done")}, FL}, {NULL, 0, &type_handler_longlong, {STRING_WITH_LEN("")}, 0} }; @@ -458,9 +459,12 @@ int SEQUENCE::read_initial_values(TABLE *table_arg) DBUG_RETURN(error); } + /* - Read data from sequence table and update values - Done when table is opened + Do the actiual reading of data from sequence table and + update values in the sequence object. + + Called once from when table is opened */ int SEQUENCE::read_stored_values() -- cgit v1.2.1