android java 判断某张表是否存在
2011-12-26 14:16
357 查看
/** * 判断某张表是否存在 * * @param tabName * 表名 * @return */ public boolean tabbleIsExist(String tableName) { boolean result = false; if (tableName == null) { return false; } SQLiteDatabase db = null; Cursor cursor = null; try { db = this.getReadableDatabase(); String sql = "select count(*) as c from Sqlite_master where type ='table' and name ='" + tableName.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; }
相关文章推荐
- 用Java语句判断数据库表是否存在
- Android的SQLite如何判断一列是否存在
- java判断文件是否存在
- android java 判断是否同一天
- android判断一个Service是否存在
- Android 判断数据库中是否存在某个表
- Android_判断文件是否存在并创建代码
- JAVA之旅(二十八)——File概述,创建,删除,判断文件存在,创建文件夹,判断是否为文件/文件夹,获取信息,文件列表,文件过滤
- Android判断应用是否存在
- Android判断桌面快捷方式是否存在!
- Android 判断SD卡是否存在及容量查询
- Android判断应用是否存在 及 Android 关闭整个应用程序
- android:java 判断字符串是否是数字
- Java判断文件或文件夹是否存在
- java 函数式编程 - 判断集合中是否存在满足某个条件的元素
- java中Long和Integer在hashmap判断key是否存在的问题
- cocos2d-x判断文件是否存在for android
- Java 判断文件夹、文件是否存在、否则创建文件夹
- android 中sqlite判断表或视图是否存在
- Android应用添加(创建)和删除及判断是否存在桌面快捷方式