On Mon, Jan 22, 2018 at 12:50 AM, Stadin, Benjamin < benjamin.sta...@heidelberg-mobil.com> wrote:
> wrote a tool to convert an arbitrary SQLite result set to properly typed > json key/value pairs, using the SQLite type affinity of the objects. > ... > while ((rc = sqlite3_step(readStmt)) == SQLITE_ROW) { > ... for (int colIdx=0; colIdx<columnNames.size(); colIdx++) { > ... sqlite3_value *val = sqlite3_column_value(readStmt, colIdx); > switch (int type = sqlite3_value_type(val)) { > ... } > Since it's based on on sqlite3_value_type(), that's not "type affinity" exactly, just the actual "storage" type of the value. AFAIK there's no way to know the affinity [1] of a column of a table using an SQLite API. Perhaps there's a pragma? There's sqlite3_value_numeric_type() which allows you to emulate SQLite's numeric affinity, but that's not the same. FWIW. --DD [1] https://www.sqlite.org/datatype3.html#type_affinity _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users