zoukankan      html  css  js  c++  java
  • 判断某张表是否存在

    /**
             * 判断某张表是否存在
             * @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;
            }

    本文出自 “曾颐楠的播客” 博客,请务必保留此出处http://zengyinan.blog.51cto.com/9524976/1721467

  • 相关阅读:
    css样式之补充
    css样式之属性操作
    css之操作属性
    前端基础之css样式(选择器)
    mysql之视图,触发器,事务等
    pymysql模块
    MySQL之IDE工具介绍及数据备份
    mysql老是停止运行该怎么解决
    mysql之索引原理与慢查询优化
    MySQL 5.7.9版本sql_mode=only_full_group_by问题
  • 原文地址:https://www.cnblogs.com/zengyinanos/p/5042738.html
Copyright © 2011-2022 走看看