This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 检查表是否已存在 | |
*/ | |
public static boolean tableExist(SQLiteDatabase db) { | |
// 查询表是否存在 | |
String sql = "select count(*) " + | |
"from sqlite_master where type='table' and name = '" + TABLE_NAME +"'"; | |
Cursor cursor = db.rawQuery(sql, null); | |
return cursor.getInt(0) == 0; |