Android学习笔记(十六)——数据库操作(上)

时间:2022-06-29 02:13:49

  //此系列博文是《第一行Android代码》的学习笔记,如有错漏,欢迎指正!

  Android 为了让我们能够更加方便地管理数据库,专门提供了一个 SQLiteOpenHelper帮助类, 借助这个类我们可以方便地对数据库进行创建和升级。首先,由于SQLiteOpenHelpe是一个抽象类,所以我们需要创建一个类来继承它。SQLiteOpenHelper 中有两个抽象方法,分别是onCreate()和 onUpgrade(),我们必须在自己的帮助类里面重写这两个方法,然后分别在这两个方法中去实现创建、升级数据库的逻辑。SQLiteOpenHelper 中 还 有 两 个 非 常 重 要 的 实 例 方 法 , getReadableDatabase() 和getWritableDatabase()。这两个方法都可以创建或打开一个现有的数据库(如果数据库已存在则直接打开,否则创建一个新的数据库) ,并返回一个可对数据库进行读写操作的对象。不同的是,当数据库不可写入的时候(如磁盘空间已满)getReadableDatabase()方法返回的对象将以只读的方式去打开数据库,而 getWritableDatabase()方法则将出现异常。

  SQLiteOpenHelper中有两个构造方法可供重写, 一般使用参数少一点的那个构造方法即可。这个构造方法中接收四个参数,第一个参数是 Context,这个没什么好说的,必须要有它才能对数据库进行操作。第二个参数是数据库名,创建数据库时使用的就是这里指定的名称。第三个参数允许我们在查询数据的时候返回一个自定义的 Cursor,一般都是传入 null。第四个参数表示当前数据库的版本号,可用于对数据库进行升级操作。下面我们来试一试数据库的使用。

一、新建 MyDatabaseHelper类继承自 SQLiteOpenHelper:

 public class MyDatabaseHelper extends SQLiteOpenHelper {
public static final String CREATE_BOOK = "create table book ("
+ "id integer primary key autoincrement, "
+ "author text, "
+ "price real, "
+ "pages integer, "
+ "name text)";
private Context mContext;
public MyDatabaseHelper(Context context, String name, SQLiteDatabase.CursorFactory
factory, int version) {
super(context, name, factory, version);
mContext = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL(CREATE_BOOK);
Toast.makeText(mContext, "Create succeeded", Toast.LENGTH_SHORT).show();
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
}

  我们把建表语句定义成了一个字符串常量,然后在 onCreate()方法中又调用了 SQLiteDatabase 的 execSQL()方法去执行这条建表语句,并弹出一个 Toast提示创建成功,这样就可以保证在数据库创建完成的同时还能成功创建 Book 表。

二、编写布局文件:

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"> <Button
android:id="@+id/create_database"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Create database"
/>
</RelativeLayout>

  我们在界面中加入了一个按钮,用于创建数据库。

三、修改 MainActivity中的代码:

 public class MainActivity extends AppCompatActivity {

     private MyDatabaseHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
dbHelper = new MyDatabaseHelper(this, "BookStore.db", null, 1);
Button createDatabase = (Button) findViewById(R.id.create_database);
createDatabase.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dbHelper.getWritableDatabase();
}
});
}
}

  我们在 onCreate()方法中构建了一个 MyDatabaseHelper对象,并且通过构造函数的参数将数据库名指定为 BookStore.db,版本号指定为 1,然后在 Create database 按钮的点击事件里调用了 getWritableDatabase()方法。这样当第一次点击 Create database按钮时,就会检测到当前程序中并没有 BookStore.db这个数据库, 于是会创建该数据库并调用 MyDatabaseHelper中的 onCreate()方法,这样 Book表也就得到了创建,然后会弹出一个 Toast提示创建成功。再次点击 Create database按钮时,会发现此时已经存在 BookStore.db数据库了,因此不会再创建一次。

  程序运行如下:

  Android学习笔记(十六)——数据库操作(上)

  此时进入到com.mycompany.database/databases 中可看到BookStore已被创建了:

  aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqAAAABWCAIAAACfCrO/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EAAAAASUVORK5CYII=" alt="" />

  这个目录下出现了两个数据库文件,一个正是我们创建的 BookStore.db,而另一个BookStore.db-journal 则是为了让数据库能够支持事务而产生的临时日志文件,通常情况下这个文件的大小都是 0 字节。

  //End.