On 14 Dec 2019, at 10:46am, František Kučera <konfere...@frantovo.cz> wrote:
> SELECT cast(dump+100 AS integer) FROM fstab; > > the sqlite3_column_decltype() still does not return the integer type. > > Would it be possible to modify this function or add a new one, to tell the > correct type at least if there is an explicit cast like this in given query? It works fine for me: SQLite version 3.28.0 2019-04-15 14:49:49 Enter ".help" for usage hints. Connected to a transient in-memory database. Use ".open FILENAME" to reopen on a persistent database. sqlite> CREATE TABLE t (a TEXT, b INTEGER, c REAL); sqlite> INSERT INTO t VALUES ('123', 123, 123.4); sqlite> INSERT INTO t VALUES (CAST ('456' AS INTEGER), CAST (456 AS INTEGER), CAST (456.7 AS INTEGER)); sqlite> SELECT a,typeof(a),b,typeof(b),c,typeof(c) FROM t; 123|text|123|integer|123.4|real 456|text|456|integer|456.0|real sqlite> SELECT cast(a AS INTEGER),typeof(cast(a AS INTEGER)),cast(b AS INTEGER),typeof(cast(b AS INTEGER)),cast(c AS INTEGER),typeof(cast(c AS INTEGER)) FROM t; 123|integer|123|integer|123|integer 456|integer|456|integer|456|integer When you do your CAST when you store, and the column type is compatible with the input value, the column type is what you declared the column type to be. But whether you do your cast() when you recall, the column type is always INTEGER. Which is what you want. _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users