Android数据储存之SQLiteDatabase 简单增删改查

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Android数据储存之SQLiteDatabase 简单增删改查相关的知识,希望对你有一定的参考价值。

SQLiteDatabase 使用

SQLiteDatabase提供如下方法来打开一个文件对应的数据库:

openDatabase(String path, SQLiteDatabase.CursorFactory factory, int flags)  打开path文件所代表的文件

openOrCreateDatabase(String path, SQLiteDatabase.CursorFactory factory)   打开或创建(如果不存在时)path文件所代表的文件

openOrCreateDatabase(File file, SQLiteDatabase.CursorFactory factory) 打开或创建File(如果不存在时)文件所代表的文件

以上方法均返回一个SQLiteDatabase对象!

调用SQLiteDatabase对象中的方法来执行sql操作数据库:

execSQL(String sql) 执行sql


 

execSQL(String sql, Object[] bindArgs)  执行sql

bindArgs代表sql中的占位符参数的值


 

insert(String table, String nullColumnHack, ContentValues values) 插入语句,

table表名

valuesContentValues对象!该对象存储方式为Key-value,Key表示表中的字段名称,value表示该字段对应的值

nullColumnHack表示强行向表中插入null,前提是第三个参数(values)为空或者不包含任何Key-value时生效


 

update(String table, ContentValues values, String whereClause, String[] whereArgs)  更新语句

table为表名

valuesContentValues对象!该对象存储方式为Key-value,Key表示表中的字段名称

value表示该字段对应的值,第三个参数为条件例如:_ID = ? ,第四个参数为第三个参数的值!


 

delete(String table, String whereClause, String[] whereArgs)  删除数据

table表名

whereClause为条件例如:_ID = ?

whereArgswhereClause的值!


 

query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)  查询语句

table为表名

columns想要显示的字段

selection条件

selectionArgs 中为selection的值

groupBy 分组

having  分组条件

orderBy 排序

limit 分页


 

 1 public class MainActivity extends Activity implements OnClickListener{
 2     private Button button,btnUpdate,btnDelete,btnQuery;
 3     private static String DATABASE_PATH;
 4     private static String DATABASE_SQL;
 5     private SQLiteDatabase database;
 6     @Override
 7     protected void onCreate(Bundle savedInstanceState) {
 8         super.onCreate(savedInstanceState);
 9         setContentView(R.layout.activity_main);
10         initView();
11         setEvent();
12     }
13 
14     private void setEvent() {
15         button.setOnClickListener(this);
16         btnUpdate.setOnClickListener(this);
17         btnDelete.setOnClickListener(this);
18         btnQuery.setOnClickListener(this);
19     }
20 
21     private void initView() {
22         DATABASE_PATH = this.getFilesDir()+"/myDataBase.db";
23         DATABASE_SQL = "CREATE TABLE USER_INOF(_ID INTEGER PRIMARY KEY,_NAME,_AGE,_ADDRESS)";
24         database = SQLiteDatabase.openOrCreateDatabase(DATABASE_PATH, null);
25         button = (Button) findViewById(R.id.id_databaseButton);
26         btnUpdate = (Button) findViewById(R.id.id_databaseButtonUpdate);
27         btnDelete =(Button) findViewById(R.id.id_databaseButtonDelete);
28         btnQuery= (Button) findViewById(R.id.id_databaseButtonQuery);
29     }
30 
31     @Override
32     public void onClick(View v) {
33         switch (v.getId()) {
34         case R.id.id_databaseButton:
35             //database.execSQL(DATABASE_SQL);
36             ContentValues values = new ContentValues();
37             values.put("_NAME", "悟空");
38             values.put("_AGE", "666");
39             values.put("_ADDRESS", "辽宁");
40             long i = database.insert("USER_INOF", null, values);
41             if(i==-1){
42                 Toast.makeText(this, "添加失败", 0).show();
43             }else{
44                 Toast.makeText(this, "添加成功", 0).show();
45             }
46             break;
47         case R.id.id_databaseButtonUpdate:
48             ContentValues value = new ContentValues();
49             value.put("_NAME", "猪八戒");
50             value.put("_AGE", "555");
51             value.put("_ADDRESS", "辽宁");
52             database.update("USER_INOF", value, "_ID=?",new String[]{"2"});
53             break;
54         case R.id.id_databaseButtonDelete:
55             int o = database.delete("USER_INOF", "_ID > ?", new String[]{"1"});
56             Toast.makeText(this,""+o+"条数据受影响", 0).show();
57             break;
58         case R.id.id_databaseButtonQuery:
59             Cursor cursor =database.query("USER_INOF", null, null, null, null, null, null);
60             if(cursor.getCount()>0){
61                 while (cursor.moveToNext()) {
62                     String id = cursor.getString(0);
63                     String name =cursor.getString(1);
64                     String age =cursor.getString(2);
65                     String address =cursor.getString(3);
66                     Toast.makeText(this, "查询成功:"+id+name+age+address, 0).show();
67                 }
68             }else{
69                 Toast.makeText(this,""+cursor.getCount()+"", 0).show();
70             }
71             break;
72         default:
73             break;
74         }
75     }
76 
77 }
 1 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 2     android:layout_width="fill_parent"
 3     android:layout_height="fill_parent"
 4     android:orientation="vertical" >
 5 
 6     <Button
 7         android:id="@+id/id_databaseButton"
 8         android:layout_width="match_parent"
 9         android:layout_height="wrap_content"
