我将以下代码添加到测试活动中,并按预期运行:
sqliteDatabase connection = getApplicationContext().openorCreateDatabase("foo.db",MODE_PRIVATE,null);try { connection.execsql("drop table if exists person"); connection.execsql("create table person (ID integer,name string)"); ContentValues cv = new ContentValues(); cv.put("ID",1); cv.put("name","leo"); connection.insert("person",null,cv); cv = new ContentValues(); cv.put("ID",2); cv.put("name","yui"); connection.insert("person",cv); Cursor rs = connection.query("person",new String[] {"ID","name" },null); while(rs.movetoNext()) { System.out.println("name = " + rs.getString(1)); System.out.println("ID = " + rs.getString(0)); Cursor rs2 = connection.query("person",null); while (rs2.movetoNext()) { System.out.println("name = " + rs2.getString(1)); System.out.println("ID = " + rs2.getString(0)); } }} catch (Exception e) { System.out.println("Exception " + e);}总结
以上是内存溢出为你收集整理的执行新的SQLite查询是否安全,同时仍在迭代光标以获得先前的查询? (机器人)全部内容,希望文章能够帮你解决执行新的SQLite查询是否安全,同时仍在迭代光标以获得先前的查询? (机器人)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)