Skip to content

Commit

Permalink
dead code prev_insert_id()
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova authored and kevgs committed Dec 28, 2017
1 parent 0fe67f2 commit 759843a
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3059,45 +3059,6 @@ void handler::adjust_next_insert_id_after_explicit_value(ulonglong nr)
}


/** @brief
Computes the largest number X:
- smaller than or equal to "nr"
- of the form: auto_increment_offset + N * auto_increment_increment
where N>=0.
SYNOPSIS
prev_insert_id
nr Number to "round down"
variables variables struct containing auto_increment_increment and
auto_increment_offset
RETURN
The number X if it exists, "nr" otherwise.
*/
inline ulonglong
prev_insert_id(ulonglong nr, struct system_variables *variables)
{
if (unlikely(nr < variables->auto_increment_offset))
{
/*
There's nothing good we can do here. That is a pathological case, where
the offset is larger than the column's max possible value, i.e. not even
the first sequence value may be inserted. User will receive warning.
*/
DBUG_PRINT("info",("auto_increment: nr: %lu cannot honour "
"auto_increment_offset: %lu",
(ulong) nr, variables->auto_increment_offset));
return nr;
}
if (variables->auto_increment_increment == 1)
return nr; // optimization of the formula below
nr= (((nr - variables->auto_increment_offset)) /
(ulonglong) variables->auto_increment_increment);
return (nr * (ulonglong) variables->auto_increment_increment +
variables->auto_increment_offset);
}


/**
Update the auto_increment field if necessary.
Expand Down

0 comments on commit 759843a

Please sign in to comment.