Skip to content

Commit

Permalink
Implemented "MappingSupportSQLiteQuery.bindTo" with "OneOffDelegate"
Browse files Browse the repository at this point in the history
*This commit is related to issue #529 [1]*

[1] #529
  • Loading branch information
JaniruTEC committed Apr 22, 2024
1 parent 9f70454 commit b691766
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.os.CancellationSignal
import androidx.sqlite.db.SimpleSQLiteQuery
import androidx.sqlite.db.SupportSQLiteDatabase
import androidx.sqlite.db.SupportSQLiteOpenHelper
import androidx.sqlite.db.SupportSQLiteProgram
import androidx.sqlite.db.SupportSQLiteQuery
import androidx.sqlite.db.SupportSQLiteStatement
import timber.log.Timber
Expand Down Expand Up @@ -166,9 +167,14 @@ internal class MappingSupportSQLiteDatabase(

private val _sql = map(delegateQuery.sql)
private val sqlDelegate = OneOffDelegate { Timber.tag("MappingSupportSQLiteQuery").e("SQL queried twice") }
private val bindToDelegate = OneOffDelegate { Timber.tag("MappingSupportSQLiteQuery").e("bindTo called twice") }

override val sql: String
get() = sqlDelegate.call { _sql }

override fun bindTo(statement: SupportSQLiteProgram) {
bindToDelegate.call { delegateQuery.bindTo(statement) }
}
}
}

Expand Down

0 comments on commit b691766

Please sign in to comment.