Sqlite3を使っている場合に、テーブルが存在するかどうかを確認する為には、
以下のようなSQLを実行すればOkです。

sql>>
SELECT count(*) FROM sqlite_master
WHERE type='table' AND name=?;
<<--

?には、sqlite3_bind_textなどで存在を確認したいテーブルの名前をbindします。

あとは結果をsqlite3_column_intなどで取得すればOkです。

See Also

posted by genki genki on Wed 15 Oct 2008 at 18:58 with 0 comments