<commit_before>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();
    };
}<commit_msg>BaseDBApi.java: save Context as field.<commit_after>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;
    protected Context mContext;

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

    protected void add(String table, ContentValues values) {
        SQLiteDatabase db = mDatabaseHelper.getWritableDatabase();
        db.beginTransaction();
        db.insert(table, null, values);
        db.setTransactionSuccessful();
        db.endTransaction();
    };
}
{'fraction_non_alphanumeric': 0.09390178089584458, 'fraction_numerical': 0.005396654074473826, 'mean_word_length': 3.7660668380462723, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '678216', 'n_tokens_mistral': 518, 'n_tokens_neox': 505, 'n_words': 121}