Android sqlite中判断某个表是否存在方法
http://mycoding.iteye.com/blog/939683
/** * 判断某张表是否存在 * @param tabName 表名 * @return */ public boolean tabbleIsExist(String tableName){ boolean result = false; if(tableName == null){ return false; } SQLiteDatabase db = null; Cursor cursor = null; try { db = this.getReadableDatabase(); String sql = "select count(*) as c from Sqlite_master where type ='table' and name ='"+tableName.trim()+"' "; cursor = db.rawQuery(sql, null); if(cursor.moveToNext()){ int count = cursor.getInt(0); if(count>0){ result = true; } } } catch (Exception e) { // TODO: handle exception } return result; }
相关推荐
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
bigdatazx 2010-11-05
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
nosqlnotes 2014-08-16