<commit_before>package com.czbix.v2ex.dao;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;

import com.google.common.base.Preconditions;

public class TopicDao extends DaoBase {
    private static final String TABLE_NAME = "topic";

    private static final String KEY_TOPIC_ID = "topic_id";
    @Deprecated
    private static final String KEY_LAST_READ = "last_read";
    private static final String KEY_LAST_READ_TIME = "last_read_time";
    private static final String KEY_LAST_READ_REPLY = "last_read_reply";

    private static final String SQL_GET_REPLY_BY_TOPIC_ID = SQLiteQueryBuilder.buildQueryString(false,
            TABLE_NAME, new String[]{KEY_LAST_READ_REPLY}, KEY_TOPIC_ID + " = ?", null, null, null, null);

    static void createTable(SQLiteDatabase db) {
        Preconditions.checkState(db.inTransaction());

        String sql = "CREATE TABLE " + TABLE_NAME + "(" +
                KEY_TOPIC_ID + " INTEGER PRIMARY KEY," +
                KEY_LAST_READ_REPLY + " INTEGER NOT NULL," +
                KEY_LAST_READ_TIME + " INTEGER NOT NULL" +
                ")";
        db.execSQL(sql);
    }

    @SuppressWarnings("deprecation")
    static void upgradeTableZero2One(SQLiteDatabase db) {
        Preconditions.checkState(db.inTransaction());
        final String newTableName = TABLE_NAME + "_new";

        String sql = "CREATE TABLE " + newTableName + "(" +
                KEY_TOPIC_ID + " INTEGER PRIMARY KEY," +
                KEY_LAST_READ_REPLY + " INTEGER NOT NULL," +
                KEY_LAST_READ_TIME + " INTEGER NOT NULL" +
                ")";
        db.execSQL(sql);

        // convert data
        sql = String.format("INSERT INTO %s (%s, %s, %s) %s", newTableName, KEY_TOPIC_ID,
                KEY_LAST_READ_REPLY, KEY_LAST_READ_TIME, SQLiteQueryBuilder.buildQueryString(false,
                        TABLE_NAME, new String[]{KEY_TOPIC_ID, KEY_LAST_READ, "0"}, null, null, null,
                        null, null));
        db.execSQL(sql);

        // delete old table
        sql = "DROP TABLE " + TABLE_NAME;
        db.execSQL(sql);

        sql = String.format("ALTER TABLE %s RENAME TO %s", newTableName, TABLE_NAME);
        db.execSQL(sql);
    }
<commit_msg>minor fix<commit_after>package com.czbix.v2ex.dao;

import android.content.ContentValues;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteQueryBuilder;

import com.google.common.base.Preconditions;

public class TopicDao extends DaoBase {
    private static final String TABLE_NAME = "topic";

    private static final String KEY_TOPIC_ID = "topic_id";
    private static final String KEY_TITLE = "title";
    private static final String KEY_LAST_READ_TIME = "last_read_time";
    private static final String KEY_LAST_READ_REPLY = "last_read_reply";

    private static final String SQL_GET_REPLY_BY_TOPIC_ID = SQLiteQueryBuilder.buildQueryString(false,
            TABLE_NAME, new String[]{KEY_LAST_READ_REPLY}, KEY_TOPIC_ID + " = ?", null, null, null, null);

    static void createTable(SQLiteDatabase db) {
        Preconditions.checkState(db.inTransaction());

        String sql = "CREATE TABLE " + TABLE_NAME + "(" +
                KEY_TOPIC_ID + " INTEGER PRIMARY KEY," +
                KEY_TITLE + " TEXT NOT NULL," +
                KEY_LAST_READ_REPLY + " INTEGER NOT NULL," +
                KEY_LAST_READ_TIME + " INTEGER NOT NULL" +
                ")";
        db.execSQL(sql);
    }

    static void upgradeTableZero2One(SQLiteDatabase db) {
        String sql = "DROP TABLE " + TABLE_NAME;
        db.execSQL(sql);

        createTable(db);
    }

{'fraction_non_alphanumeric': 0.0968683651804671, 'fraction_numerical': 0.001326963906581741, 'mean_word_length': 2.8419979612640165, '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': '5520442', 'n_tokens_mistral': 1161, 'n_tokens_neox': 1118, 'n_words': 258}