alternator: move do_query to separate function
alternator: move do_query to separate function

A fair portion of code from scan() will be used later to implement
query(), so it's extracted as a helper function.
Message-Id: <34a9bb262e5afee837bdd52a280feb6f8c7094e2@scylladb.com>

scylladb/scylla,avikivity/scylla,scylladb/scylla,scylladb/scylla,avikivity/scylla,avikivity/scylla,scylladb/scylla