Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. @Override
  2. public void onCreate(SQLiteDatabase db) {
  3. String CONDITIONALLY_CREATE_VENDORS_TABLE = "CREATE TABLE IF NOT EXISTS " +
  4. TABLE_VENDORS + "("
  5. + COLUMN_ID + " INTEGER PRIMARY KEY," + COLUMN_VENDORID
  6. + " TEXT," + COLUMN_COMPANYNAME + " TEXT" + ")";
  7. db.execSQL(CONDITIONALLY_CREATE_VENDORS_TABLE);
  8. // add more tables as needed following the pattern above
  9. }
  10.  
  11. @Override
  12. public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
  13. //db.execSQL("DROP TABLE IF EXISTS " + TABLE_VENDORS); <= Only need to DROP if the table's structure changes; so comment such a line out for the particular table in that case
  14. onCreate(db);
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement