Class SentrySQLiteDriver

  • All Implemented Interfaces:
    androidx.sqlite.SQLiteDriver

    
    public final class SentrySQLiteDriver
     implements SQLiteDriver
                        

    Wraps a SQLiteDriver and automatically adds spans for each SQL statement it executes.

    Example usage:

    val driver = SentrySQLiteDriver.create(AndroidSQLiteDriver())

    If you use Room:

    val database = Room.databaseBuilder(context, MyDatabase::class.java, "dbName")
        .setDriver(SentrySQLiteDriver.create(AndroidSQLiteDriver()))
        .build()

    If you're using the Sentry Android Gradle Plugin (SAGP) 6.13.0+, wrapping will be performed automatically for Room.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Constructor Detail

    • Method Detail

      • create

         final static SQLiteDriver create(SQLiteDriver delegate)

        Wraps the provided delegate in a SentrySQLiteDriver.

        To avoid duplicate spans, returns the delegate as-is if:

        • it's already wrapped, or

        • it's an androidx.sqlite.driver.SupportSQLiteDriver.

        In the case of (2), wrap the open helper passed to the SupportSQLiteDriver constructor via SentrySupportSQLiteOpenHelper instead.

        Note that wrapping will be performed if the delegate isn't a SupportSQLiteDriver itself but wraps or subclasses one. In that case, ensure the open helper passed to the support driver constructor is not wrapped.