fix crash when incoming sms invite includes an apostrope in the room

name -- by using rawQuery()
This commit is contained in:
Eric House 2013-12-28 11:30:49 -08:00
parent b2b4c2a1f5
commit 29d5cc5d13

View file

@ -610,19 +610,20 @@ public class DBUtils {
NetLaunchInfo nli ) NetLaunchInfo nli )
{ {
Date result = null; Date result = null;
String[] columns = { DBHelper.CREATE_TIME }; String[] selectionArgs = new String[] {
String selection = DBHelper.ROOMNAME, nli.room,
String.format( "%s='%s' AND %s='%s' AND %s=%d AND %s=%d", DBHelper.INVITEID, nli.inviteID,
DBHelper.ROOMNAME, nli.room, DBHelper.DICTLANG, String.format( "%d", nli.lang ),
DBHelper.INVITEID, nli.inviteID, DBHelper.NUM_PLAYERS, String.format( "%d", nli.nPlayersT )
DBHelper.DICTLANG, nli.lang, };
DBHelper.NUM_PLAYERS, nli.nPlayersT );
initDB( context ); initDB( context );
synchronized( s_dbHelper ) { synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase(); SQLiteDatabase db = s_dbHelper.getReadableDatabase();
Cursor cursor = db.query( DBHelper.TABLE_NAME_SUM, columns, Cursor cursor = db.rawQuery( "SELECT " + DBHelper.CREATE_TIME +
selection, null, null, null, " FROM " + DBHelper.TABLE_NAME_SUM +
DBHelper.CREATE_TIME + " DESC" ); // order by " WHERE ?=? AND ?=? AND ?=? AND ?=?",
selectionArgs );
if ( cursor.moveToNext() ) { if ( cursor.moveToNext() ) {
int indx = cursor.getColumnIndex( DBHelper.CREATE_TIME ); int indx = cursor.getColumnIndex( DBHelper.CREATE_TIME );
result = new Date( cursor.getLong( indx ) ); result = new Date( cursor.getLong( indx ) );