今天必须写下这篇日志,这个错出得太冤枉,浪费了太多时间。
public class DiamondDataBase extends SQLiteOpenHelper {
public DiamondDataBase(Context context, String dbpath) {
super(context, null, null, SCHEMA_VERSION);
c = context;
setDatabaseName(dbpath);
}
public boolean tabbleIsExist(String tableName) {
boolean result = false;
if (tableName == null||tableName=="") {
return false;
}
SQLiteDatabase db = null;
Cursor cursor = null;
try {
db = this.getReadableDatabase();
String sql = "select count(*) from Sqlite_master where type ='table' AND name ='"
+ tableName.trim() + "' ";//as c
cursor = db.rawQuery(sql, null);
if (cursor.moveToNext()) {
int count = cursor.getInt(0);//cursor.getCount();//.
if (count > 0) {
result =