判断sqlite 是否存在表

前端之家收集整理的这篇文章主要介绍了判断sqlite 是否存在表前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

判断sqlite 是否存在表

Cursor cursor = null;  
    try {  
    boolean result = false;
        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  
    }
原文链接:https://www.f2er.com/sqlite/198884.html

猜你在找的Sqlite相关文章