public class

OfflineHelper

extends SQLiteOpenHelper
implements DatabaseHandler
java.lang.Object
   ↳ android.database.sqlite.SQLiteOpenHelper
     ↳ com.kinvey.android.offline.OfflineHelper

Class Overview

This class manages a set of OfflineTables. Tables are not maintained in memory, and are created on demand. This class is used by the OS to access sqllite, and delegates control to the appropriate OfflineTable (with a couple helper methods).

Summary

[Expand]
Inherited Constants
From interface com.kinvey.android.offline.DatabaseHandler
Public Methods
int delete(String table, String whereClause, String[] whereArgs)
List<String> getCollectionTables()
query the metdata table for a list of all collection tables, returning them as a list
GenericJson getEntity(AbstractClient client, AppData appData, String id)
Get an entity directly from an offline table
synchronized static OfflineHelper getInstance(Context context)
This class is a synchronized Singleton, and this is how you get an instance of it.
OfflineTable getTable(String collectionName)
Creates a new collection table, adds it to the metadata table, and returns it
long insert(String table, String nullColumnHack, ContentValues values)
void onCreate(SQLiteDatabase database)
Called by operating system when a new database is created.
void onUpgrade(SQLiteDatabase database, int oldVersion, int newVersion)
Called by operating system when a database needs to be upgraded
Cursor query(String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)
void runCommand(String command)
void setContext(Context context)
int updateWithOnConflict(String table, ContentValues values, String whereClause, String[] whereArgs, int conflictAlgorithm)
[Expand]
Inherited Methods
From class android.database.sqlite.SQLiteOpenHelper
From class java.lang.Object
From interface com.kinvey.android.offline.DatabaseHandler

Public Methods

public int delete (String table, String whereClause, String[] whereArgs)

public List<String> getCollectionTables ()

query the metdata table for a list of all collection tables, returning them as a list

Returns
  • a list of collection table names

public GenericJson getEntity (AbstractClient client, AppData appData, String id)

Get an entity directly from an offline table

Parameters
client - an instance of the client
appData - an instance of appdata
id - the id of the entity to return
Returns
  • the entity with the appdata collection and provided id

public static synchronized OfflineHelper getInstance (Context context)

This class is a synchronized Singleton, and this is how you get an instance of it.

Parameters
context the current active application context
Returns
  • an instance of the OfflineHelper class

public OfflineTable getTable (String collectionName)

Creates a new collection table, adds it to the metadata table, and returns it

Parameters
collectionName - the collection to create a new table for

public long insert (String table, String nullColumnHack, ContentValues values)

public void onCreate (SQLiteDatabase database)

Called by operating system when a new database is created. Don't actually do anything here.

Parameters
database the newly created database

public void onUpgrade (SQLiteDatabase database, int oldVersion, int newVersion)

Called by operating system when a database needs to be upgraded

public Cursor query (String table, String[] columns, String selection, String[] selectionArgs, String groupBy, String having, String orderBy, String limit)

public void runCommand (String command)

public void setContext (Context context)

public int updateWithOnConflict (String table, ContentValues values, String whereClause, String[] whereArgs, int conflictAlgorithm)