mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-29 08:34:37 +01:00
getter for new pairs DB
This commit is contained in:
parent
b636fe263b
commit
901e07c0aa
1 changed files with 21 additions and 0 deletions
|
@ -1786,6 +1786,27 @@ public class DBUtils {
|
|||
return result;
|
||||
}
|
||||
|
||||
public static String getStringFor( Context context, String key, String dflt )
|
||||
{
|
||||
String selection = String.format( "%s = '%s'", DBHelper.KEY, key );
|
||||
String[] columns = { DBHelper.VALUE };
|
||||
|
||||
initDB( context );
|
||||
synchronized( s_dbHelper ) {
|
||||
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
|
||||
Cursor cursor = db.query( DBHelper.TABLE_NAME_PAIRS, columns,
|
||||
selection, null, null, null, null );
|
||||
Assert.assertTrue( 1 >= cursor.getCount() );
|
||||
int indx = cursor.getColumnIndex( DBHelper.VALUE );
|
||||
if ( cursor.moveToNext() ) {
|
||||
dflt = cursor.getString( indx );
|
||||
}
|
||||
cursor.close();
|
||||
db.close();
|
||||
}
|
||||
return dflt;
|
||||
}
|
||||
|
||||
private static void copyGameDB( Context context, boolean toSDCard )
|
||||
{
|
||||
String name = DBHelper.getDBName();
|
||||
|
|
Loading…
Add table
Reference in a new issue