@@ -3059,45 +3059,6 @@ void handler::adjust_next_insert_id_after_explicit_value(ulonglong nr)
30593059}
30603060
30613061
3062- /* * @brief
3063- Computes the largest number X:
3064- - smaller than or equal to "nr"
3065- - of the form: auto_increment_offset + N * auto_increment_increment
3066- where N>=0.
3067-
3068- SYNOPSIS
3069- prev_insert_id
3070- nr Number to "round down"
3071- variables variables struct containing auto_increment_increment and
3072- auto_increment_offset
3073-
3074- RETURN
3075- The number X if it exists, "nr" otherwise.
3076- */
3077- inline ulonglong
3078- prev_insert_id (ulonglong nr, struct system_variables *variables)
3079- {
3080- if (unlikely (nr < variables->auto_increment_offset ))
3081- {
3082- /*
3083- There's nothing good we can do here. That is a pathological case, where
3084- the offset is larger than the column's max possible value, i.e. not even
3085- the first sequence value may be inserted. User will receive warning.
3086- */
3087- DBUG_PRINT (" info" ,(" auto_increment: nr: %lu cannot honour "
3088- " auto_increment_offset: %lu" ,
3089- (ulong) nr, variables->auto_increment_offset ));
3090- return nr;
3091- }
3092- if (variables->auto_increment_increment == 1 )
3093- return nr; // optimization of the formula below
3094- nr= (((nr - variables->auto_increment_offset )) /
3095- (ulonglong) variables->auto_increment_increment );
3096- return (nr * (ulonglong) variables->auto_increment_increment +
3097- variables->auto_increment_offset );
3098- }
3099-
3100-
31013062/* *
31023063 Update the auto_increment field if necessary.
31033064
0 commit comments