# RoomDatabase.QueryCallback

# RoomDatabase.QueryCallback

Artifact:[androidx.room:room-runtime](https://developer.android.com/jetpack/androidx/releases/room)  
[View Source](https://cs.android.com/search?q=file:androidx/room/RoomDatabase.android.kt+class:androidx.room.RoomDatabase.QueryCallback)  
Added in[2.3.0](https://developer.android.com/jetpack/androidx/releases/room#2.3.0)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/room/RoomDatabase.QueryCallback "View this page in Java")
Common/AllAndroid/JVMNative/C/iOSJavaScript
  - android  

  ```
  fun interface RoomDatabase.QueryCallback
  ```

*** ** * ** ***

Callback interface for when SQLite queries are executed.

Can be set using[RoomDatabase.Builder.setQueryCallback](https://developer.android.com/reference/kotlin/androidx/room/RoomDatabase.Builder#setQueryCallback(androidx.room.RoomDatabase.QueryCallback,java.util.concurrent.Executor)).

## Summary

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onQuery](https://developer.android.com/reference/kotlin/androidx/room/RoomDatabase.QueryCallback#onQuery(kotlin.String,kotlin.collections.List))`(sqlQuery: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)`, bindArgs: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?>)` Called when a SQL query is executed. | android |

## Public functions

### onQuery

android  
Added in[2.3.0](https://developer.android.com/jetpack/androidx/releases/room#2.3.0)  

```
fun onQuery(sqlQuery: String, bindArgs: List<Any?>): Unit
```

Called when a SQL query is executed.  

|                                                                                       Parameters                                                                                        |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|
| `sqlQuery: `[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                           | The SQLite query statement.                                |
| `bindArgs: `[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?>` | Arguments of the query if available, empty list otherwise. |