Commit f6bd86ea authored by kirk's avatar kirk

prepare for version 22; slight optimization to database helper

parent e1acf811
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="us.rader.wyfy"
android:versionCode="21"
android:versionName="1.21" >
android:versionCode="22"
android:versionName="1.22" >
<uses-sdk
android:minSdkVersion="10"
......
......@@ -90,11 +90,7 @@ public final class WifiSettingsDatabaseHelper extends SQLiteOpenHelper {
*/
public Cursor getAll(SQLiteDatabase db) {
String[] columns = {
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SSID,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_PASSWORD,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SECURITY,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_HIDDEN };
String[] columns = createColumnsForSelection();
Cursor cursor = db.query(
WiFiSettingsContract.WifiSettingsEntry.TABLE_NAME, columns,
null, null, null, null, null);
......@@ -250,6 +246,22 @@ public final class WifiSettingsDatabaseHelper extends SQLiteOpenHelper {
}
}
/**
* Return a string array for use with the SQLite API representing all of the
* columns of the {@link WiFiSettingsContract.WifiSettingsEntry} table
*
* @return column name array
*/
private String[] createColumnsForSelection() {
return new String[] {
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SSID,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_PASSWORD,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SECURITY,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_HIDDEN };
}
/**
* Insert a new row for the current state of the {@link WifiSettings}
* singleton
......@@ -284,11 +296,7 @@ public final class WifiSettingsDatabaseHelper extends SQLiteOpenHelper {
WifiSettings settings = WifiSettings.getInstance();
String ssid = settings.getSsid();
String[] columns = {
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SSID,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_PASSWORD,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SECURITY,
WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_HIDDEN };
String[] columns = createColumnsForSelection();
String selection = WiFiSettingsContract.WifiSettingsEntry.COLUMN_NAME_SSID
+ " LIKE ?"; //$NON-NLS-1$
String[] selectionArgs = { ssid };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment