Something to keep in mind for the design: SQL does not guarantee that column names are unique and treats column order as significant, whereas some other systems do guarantee uniqueness and the order of returned columns may be determined by the query optimizer. So we need to be able to get the column names in (some) order and then each row in the same order.
sqlite> .headers on
sqlite> .mode columns
sqlite> create table foo(a integer, a integer);
Error: duplicate column name: a
sqlite> create table foo(a integer, b integer);
sqlite> insert into foo values(10,40);
sqlite> select a, b as a from foo;
a a
---------- ----------
10 40
sqlite> select a, b as a, a + a as a from foo;
a a a
---------- ---------- ----------
10 40 20