SQLite中的事务处理

package xdglyt.software.jhwz.myapplicationsharedpreferences;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

public class SQLiteTransaction {

    public static void execTransaction(Context context){
        MyHelper helper = new MyHelper(context);
        SQLiteDatabase database = helper.getWritableDatabase();
        database.beginTransaction();
        try {
            database.setTransactionSuccessful();
        }catch (Exception e){
            e.printStackTrace();
        }finally {
            database.endTransaction();
            database.close();
        }
    }
}


版权声明:本文为qq_44833392原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。