ODBC: Sync last item notifications with mod_pubsub

A while back, mod_pubsub was modified to address EJAB-1456.  However,
the change was only partly applied to mod_pubsub_odbc; this commit adds
the remaining part.
Move routing of last PEP items into new function

This doesn't change the behavior, but avoid some code duplication.