Ok so I've been able to place crazy amounts of logs every where and it does see 
to call onUpgrade to the next version and it is able to drop the table. 

I want validate the sql that its generating in order to get all the items. is 
there a way to get the raw sql that it's generating. I feel like i may be doing 
something wrong, rather I know I'm doing something wrong I just don't know... 

clearReset was a function I created in order to drop the table and reset it 
with preset data. it can be ignored.

I will try to find the db in the emulator by adb maybe I might surprise myself.


Albert Rosa
rosalb...@gmail.com
alb...@albert-rosa.com
(m) 718-825-7838
(aim) albertrosa2000
(gchat) rosalbert
(gvoice) (646) 389-7672

On May 3, 2011, at 11:55 AM, Kostya Vasilyev wrote:

> No idea what clearReset is, but....
> 
> Call SQLiteDatabase.getVersion() somewhere, just to make sure your db's 
> version is not already 10 (which would mean that there is nothing to upgrade).
> 
> -- Kostya
> 
> PS - Can I use butter instead of cooking spray? :)
> 
> 03.05.2011 18:09, Albert Rosa пишет:
>> Yes I changed the VERSION number on both the dbHelper file as well as the 
>> manifest
>> 
>> below is the code for the db helper:
>> 
>> public class RecipeDbHelper extends SQLiteOpenHelper {
>> 
>> 
>>      private static final String DATABASE_NAME = "test";
>>      private static final String DATABASE_TABLE = "recipe";
>>      private static final int DATABASE_VERSION = 10;
>>      
>>      private static final String DATABASE_CREATE = "CREATE TABLE recipe ( 
>> _id INTEGER PRIMARY KEY, title text not null, ingredients text not null, 
>> instructions text not null, mealtime INTEGER not null, calories INTEGER not 
>> null);";
>>      
>>      private static final String INITIAL_SETUP =
>>              "INSERT INTO recipe (_id, title, instructions,ingredients, 
>> mealtime, calories) "
>>              + "VALUES (1, 'Triple Veggie Scramble','1. Chop all veggies and 
>> set aside. Whisk eggs in bowl.\n2. Spray nonstick skillet with cooking spray 
>> and saute veggies until soft.\n3. Add whisked eggs, cheese and dash salt and 
>> pepper and cook until eggs are firm. \n4. Serve on toasted english muffin 
>> with sliced pear on the side.',"
>>              +"'3 eggs (1 whole + 2 whites) \n1\\2 cup each chopped 
>> tomatoes, spinach and mushrooms\n1 oz reduced fat shredded cheddar cheese\n1 
>> Thomas Light Multigrain english muffin\nSmall pear, sliced.\nsalt/pepper to 
>> taste', 1, 124);"
>>              ;
>>              
>>      public RecipeDbHelper(Context context){
>>              super(context, DATABASE_NAME, null, DATABASE_VERSION);
>>      }
>>      
>>      public void clearReset(SQLiteDatabase db) {
>>              Log.w("Upgrading", "Upgrading database from version");
>>              db.execSQL("DROP TABLE IF EXISTS "+ DATABASE_TABLE);
>>              onCreate(db);
>>      }
>>      
>>      @Override
>>      public void onCreate(SQLiteDatabase db){
>>              db.execSQL(DATABASE_CREATE);
>>              db.execSQL(INITIAL_SETUP);
>>      }
>>      
>>      @Override
>>      public void onUpgrade(SQLiteDatabase db, int oldVersion, int 
>> newVersion){
>>              Log.w("Upgrading", "Upgrading database from version " + 
>> oldVersion + " to "
>>                 + newVersion + ", which will destroy all old data");
>>         db.execSQL("DROP TABLE IF EXISTS "+ DATABASE_TABLE);
>>         onCreate(db);
>>      }
>> 
>> thanks again I truly appreciate it.
>> 
>> Albert Rosa
>> rosalb...@gmail.com
>> alb...@albert-rosa.com
>> (m) 718-825-7838
>> (aim) albertrosa2000
>> (gchat) rosalbert
>> (gvoice) (646) 389-7672
> 
> 
> -- 
> Kostya Vasilyev -- http://kmansoft.wordpress.com
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to