数据库

判断当前数据库表中的字段是否存在:

 

public boolean isEexit(){
		try {
			String sql = "select  url from app_table limit 0, 1";
			Cursor c = db.rawQuery(sql, null);
			c.close();
			return true ;
		} catch (Exception e) {
			e.printStackTrace();
			return false  ;
		}
	}

 

where语句判断:

private void getData(int size,String name,String value){
		 
		String where = size + "=0 and " + name + " is not null and " + value + " is not null";
		Cursor cursor = db.query("info_table", null, where, null,null, null, null);
		
		
		String where = size + "=0 and " + name + " is null";
		Cursor cursor = db.query("info_table", null, where, null,null, null, null);
		
		String where = size + ">0 and " + name + " is null";
		Cursor cursor = db.query("info_table", null, where, null,null, null, null);
	}

  

"size > 0"

  

" size > 0 and name= '"+name+"'"

 

size +" <> "+ 1

 

你可能感兴趣的:(数据库)