summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Redestig <johan.redestig@sonyericsson.com>2010-12-15 09:21:55 +0100
committerJohan Redestig <johan.redestig@sonyericsson.com>2010-12-17 10:00:56 +0100
commit1bf26926cc3c48e66f5ac68f5a4f229e54680206 (patch)
treed48342670693a6df628f0b89e88baaf7024d1bdf
parenta123fb474de7b49c067e3e812129495a5cacd103 (diff)
downloadGallery3D-1bf26926cc3c48e66f5ac68f5a4f229e54680206.tar.gz
Make the get/deletePhoto queries locale safe.
The get/deletePhoto queries were using String.format with default locale, which is not locale safe. Switching to selection args to build the queries. Change-Id: I60fab493b54f398864e3e923218d0f8f3d67be82
-rw-r--r--src/com/cooliris/media/PhotoAppWidgetProvider.java9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/com/cooliris/media/PhotoAppWidgetProvider.java b/src/com/cooliris/media/PhotoAppWidgetProvider.java
index cca6413..4c0a8d9 100644
--- a/src/com/cooliris/media/PhotoAppWidgetProvider.java
+++ b/src/com/cooliris/media/PhotoAppWidgetProvider.java
@@ -155,8 +155,9 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider {
Bitmap bitmap = null;
try {
SQLiteDatabase db = getReadableDatabase();
- String selection = String.format("%s=%d", FIELD_APPWIDGET_ID, appWidgetId);
- c = db.query(TABLE_PHOTOS, PHOTOS_PROJECTION, selection, null, null, null, null, null);
+ String[] selectionArgs = { String.valueOf(appWidgetId) };
+ c = db.query(TABLE_PHOTOS, PHOTOS_PROJECTION, FIELD_APPWIDGET_ID + "=?",
+ selectionArgs, null, null, null, null);
if (c != null && LOGD) {
Log.d(TAG, "getPhoto query count=" + c.getCount());
@@ -184,8 +185,8 @@ public class PhotoAppWidgetProvider extends AppWidgetProvider {
public void deletePhoto(int appWidgetId) {
try {
SQLiteDatabase db = getWritableDatabase();
- String whereClause = String.format("%s=%d", FIELD_APPWIDGET_ID, appWidgetId);
- db.delete(TABLE_PHOTOS, whereClause, null);
+ String[] selectionArgs = { String.valueOf(appWidgetId) };
+ db.delete(TABLE_PHOTOS, FIELD_APPWIDGET_ID + "=?", selectionArgs);
} catch (SQLiteException e) {
Log.e(TAG, "Could not delete photo from database", e);
}