/** @return First record */
  public SettingsWeather getSavedSettings() {
    SettingsWeather setting = new SettingsWeather();

    Cursor cursor =
        database.query(
            UserSettingsDbHelper.TABLE,
            allColumns,
            null,
            null,
            null,
            null,
            UserSettingsDbHelper.COLUMN_ID);

    int numRecs = 0;
    cursor.moveToFirst();
    if (!cursor.isAfterLast()) {
      // Get first record
      setting = cursorToSettingsWeather(cursor);
      numRecs++;
    }
    setting.setCountDbReturn(numRecs);

    // make sure to close the cursor
    cursor.close();
    return setting;
  }
  private SettingsWeather cursorToSettingsWeather(Cursor cursor) {
    String city, st, zip;
    SettingsWeather settingW = new SettingsWeather();

    settingW.setID(cursor.getInt(0));
    settingW.setPanelSelect(cursor.getInt(1));

    if (GlobalSettings.city_list_db_data)
      Log.d(
          UserSettingsDbData.class.getName() + "cursorToSettingsWeather()",
          "cursor.getInt(0): " + cursor.getInt(0) + ", cursor.getInt(1): " + cursor.getInt(1));

    return settingW;
  }
  public long insertSetting(SettingsWeather settingsW) {
    ContentValues values = new ContentValues();

    values.put(UserSettingsDbHelper.COLUMN_BACKGROUND_COLOR, settingsW.getBackgroundColor());
    values.put(UserSettingsDbHelper.COLUMN_CITY_LIST_SORT, settingsW.getCityStateListSort());
    values.put(UserSettingsDbHelper.COLUMN_DISPLAY_TYPE, settingsW.getPanelSelectInt());
    long insertId = database.insert(UserSettingsDbHelper.TABLE, null, values);
    //	    if(insertId != -1) {
    //		    Cursor cursor = database.query(CityListDbHelper.TABLE,
    //		        allColumns, CityListDbHelper.COLUMN_ID + " = " + insertId, null,
    //		        null, null, null);
    //		    cursor.moveToFirst();
    //		    newBuilding = cursorToBuilding(cursor);
    //		    cursor.close();
    //	    }
    if (GlobalSettings.city_list_db_data)
      Log.d(UserSettingsDbData.class.getName() + "insertSetting()", "insertId: " + insertId);

    return insertId;
  }
  public long updateSetting(SettingsWeather settingsW) {

    ContentValues values = new ContentValues();

    SettingsWeather swFirst = getSavedSettings(); // gets first record.  Update this using the ID

    values.put(UserSettingsDbHelper.COLUMN_BACKGROUND_COLOR, settingsW.getBackgroundColor());
    values.put(UserSettingsDbHelper.COLUMN_CITY_LIST_SORT, settingsW.getCityStateListSort());
    values.put(UserSettingsDbHelper.COLUMN_DISPLAY_TYPE, settingsW.getPanelSelectInt());
    long insertId =
        database.update(
            UserSettingsDbHelper.TABLE,
            values,
            UserSettingsDbHelper.COLUMN_ID + " = " + swFirst.getID(),
            null);

    if (GlobalSettings.city_list_db_data)
      Log.d(UserSettingsDbData.class.getName() + "updateSetting()", "insertId: " + insertId);
    return insertId;
  }