title: Android Crash SQLite Unable to Replicate
body: <p>I have an Android App published in which I updated to a new version adding a SQLite database.  All of my testing seems to work fine.  However, since I've had about 300 users update since release in past 2 days, I have had 9 users reports the exact same crash.  </p>
  
  <p>The error comes on the very first call to the SQLite database.  So my first thought is that the SQLite database create and initial insert statements are not complete prior to that first call. </p>
  
  <p>Here is the error:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity 
  ComponentInfo{com.janzen.bodybuildingdiet/com.janzen.bodybuildingdiet.DietActivity}:    
  android.database.sqlite.SQLiteException: near "=": syntax error (code 1): , while   
  compiling: UPDATE DAYMEAL SET DAY_INT=
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2653)
  at android.app.ActivityThread.access$800(ActivityThread.java:156)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1355)
  at android.os.Handler.dispatchMessage(Handler.java:102)
  at android.os.Looper.loop(Looper.java:157)
  at android.app.ActivityThread.main(ActivityThread.java:5872)
  at java.lang.reflect.Method.invokeNative(Native Method) 
  at java.lang.reflect.Method.invoke(Method.java:515)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:674)
  at dalvik.system.NativeStart.main(Native Method)
  Caused by: android.database.sqlite.SQLiteException: near "=": syntax error (code 1): ,    
  while compiling: UPDATE DAYMEAL SET DAY_INT=
  at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
  at   
   android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:923)
  at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:534)
  at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
  at android.database.sqlite.SQLiteProgram.&lt;init&gt;(SQLiteProgram.java:58)
  at android.database.sqlite.SQLiteQuery.&lt;init&gt;(SQLiteQuery.java:37)
  at  android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:65)
  at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1370)
  at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1309)
  at com.janzen.bodybuildingdiet.StatusData.updateFieldDayMeal(StatusData.java:1083)
  at com.janzen.bodybuildingdiet.DietActivity.setupInitialDay(DietActivity.java:124)
  at com.janzen.bodybuildingdiet.DietActivity.onCreate(DietActivity.java:103)
  at android.app.Activity.performCreate(Activity.java:5312)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1111)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2552)
  </code></pre>
  
  <p>Here is the method for UPDATE DAYMEAL where the error happens, however I do not think this method's code is the problem as it works well in other parts of the App)</p>
  
  <pre><code>    public void updateFieldDayMeal(String updateArray[]) {
      open();
      String fieldToUpdate = updateArray[0];
      String valueToUpdate = updateArray[1];
      String query = "UPDATE DAYMEAL SET " + fieldToUpdate + "="
              + valueToUpdate;
      Cursor c = db.rawQuery(query, null);
      c.moveToFirst();
      c.close();
      db.close();
  }
  </code></pre>
  
  <p>Here is my onCreate (in my Main Activity for the App) and setupInitialDay method which makes the call to the SQLite class:</p>
  
  <pre><code>    @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_diet);
  
      statusData = new StatusData(getBaseContext());
      setupButtons();
      setupProgressBar();
      setupInitialDay();
      setupValues();
  
      firstTime();
      populateDietList();
      registerClickCallback();
  
      Appirater.appLaunched(this);
  
  }
  
  private void setupInitialDay(){
  
      SimpleDateFormat sdf = new SimpleDateFormat("EEEE");
      Date d = new Date();
      String dayOfTheWeek = mic.dayWeekNumber(sdf.format(d));
  
      String [] updateArray = new String[] { "day_int", dayOfTheWeek };
      statusData.updateFieldDayMeal(updateArray);
  }
  
  public String dayWeekNumber (String day) {
      String dayNum = "";
      if (day.equals("Sunday")) {
          dayNum = "7";
      } else if (day.equals("Tuesday")) {
          dayNum = "2";
      } else if (day.equals("Wednesday")) {
          dayNum = "3";
      } else if (day.equals("Thursday")) {
          dayNum = "4";
      } else if (day.equals("Friday")) {
          dayNum = "5";
      } else if (day.equals("Saturday")) {
          dayNum = "6";
      } else if (day.equals("Monday") {
          dayNum = "1";
      }
      return dayNum;
  }
  </code></pre>