diff options
author | Ben Murdoch <benm@google.com> | 2010-10-14 07:48:43 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-14 07:48:43 -0700 |
commit | daece2e96475d269ea54cd92a290a787071e7298 (patch) | |
tree | 076100cbe30aa8575bcabf830f120765daae6153 /src/com/android/browser/AutoFillProfileDatabase.java | |
parent | 5a49c5977c23f720aa70266e99b93f931869d16c (diff) | |
parent | 36a23dd3e46167507070bd9f0e6237570d721b2f (diff) | |
download | packages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.zip packages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.tar.gz packages_apps_Browser-daece2e96475d269ea54cd92a290a787071e7298.tar.bz2 |
Merge "Full profile editor and syncing with WebSettings."
Diffstat (limited to 'src/com/android/browser/AutoFillProfileDatabase.java')
-rw-r--r-- | src/com/android/browser/AutoFillProfileDatabase.java | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/src/com/android/browser/AutoFillProfileDatabase.java b/src/com/android/browser/AutoFillProfileDatabase.java index 5557aaf..0204d7e 100644 --- a/src/com/android/browser/AutoFillProfileDatabase.java +++ b/src/com/android/browser/AutoFillProfileDatabase.java @@ -29,7 +29,7 @@ public class AutoFillProfileDatabase { static final String LOGTAG = "AutoFillProfileDatabase"; static final String DATABASE_NAME = "autofill.db"; - static final int DATABASE_VERSION = 1; + static final int DATABASE_VERSION = 2; static final String PROFILES_TABLE_NAME = "profiles"; private AutoFillProfileDatabaseHelper mOpenHelper; private static AutoFillProfileDatabase sInstance; @@ -39,6 +39,14 @@ public class AutoFillProfileDatabase { static final String FULL_NAME = "fullname"; static final String EMAIL_ADDRESS = "email"; + static final String COMPANY_NAME = "companyname"; + static final String ADDRESS_LINE_1 = "addressline1"; + static final String ADDRESS_LINE_2 = "addressline2"; + static final String CITY = "city"; + static final String STATE = "state"; + static final String ZIP_CODE = "zipcode"; + static final String COUNTRY = "country"; + static final String PHONE_NUMBER = "phone"; } private static class AutoFillProfileDatabaseHelper extends SQLiteOpenHelper { @@ -51,7 +59,15 @@ public class AutoFillProfileDatabase { db.execSQL("CREATE TABLE " + PROFILES_TABLE_NAME + " (" + Profiles._ID + " INTEGER PRIMARY KEY," + Profiles.FULL_NAME + " TEXT," - + Profiles.EMAIL_ADDRESS + " TEXT" + + Profiles.EMAIL_ADDRESS + " TEXT," + + Profiles.COMPANY_NAME + " TEXT," + + Profiles.ADDRESS_LINE_1 + " TEXT," + + Profiles.ADDRESS_LINE_2 + " TEXT," + + Profiles.CITY + " TEXT," + + Profiles.STATE + " TEXT," + + Profiles.ZIP_CODE + " TEXT," + + Profiles.COUNTRY + " TEXT," + + Profiles.PHONE_NUMBER + " TEXT" + " );"); } @@ -80,19 +96,49 @@ public class AutoFillProfileDatabase { } public void addOrUpdateProfile(final int id, AutoFillProfile profile) { - final String SQL = "INSERT OR REPLACE INTO " + PROFILES_TABLE_NAME + " (" + final String sql = "INSERT OR REPLACE INTO " + PROFILES_TABLE_NAME + " (" + Profiles._ID + "," + Profiles.FULL_NAME + "," - + Profiles.EMAIL_ADDRESS - + ") VALUES (?,?,?);"; - final Object[] PARAMS = { id, profile.getFullName(), profile.getEmailAddress() }; - getDatabase(true).execSQL(SQL, PARAMS); + + Profiles.EMAIL_ADDRESS + "," + + Profiles.COMPANY_NAME + "," + + Profiles.ADDRESS_LINE_1 + "," + + Profiles.ADDRESS_LINE_2 + "," + + Profiles.CITY + "," + + Profiles.STATE + "," + + Profiles.ZIP_CODE + "," + + Profiles.COUNTRY + "," + + Profiles.PHONE_NUMBER + + ") VALUES (?,?,?,?,?,?,?,?,?,?,?);"; + final Object[] params = { id, + profile.getFullName(), + profile.getEmailAddress(), + profile.getCompanyName(), + profile.getAddressLine1(), + profile.getAddressLine2(), + profile.getCity(), + profile.getState(), + profile.getZipCode(), + profile.getCountry(), + profile.getPhoneNumber() }; + getDatabase(true).execSQL(sql, params); } public Cursor getProfile(int id) { - final String[] COLS = {Profiles.FULL_NAME, Profiles.EMAIL_ADDRESS }; - final String[] SEL_ARGS = { Integer.toString(id) }; - return getDatabase(false).query(PROFILES_TABLE_NAME, COLS, Profiles._ID + "=?", SEL_ARGS, + final String[] cols = { + Profiles.FULL_NAME, + Profiles.EMAIL_ADDRESS, + Profiles.COMPANY_NAME, + Profiles.ADDRESS_LINE_1, + Profiles.ADDRESS_LINE_2, + Profiles.CITY, + Profiles.STATE, + Profiles.ZIP_CODE, + Profiles.COUNTRY, + Profiles.PHONE_NUMBER + }; + + final String[] selectArgs = { Integer.toString(id) }; + return getDatabase(false).query(PROFILES_TABLE_NAME, cols, Profiles._ID + "=?", selectArgs, null, null, null, "1"); } |