public boolean tabIsExist(String tabName, SQLiteDatabase db) { boolean result = false; if (tabName == null) return false; Cursor cursor = null; try { String sql = "select count(*) as c from sqlite_master where type ='table' and name ='" + tabName.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; }
本文链接:https://www.it72.com/2135.htm