Changed code that makes sorts sql command history to specify ascending (+1) instead
of doing descending (-1) and then .reverse() on the results.