判断某张表是否存在
/***?判斷某張表是否存在*?@param?tabName?表名*?@return*/public?boolean?tabIsExist(String?tabName){boolean?result?=?false;if(tabName?==?null){return?false;}SQLiteDatabase?db?=?null;Cursor?cursor?=?null;try?{db?=?this.getReadableDatabase();//此this是繼承SQLiteOpenHelper類得到的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://blog.51cto.com/zengyinan/1721467
總結
- 上一篇: JavaXml教程(一)简介
- 下一篇: lucene索引合并与增量索引