Android开发判断SQLite数据库中某个表是否存在
直接上方法:
public boolean tabIsExist(SQLiteDatabase db){ boolean result = false; if(yourTableName == null){ return false; } Cursor cursor = null; try { String sql = "select count(*) as c from sqlite_master where type ='table' and name ='"+yourTableName.trim()+"' "; cursor = db.rawQuery(sql, null); if(cursor.moveToNext()){ int count = cursor.getInt(0); if(count>0){ result = true; } } } catch (Exception e) { } return result; }
相关推荐
bigdatazx 2010-11-05
狗蛋的窝 2019-06-20
Justdoit00 2020-04-26
dreamhua 2020-01-31
nicepainkiller 2020-01-06
JackLang 2019-12-19
zhangchaoming 2019-12-18
pythonxuexi 2019-12-16
暗夜之城 2019-11-13
qsdnet我想学编程 2019-11-04
DAV数据库 2019-10-26
圆圆的世界CSDN 2019-10-22
nickey 2011-11-17
ebuild 2017-02-14
zhaoshuliok 2012-09-12
人勤阡陌绿 2019-03-27