<commit_before>package com.marverenic.reader.utils

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

fun SQLiteDatabase.query(table: String,
                         projection: Array<String>? = null,
                         selection: String? = null,
                         selectionArgs: Array<String>? = null,
                         orderBy: String? = null): Cursor
        = query(table, projection, selection, selectionArgs, null, null, orderBy)

fun SQLiteDatabase.insert(table: String, values: ContentValues) = insert(table, null, values)

inline fun <T> SQLiteDatabase.insertAll(table: String, items: Collection<T>, convert: (T) -> ContentValues) {<commit_msg>Overwrite items on conflict<commit_after>package com.marverenic.reader.utils

import android.content.ContentValues
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import android.database.sqlite.SQLiteDatabase.CONFLICT_REPLACE

fun SQLiteDatabase.query(table: String,
                         projection: Array<String>? = null,
                         selection: String? = null,
                         selectionArgs: Array<String>? = null,
                         orderBy: String? = null): Cursor
        = query(table, projection, selection, selectionArgs, null, null, orderBy)

fun SQLiteDatabase.insert(table: String, values: ContentValues) = insertWithOnConflict(table, null, values, CONFLICT_REPLACE)

inline fun <T> SQLiteDatabase.insertAll(table: String, items: Collection<T>, convert: (T) -> ContentValues) {
{'fraction_non_alphanumeric': 0.0976685570258349, 'fraction_numerical': 0.0, 'mean_word_length': 3.2346666666666666, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, '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': '2013474', 'n_tokens_mistral': 417, 'n_tokens_neox': 411, 'n_words': 104}