前端之家收集整理的这篇文章主要介绍了
判断sqlite数据库中表存在问题,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
- /**
- * 功能:判断该表是否已存在于数据库中
- * @param "表名"
- */
- public boolean IsExist(String table){
- boolean exist = false;
- String sql = "select * from sqlite_master where name="+"'"+table+"'";
- Cursor cursor = db.rawQuery(sql,null);
- if(cursor.getCount()!=0){
- exist = true;
- }
- return exist;
- }