mirror of
https://github.com/moparisthebest/Yaaic
synced 2024-11-12 03:55:01 -05:00
Database: isTitleUsed(): Escape server title (SQLiteException) - Fixes #53
This commit is contained in:
parent
b3fd4157dc
commit
ded6485f6b
@ -31,6 +31,7 @@ import org.yaaic.model.Status;
|
||||
import android.content.ContentValues;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.database.DatabaseUtils;
|
||||
import android.database.sqlite.SQLiteDatabase;
|
||||
import android.database.sqlite.SQLiteOpenHelper;
|
||||
|
||||
@ -66,7 +67,7 @@ public class Database extends SQLiteOpenHelper
|
||||
+ ServerConstants.HOST + " TEXT NOT NULL, "
|
||||
+ ServerConstants.PORT + " INTEGER, "
|
||||
+ ServerConstants.PASSWORD + " TEXT, "
|
||||
+ ServerConstants.AUTOCONNECT + " BOOLEAN, " // XXX: Does SQLLite support boolean?
|
||||
+ ServerConstants.AUTOCONNECT + " BOOLEAN, "
|
||||
+ ServerConstants.USE_SSL + " BOOLEAN, "
|
||||
+ ServerConstants.CHARSET + " TEXT, "
|
||||
+ ServerConstants.IDENTITY + " INTEGER"
|
||||
@ -377,7 +378,7 @@ public class Database extends SQLiteOpenHelper
|
||||
Cursor cursor = this.getReadableDatabase().query(
|
||||
ServerConstants.TABLE_NAME,
|
||||
ServerConstants.ALL,
|
||||
ServerConstants.TITLE + " = '" + title + "'",
|
||||
ServerConstants.TITLE + " = " + DatabaseUtils.sqlEscapeString(title),
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
@ -507,6 +508,7 @@ public class Database extends SQLiteOpenHelper
|
||||
deleteAliases(identityId);
|
||||
|
||||
ContentValues values = new ContentValues();
|
||||
|
||||
for (String alias : aliases) {
|
||||
values.clear();
|
||||
values.put(AliasConstants.ALIAS, alias);
|
||||
|
Loading…
Reference in New Issue
Block a user