Class InMobiDatabaseHelper

  • All Implemented Interfaces:

    
    public final class InMobiDatabaseHelper
    
                        

    This class is responsible for handling the database and managing its CRUD operations.

    • Constructor Detail

      • InMobiDatabaseHelper

        InMobiDatabaseHelper(SQLiteOpenHelper sqLiteOpenHelper, DatabaseConfig databaseConfig)
        Parameters:
        sqLiteOpenHelper - The SQLiteOpenHelper instance.
        databaseConfig - The configuration for the database, including context, name, version, table information, journal mode, and transaction executor.
    • Method Detail

      • init

        @WorkerThread() final Unit init()

        Initializes the database helper by obtaining writable and readable database instances.

      • insertWithOnConflict

         final Unit insertWithOnConflict(String tableName, ContentValues contentValues, Integer conflictAlgorithm)

        Inserts a row into the specified table with conflict resolution.

        Parameters:
        tableName - The name of the table.
        contentValues - The values to insert.
        conflictAlgorithm - The conflict resolution algorithm.
      • insertWithOnConflict

         final Unit insertWithOnConflict(String tableName, List<ContentValues> contentValues)

        Inserts multiple rows into the specified table with conflict resolution.

        Parameters:
        tableName - The name of the table.
        contentValues - The list of values to insert.
      • updateWithOnConflict

         final Unit updateWithOnConflict(String tableName, ContentValues contentValues, String whereClause, Array<String> whereArgs, Integer conflictAlgorithm)

        Updates rows in the specified table with conflict resolution.

        Parameters:
        tableName - The name of the table.
        contentValues - The new values.
        whereClause - The optional WHERE clause to apply when updating.
        whereArgs - The optional arguments for the WHERE clause.
        conflictAlgorithm - The conflict resolution algorithm.
      • delete

         final Unit delete(String tableName, String whereClause, Array<String> whereArgs)

        Deletes rows from the specified table.

        Parameters:
        tableName - The name of the table.
        whereClause - The optional WHERE clause to apply when deleting.
        whereArgs - The optional arguments for the WHERE clause.
      • execSQL

         final Unit execSQL(String query)

        Executes a raw SQL query.

        Parameters:
        query - The SQL query to execute.
      • count

         final Integer count(String query)

        Counts the number of rows that match the specified query.

        Parameters:
        query - The SQL query to count rows.
        Returns:

        The number of rows that match the query.

      • getContentValues

         final List<ContentValues> getContentValues(String query)

        Retrieves a list of ContentValues from the specified query.

        Parameters:
        query - The SQL query to execute.
        Returns:

        A list of ContentValues representing the rows that match the query.