0

ok - before you guys go start down voting and saying its a duplicate :)
Looked at so and no such column in so does not seem to describe what I am facing
My app is published on google playstore and now I am seeing some crashes with this error:

Caused by: android.database.sqlite.SQLiteException: no such column: quizid (code 1): , while compiling: select quizid,count(qid) from quiz group by quizid

I have tested the same functionality on my phone and in debug mode from android development toolkit and it works for me
Yet it seems to have failed for a few users

Couple of differences / additional pointers
The field name in the db is 'quizId' while in my query it is 'quizid'
Yes it should have been the same case and I will correct it in my correction release - but is that really an issue - i do not think field names in sqllite are case sensitive

also I should state that - the database field 'quizId' is an additional field to an existing table in sqllite database
so people would already have had a different table definition in the older version of the app

so has this something to do with - DATABASE_VERSION
I dont remember if I changed its version ( currently it stands at 2 ) and unfortunately I did not maintain earlier versions
thank you!
Here is the relevant code :

public class QuizDao extends SQLiteOpenHelper {  
  private static final int DATABASE_VERSION = 2;  
  private static final String TABLE_QUIZ = "quiz";
  private static final String CREATE_TABLE_QUIZ = "CREATE TABLE " +    
  TABLE_QUIZ + "(" + " qid INTEGER PRIMARY KEY," + " quizId INTEGER " + ");";  

  public QuizDao (Context context) {
    super(context, "quiz.db", null, DATABASE_VERSION);
  }  
    @Override
public void onCreate(SQLiteDatabase dataBase) {
    try {
        dataBase.execSQL(CREATE_TABLE_QUIZ);
    } catch (SQLiteException e) {
    }
}

@Override
public void onUpgrade(SQLiteDatabase dataBase, int oldVersion,
        int newVersion) {

    dataBase.execSQL("DROP TABLE IF EXISTS " + TABLE_QUIZ);

    onCreate(dataBase);
}  
}  
eXamScripts
  • 447
  • 1
  • 4
  • 11

0 Answers0