//判断表是否存在
public static boolean isTableExist(SQLiteDatabase database,String tableName) {
boolean isTableExist=false;
String sql = "select count(*) as c from sqlite_master where type ='table' and name =?";
Cursor c=database.rawQuery(sql, new String[]{tableName});
if(c.moveToNext()){
int count = c.getInt(0);
if(count>0){
return true;
}
}
c.close();
return isTableExist;
}
android sqlite 判断表是否存在
最新推荐文章于 2023-09-13 16:03:25 发布