开发者

Android SQLite comparison

I want a conditional statement that determines if the table exists. Unfortunately the Cursor data type returns an uncaught exception (and cra开发者_如何学运维shes the app) before I can do a null comparison or check for false etc

What is the best way to determine from Java if values in my sql table exist


"What is the best way to determine from Java if values in my sql table exist?"

         SELECT exists
         (select * from T where mycolumn = {some value}  )

will return 1 if true or 0 if false, in SQLite.


Try running this query:

SELECT * FROM dbname.sqlite_master WHERE type='table';

This queries the sqlite master table and you should be able to see the table you want there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