10         android:text="添加数据" />
11 
12     <Button
13         android:id="@+id/id_databaseButtonUpdate"
14         android:layout_width="match_parent"
15         android:layout_height="wrap_content"
16         android:text="修改数据" />
17 
18     <Button
19         android:id="@+id/id_databaseButtonDelete"
20         android:layout_width="match_parent"
21         android:layout_height="wrap_content"
22         android:text="删除数据" />
23 
24     <Button
25         android:id="@+id/id_databaseButtonQuery"
26         android:layout_width="match_parent"
27         android:layout_height="wrap_content"
28         android:text="查询数据" />
29 
30 </LinearLayout>

技术分享php0o1wFFSjVCVClMOR+VM5TwnAwlHGABCA+41gEMs33kmAC3GeKlYwBQlOBgaWaq6SgZ7lWBkS0l8OkBo9n54AEtJGDAcjbBkIIIAHSQQpZH2cWBDCEAlQIIIzjJIqwsHsLYCy08VkJBFSRQZgqOburss5S0sNprDpB6wAMgOJCACAxut9pOBFBgKQ0oABApIiiIAP8DDCPkNsMLRAlw2ZwABCXsiw9w8NiUfjrJb1/QBiywVW1Wh6CC3QK52kAE6ACBByiGwMGGEYswUiJYCjUahC84EBgiLYAw3wEl9LqCfxw4cHJ/6Q3ssss7Huxjg3dyVEAPOhiAwHgHuDfeeFzSwFJPU3r8QAi79RkCCnQhEkJ7AFjwEaxHdYDpy1i//EK+BifAJcKmckeDDDfjLIEJLPQaAgtss+CoDHUlgFWKxiEEQwVUoorICRao7RAIB8igZLJIngBl1ohrunUHXX89s7esvVA2zgsAZC4MIRiViGxZ/eVglPNxcFRqM3j5lwMv4IdfVYm3nmZtIBh8ZI8ygND/QVsK4/kAAT30jvMFJF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lWJqlWrqlXNqlXvqlYBqmYjqmZFqmZnqmaJqmarqmbNqmbvqmcBqncjqndFqndnqneJqnerqnfNqnfvqngBqogjqohFqohnqoiJqoirqojNqojvqokBqpkjqplFqplnqpmJqpmrqpnNqpnvqpoBqqojqqpFqqpnqqqJqqqrqqrNqqrvqqsBqrsjqrtFqrtnqruJqrurqr/7zaq776q8AarMI6rMRarMZ6rMiarMq6rMzarM76rNAardI6rdRardZ6rdiardq6rdzard76reAaruI6ruRaruZ6ruiaruq6ruzaru76rvAar/I6r/Rar/Z6r/iar/q6r/zar/76rwAbsAI7sARbsAZ7sAibsAq7sAzbsA77sBAbsRI7sRRbsRZ7sRibsRq7sRzbsR77sSAbsiI7siRbsiZ7siibsiq7sizbsi77sjAbszI7szRbszZ7szibszq7szzbsz77s0AbtEI7tERbtEZ7tEibtEq7tEzbtE77tFAbtVI7tVRbtVZ7tVibtVq7tVzbtV77tWAbtmI7tmRbtv9me7Zom7Zqu7Zs27Zu+7ZwG7dyO7d0W7d2e7d4m7d6u7d827d++7eAG7iCO7iEW7iGe7iIm7iKu7iM27iO+7iQG7mSO7mUW7mWe7mYm7mau7mc27me+7mgG7qiO7qkW7qme7qom7qqu7qs27qu+7qwG7uyO7u0W7u2e7u4m7u6u7u827u++7vAG7zCO7zEW7zGe7zIm7zKu7zM27zO+7zQG73SO73UW73We73Ym73au73c273e+73gG77iO77kW77me77om77qu77s277u+77wG7/yO7/0W7/2e7/4m7/6u7/827/++78AHMACPMAEXMAGfMAInMAKvMD42gM+5MD/GAnBEvzAFMwDE2zBGXnBGlzBF0yRG4zBIPzBHszBJBzCFTzCJpzCIjyRH9zCJ8zCJezCIIzCMrzCD1nDMZzBOazCL3zDOyzDNPzDJRzEPFzERIzDMwzDDNy7DrxGOOzEQuzETRzFU1zETXzFVkzBUJzFUpzFGLzFLtzFT1zFYYzFY+zFZkzGOQzGa2zGVIzGFuzGXKzGPCzGb3zGbFzHdLzBdjzHcNzHZfzHchzIeLzHJAzBS7y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1RDybNSX5ixtzNG4ICp3gmAygNAmGUSvgX8e4wwIhwQQEHiQgUcJL1aRoGv9Uqo827o9d03BBb8xQB0hAn2iQAGhMPg0k03/ADTZAcgwcSHWI2WGQUsWpab3j4xQLmDV2gh/wGnoIfUwS1aWByLAURQwVUjvdjnu4mFyHAD9yxl2gK89967EgNo8tcADBQuGLCk1vhXwnsKwLCxjwsQ+eRU2xHMjzX9ScEDdxs4gAIr2OtDEOKXp+1

以上是关于Android数据储存之SQLiteDatabase 简单增删改查的主要内容,如果未能解决你的问题,请参考以下文章

Android数据储存之SQLiteDatabase SQLiteOpenHelper类的简单使用

安卓基础之Sqlite数据库最最基础操作

Android安全开发之Provider组件安全

Android SQLite服务--创建增删改查

Android 里的数据储存

如何使用Android从sqlite中的表中删除所有记录?