public class DBOpenHelper
extends SQLiteOpenHelper
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DATABASES |
static int |
DB_VERSION |
static java.lang.String |
DEFAULT_DB_NAME |
| Modifier | Constructor and Description |
|---|---|
protected |
DBOpenHelper(java.lang.String encryptionKey,
Context context,
java.lang.String dbName) |
| Modifier and Type | Method and Description |
|---|---|
static void |
changeKey(SQLiteDatabase db,
java.lang.String oldKey,
java.lang.String newKey)
Changes the encryption key on the database.
|
static void |
deleteAllDatabases(Context ctx,
UserAccount userAccount)
Deletes all databases of given user.
|
static void |
deleteAllUserDatabases(Context ctx)
Deletes all remaining authenticated databases.
|
static void |
deleteDatabase(Context ctx,
java.lang.String dbNamePrefix,
UserAccount account,
java.lang.String communityId)
Deletes the underlying database for the specified user and community.
|
static void |
deleteDatabase(Context ctx,
UserAccount account)
Deletes the underlying database for the specified user account.
|
static void |
deleteDatabase(Context ctx,
UserAccount account,
java.lang.String communityId)
Deletes the underlying database for the specified user and community.
|
static java.util.List<java.lang.String> |
getGlobalDatabasePrefixList(Context ctx,
UserAccount account,
java.lang.String communityId)
Returns a list of all prefixes for user databases.
|
static DBOpenHelper |
getOpenHelper(java.lang.String encryptionKey,
Context ctx,
java.lang.String dbNamePrefix,
UserAccount account,
java.lang.String communityId)
Returns the DBOpenHelper instance for the given database name.
|
static DBOpenHelper |
getOpenHelper(java.lang.String encryptionKey,
Context ctx,
UserAccount account)
Returns the DBOpenHelper instance associated with this user account.
|
static DBOpenHelper |
getOpenHelper(java.lang.String encryptionKey,
Context ctx,
UserAccount account,
java.lang.String communityId)
Returns the DBOpenHelper instance associated with this user and community.
|
static java.util.Map<java.lang.String,DBOpenHelper> |
getOpenHelpers()
Returns a map of all DBOpenHelper instances created.
|
static java.util.List<java.lang.String> |
getUserDatabasePrefixList(Context ctx,
UserAccount account,
java.lang.String communityId)
Returns a list of all prefixes for user databases.
|
protected static void |
loadNativeLibrariesIfNeeded() |
void |
onConfigure(SQLiteDatabase db) |
void |
onCreate(SQLiteDatabase db) |
void |
onUpgrade(SQLiteDatabase db,
int oldVersion,
int newVersion) |
static boolean |
removeAllFiles(java.io.File dir)
Removes all files and folders in the given directory recursively as well as removes itself.
|
static boolean |
smartStoreExists(Context ctx,
java.lang.String dbNamePrefix,
UserAccount account,
java.lang.String communityId)
Determines if a smart store currently exists for the given database name, account
and/or community id.
|
static boolean |
smartStoreExists(Context ctx,
UserAccount account,
java.lang.String communityId)
Determines if a smart store currently exists for the given account and/or community id.
|
public static final int DB_VERSION
public static final java.lang.String DEFAULT_DB_NAME
public static final java.lang.String DATABASES
protected DBOpenHelper(java.lang.String encryptionKey,
Context context,
java.lang.String dbName)
public static java.util.Map<java.lang.String,DBOpenHelper> getOpenHelpers()
public static java.util.List<java.lang.String> getUserDatabasePrefixList(Context ctx,
UserAccount account,
java.lang.String communityId)
public static java.util.List<java.lang.String> getGlobalDatabasePrefixList(Context ctx,
UserAccount account,
java.lang.String communityId)
public static DBOpenHelper getOpenHelper(java.lang.String encryptionKey, Context ctx, UserAccount account)
encryptionKey - Password for database.ctx - Context.account - User account.public static DBOpenHelper getOpenHelper(java.lang.String encryptionKey, Context ctx, UserAccount account, java.lang.String communityId)
encryptionKey - Password for database.ctx - Context.account - User account.communityId - Community ID.public static DBOpenHelper getOpenHelper(java.lang.String encryptionKey, Context ctx, java.lang.String dbNamePrefix, UserAccount account, java.lang.String communityId)
encryptionKey - password for database.ctx - Context.dbNamePrefix - The database name. This must be a valid file name without a
filename extension such as ".db".account - User account. If this method is called before authentication,
we will simply return the smart store DB, which is not associated
with any user account. Otherwise, we will return a unique
database at the community level.communityId - Community ID.protected static void loadNativeLibrariesIfNeeded()
public void onConfigure(SQLiteDatabase db)
public void onCreate(SQLiteDatabase db)
public void onUpgrade(SQLiteDatabase db,
int oldVersion,
int newVersion)
public static void deleteDatabase(Context ctx,
UserAccount account)
ctx - Context.account - User account.public static void deleteDatabase(Context ctx,
UserAccount account,
java.lang.String communityId)
ctx - Context.account - User account.communityId - Community ID.public static void deleteDatabase(Context ctx,
java.lang.String dbNamePrefix,
UserAccount account,
java.lang.String communityId)
ctx - Context.dbNamePrefix - The database name. This must be a valid file name without a
filename extension such as ".db".account - User account.communityId - Community ID.public static void deleteAllUserDatabases(Context ctx)
ctx - Context.public static void deleteAllDatabases(Context ctx,
UserAccount userAccount)
ctx - Context.userAccount - User account.public static boolean smartStoreExists(Context ctx,
UserAccount account,
java.lang.String communityId)
ctx - Context.account - User account.communityId - Community ID.public static boolean smartStoreExists(Context ctx,
java.lang.String dbNamePrefix,
UserAccount account,
java.lang.String communityId)
ctx - Context.dbNamePrefix - The database name. This must be a valid file name without a
filename extension such as ".db".account - User account.communityId - Community ID.public static boolean removeAllFiles(java.io.File dir)
dir - Directory to remove all files and folders recursively.public static void changeKey(SQLiteDatabase db,
java.lang.String oldKey,
java.lang.String newKey)
db - Database object.oldKey - Old encryption key.newKey - New encryption key.