由于开发初期判断上的失误,错误地以一个并不具必唯一性的字段来作为id,导致用户无法添加具体相同title的消息,以前考虑的真是太不周全了。


context = In the present, then, in loving tolerance, in loving association, ever being ready to answer when any aid or help must be given or may be given [is the best way to help someone].


context = 

. . . ye are part and parcel of a universal consciousness or God—and thus of all that is within the universal consciousness, or the universal awareness; as the stars, the planets, the sun, the moon. Do ye rule them or they rule thee? They were made for thy own use, as an individual—yea, that is the part, the thought thy Maker, thy Father-God thinks of thee.


/**

*

@param context 

@return boolean

@author Samuel.Cai

@date Mar 9, 2012

*/

public boolean alreadyExists(String context) {

//System.out.println(">>>>>>>  context = " + context );

// TODO Auto-generated method stub

Cursor cursor = null;

Boolean flag = true;

if(context != null){

sd=db.getReadableDatabase();

cursor = sd.rawQuery("select * from thoughtsInfo where context=?",new String[]{context.trim()});

if(cursor.getCount() == 0){

flag = false;

}else{

flag = true;

}

}

cursor.close();

sd.close();

return flag;

}

最终结果:比较一般文本,就是把salite里面text格式字段里面值拿出来,与外面String来作比较,有些字符串可能由于编码的原因,并不一定能和自己期望的比较结果符合。

最终solution: 没有办法,只能改表结构(这次考虑很充分了,哈哈!),自己管理数据库的升级,重新发版本,自动处理用户的数据。

思路,自己通过设定标记,来执行换表结构的代码(先把用户数据从旧的表结构中取出,然后再建新表,再插入),这个并不等同于普通的数据库升级。需小心应对才是!

更多相关文章

  1. AIR Native Extension on Android(安卓)- Hello World(2) 结构及
  2. Ubuntu下安装Android(安卓)Studio全过程(2015.01.27):高阶用户,绝对
  3. 浅谈Android系统的基本体系结构与内存管理优化
  4. Android,一个函数实现摇一摇
  5. Activity and Task(一)
  6. Android系统开发
  7. [Network]Android(安卓)N 新wifi connect&auto connect流程分析
  8. Android用户界面——通用布局对象
  9. Android(安卓)JSON

随机推荐

  1. Android红外线遥控
  2. Android(安卓)ListView+CheckBox实现全选
  3. Android(安卓)Studio升级后编辑local pat
  4. Android-Storage-System
  5. Android(安卓)studio中logcat时间与真实
  6. android从fragment进入activity再返回实
  7. android基础知识06:intent和intentfilter
  8. Android(安卓)众多的布局属性详解
  9. 基于Appium的Android自动化测试(一)
  10. kotlin配置