SQLiteでデータ型を気にせず投入している場合がありますよね。
各カラムに格納されているデータの型を調べる方法を以下に記します。
尚、操作はUbuntuで行いました。
以下のように適当なテーブルおよびデータをINSERTしました。
sakura@ubuntu:~$ sqlite3 testdb.sqlite3 SQLite version 3.7.9 2011-11-01 00:52:41 Enter ".help" for instructions Enter SQL statements terminated with a ";"
sqlite> create table t1 ( ...> a, ...> b, ...> c ...> );
sqlite> insert into t1 values (1,2,3); sqlite> insert into t1 values ("one", "two", "three");
sqlite> select * from t1; 1|2|3 one|two|three
sqlite> select typeof(a), typeof(b), typeof(c) from t1; integer|integer|integer text|text|text
以上のようにtypeofを使用することにより格納されている値のデータ型を確認することができます。