MCPcopy Create free account
hub / github.com/MariaDB/server / sequence_structure

Function sequence_structure

sql/sql_sequence.cc:45–76  ·  view source on GitHub ↗

Structure for SEQUENCE tables of a certain value type @param in handler The handler of a sequence value type @return The sequence table structure given the value type */

Source from the content-addressed store, hash-verified

43 @return The sequence table structure given the value type
44*/
45Sequence_row_definition sequence_structure(const Type_handler* handler)
46{
47 /*
48 We don't really care about src because it is unused in
49 max_display_length_for_field().
50 */
51 const Conv_source src(handler, 0, system_charset_info);
52 const uint32 len= handler->max_display_length_for_field(src) + 1;
53 const LEX_CSTRING empty= {STRING_WITH_LEN("")};
54 const uint flag_unsigned= handler->is_unsigned() ? UNSIGNED_FLAG : 0;
55#define FNND (NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG)
56#define FNNDFU (NOT_NULL_FLAG | NO_DEFAULT_VALUE_FLAG | flag_unsigned)
57 return {{{"next_not_cached_value", len, handler, empty, FNNDFU},
58 {"minimum_value", len, handler, empty, FNNDFU},
59 {"maximum_value", len, handler, empty, FNNDFU},
60 {"start_value", len, handler,
61 {STRING_WITH_LEN("start value when sequences is created or value "
62 "if RESTART is used")}, FNNDFU},
63 {"increment", 21, &type_handler_slonglong,
64 {STRING_WITH_LEN("increment value")}, FNND},
65 {"cache_size", 21, &type_handler_ulonglong, empty,
66 FNND | UNSIGNED_FLAG},
67 {"cycle_option", 1, &type_handler_utiny,
68 {STRING_WITH_LEN("0 if no cycles are allowed, 1 if the sequence "
69 "should begin a new cycle when maximum_value is "
70 "passed")}, FNND | UNSIGNED_FLAG},
71 {"cycle_count", 21, &type_handler_slonglong,
72 {STRING_WITH_LEN("How many cycles have been done")}, FNND},
73 {NULL, 0, &type_handler_slonglong, {STRING_WITH_LEN("")}, 0}}};
74#undef FNNDFU
75#undef FNND
76}
77
78/**
79 Whether a type is allowed as a sequence value type.

Callers 2

check_sequence_fieldsFunction · 0.85

Calls 2

is_unsignedMethod · 0.45

Tested by

no test coverage detected