In case you were wondering how to get the query result one row at a time with the MySQL driver of UnixODBC, it's very easy.
You just need to:
SQLSetStmtAttr(stm, SQL_ATTR_CURSOR_SCROLLABLE, (SQLPOINTER)SQL_NONSCROLLABLE, SQL_IS_INTEGER);
But not, of course, before having set the DSN Options field to 1048576 (with the ODBCConfig tool or something similar).
It wasn't too hard to find out after reading most of the MySQL driver source code.
And qalculate has a nice useful built-in shift operation.