use of net.sqlcipher.database.SQLiteDatabase in project greenDAO by greenrobot.
the class EncryptedDbUtils method createDatabase.
public static Database createDatabase(Context context, String dbName, String password) {
if (!loadedLibs) {
loadedLibs = true;
SQLiteDatabase.loadLibs(context);
}
SQLiteDatabase sqLiteDatabase;
if (dbName == null) {
sqLiteDatabase = SQLiteDatabase.create(null, password);
} else {
File dbFile = context.getDatabasePath(dbName);
dbFile.getParentFile().mkdir();
context.deleteDatabase(dbName);
sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase(dbFile, password, null);
}
return new EncryptedDatabase(sqLiteDatabase);
}
use of net.sqlcipher.database.SQLiteDatabase in project storymaker by StoryMaker.
the class ProjectsProvider method delete.
@Override
public int delete(Uri uri, String selection, String[] selectionArgs) {
mCacheWordHandler.connectToService();
setTimer(60000);
SQLiteDatabase db = getDB();
if (db != null) {
int uriType = sURIMatcher.match(uri);
switch(uriType) {
case PROJECTS:
case PROJECT_ID:
return (new ProjectTable(db)).delete(getContext(), uri, selection, selectionArgs);
case SCENES:
case SCENE_ID:
return (new SceneTable(db)).delete(getContext(), uri, selection, selectionArgs);
case LESSONS:
case LESSON_ID:
return (new LessonTable(db)).delete(getContext(), uri, selection, selectionArgs);
case MEDIA:
case MEDIA_ID:
return (new MediaTable(db)).delete(getContext(), uri, selection, selectionArgs);
case AUTH:
case AUTH_ID:
return (new AuthTable(db)).delete(getContext(), uri, selection, selectionArgs);
case TAGS:
case TAG_ID:
case DISTINCT_TAGS:
case DISTINCT_TAG_ID:
return (new TagTable(db)).delete(getContext(), uri, selection, selectionArgs);
case JOBS:
case JOB_ID:
return (new JobTable(db)).delete(getContext(), uri, selection, selectionArgs);
case PUBLISH_JOBS:
case PUBLISH_JOB_ID:
return (new PublishJobTable(db)).delete(getContext(), uri, selection, selectionArgs);
case AUDIO_CLIPS:
case AUDIO_CLIP_ID:
return (new AudioClipTable(db)).delete(getContext(), uri, selection, selectionArgs);
default:
throw new IllegalArgumentException("Unknown URI");
}
}
return 0;
}
use of net.sqlcipher.database.SQLiteDatabase in project storymaker by StoryMaker.
the class ProjectsProvider method insert.
@Nullable
@Override
public Uri insert(Uri uri, ContentValues values) {
mCacheWordHandler.connectToService();
setTimer(60000);
SQLiteDatabase db = getDB();
if (db != null) {
long newId;
int uriType = sURIMatcher.match(uri);
switch(uriType) {
case PROJECTS:
return (new ProjectTable(db)).insert(getContext(), uri, values);
case SCENES:
return (new SceneTable(db)).insert(getContext(), uri, values);
case LESSONS:
return (new LessonTable(db)).insert(getContext(), uri, values);
case MEDIA:
return (new MediaTable(db)).insert(getContext(), uri, values);
case AUTH:
return (new AuthTable(db)).insert(getContext(), uri, values);
case TAGS:
case DISTINCT_TAGS:
return (new TagTable(db)).insert(getContext(), uri, values);
case JOBS:
return (new JobTable(db)).insert(getContext(), uri, values);
case PUBLISH_JOBS:
return (new PublishJobTable(db)).insert(getContext(), uri, values);
case AUDIO_CLIPS:
return (new AudioClipTable(db)).insert(getContext(), uri, values);
default:
throw new IllegalArgumentException("Unknown URI");
}
}
return null;
}
Aggregations