package com.maxiee.attitude.database.api;

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

import com.maxiee.attitude.database.DatabaseHelper;

import java.util.ArrayList;

/**
 * Created by maxiee on 15-6-11.
 */
public abstract class BaseDBApi {

    public static final String THOUGHT = "thought";
    public static final String TIMESTAMP = "timestamp";

    protected DatabaseHelper mDatabaseHelper;

    public BaseDBApi(Context context) {
        mDatabaseHelper = DatabaseHelper.instance(context);
    }

    protected void add(String table, ContentValues values) {
        SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
        db.beginTransaction();
        db.insert(table, null, values);
        db.setTransactionSuccessful();
        db.endTransaction();
    };
}

@@ -466,16 +466,48 @@
 eHelper;
+%0A    protected Context mContext;
 %0A%0A    pu
@@ -600,16 +600,44 @@
 ntext);%0A
+        mContext = context;%0A
     %7D%0A%0A 

save Context as field.