<commit_before>package com.fortysevendeg.mvessel.api.impl

import android.database.sqlite.SQLiteDatabase
import com.fortysevendeg.mvessel.AndroidDriver
import com.fortysevendeg.mvessel.api.{CursorProxy, DatabaseProxy, DatabaseProxyFactory}
import com.fortysevendeg.mvessel.util.ReflectionOps._

class AndroidDatabaseFactory extends DatabaseProxyFactory {

  override def openDatabase(name: String, flags: Int): DatabaseProxy =
    new AndroidDatabase(SQLiteDatabase.openDatabase(name, null, flags))

  override def isLockedException(exception: RuntimeException): Boolean =
    lockedExceptionClass exists (_.isAssignableFrom(exception.getClass))

}

class AndroidDatabase(sqliteDatabase: SQLiteDatabase) extends DatabaseProxy {

  override def rawQuery(sql: String, selectionArgs: Array[String]): CursorProxy =
    new AndroidCursor(sqliteDatabase.rawQuery(sql, selectionArgs))

  override def execSQL(sql: String, bindArgs: Option[Array[AnyRef]]): Unit =
    bindArgs match {
      case Some(args) => sqliteDatabase.execSQL(sql, args)
      case _ => sqliteDatabase.execSQL(sql)
    }

  override def setTransactionSuccessful(): Unit = sqliteDatabase.setTransactionSuccessful()

  override def endTransaction(): Unit = sqliteDatabase.endTransaction()

  override def changedRowCount: Option[Int] = lastChangeCount(sqliteDatabase)

  override def isOpen: Boolean = sqliteDatabase.isOpen

  override def close(): Unit = sqliteDatabase.clone()

  override def beginTransaction(): Unit = sqliteDatabase.beginTransaction()

  override def getVersion: Int = sqliteDatabase.getVersion

  override def getDriverName: String = AndroidDriver.driverName<commit_msg>Fixes bug on AndroidDatabase calling wrong method<commit_after>package com.fortysevendeg.mvessel.api.impl

import android.database.sqlite.SQLiteDatabase
import com.fortysevendeg.mvessel.AndroidDriver
import com.fortysevendeg.mvessel.api.{CursorProxy, DatabaseProxy, DatabaseProxyFactory}
import com.fortysevendeg.mvessel.util.ReflectionOps._

class AndroidDatabaseFactory extends DatabaseProxyFactory {

  override def openDatabase(name: String, flags: Int): DatabaseProxy =
    new AndroidDatabase(SQLiteDatabase.openDatabase(name, null, flags))

  override def isLockedException(exception: RuntimeException): Boolean =
    lockedExceptionClass exists (_.isAssignableFrom(exception.getClass))

}

class AndroidDatabase(sqliteDatabase: SQLiteDatabase) extends DatabaseProxy {

  override def rawQuery(sql: String, selectionArgs: Array[String]): CursorProxy =
    new AndroidCursor(sqliteDatabase.rawQuery(sql, selectionArgs))

  override def execSQL(sql: String, bindArgs: Option[Array[AnyRef]]): Unit =
    bindArgs match {
      case Some(args) => sqliteDatabase.execSQL(sql, args)
      case _ => sqliteDatabase.execSQL(sql)
    }

  override def setTransactionSuccessful(): Unit = sqliteDatabase.setTransactionSuccessful()

  override def endTransaction(): Unit = sqliteDatabase.endTransaction()

  override def changedRowCount: Option[Int] = lastChangeCount(sqliteDatabase)

  override def isOpen: Boolean = sqliteDatabase.isOpen

  override def close(): Unit = sqliteDatabase.close()

  override def beginTransaction(): Unit = sqliteDatabase.beginTransaction()

  override def getVersion: Int = sqliteDatabase.getVersion

  override def getDriverName: String = AndroidDriver.driverName
{'fraction_non_alphanumeric': 0.08427973699940228, 'fraction_numerical': 0.0, 'mean_word_length': 6.228941684665227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '3144915', 'n_tokens_mistral': 919, 'n_tokens_neox': 864, 'n_words': 215}