title: Android: duplicate values are being inserted in to database
body: <p>Each time i run the project same values are also being inserted in the android database. Even i have given the drop if exists  query.What i need is that the data in the database gets updated only if there are some changes in the response from the server side instead of cresting database every time but what is happening with me is that same values got insertes again in the tables. How do I solve this?   Following is my code:</p>
  
  <pre><code>     public  void onCreate(SQLiteDatabase database) {
          try{
          //  onUpgrade(database, oldVersion, newVersion)
          database.execSQL(DATABASE_CREATE);
  
      }
      catch (Exception e) {
          System.out.println("in on create db"+e);
      }}
  
      public void onUpgrade(SQLiteDatabase database, int oldVersion,
              int newVersion) {
          database.execSQL("DROP TABLE IF EXISTS" +DATABASE_CREATE);
          onCreate(database);
      }
  
  
   private static final String INSERT = "insert into " 
           + DATABASE_TABLE + "(KEY_TYPE,KEY_ENCODING,KEY_WIDTH,KEY_HEIGHT,KEY_DATA,KeyIId)"+" values (?,?,?,?,?,?)";
         public WineDatabaseAdapter(Context context) {
           try{
             this.context = context;
             openHelper = new WineDatabaseHelper(context);
             this.db=openHelper.getWritableDatabase();
            this.insertStmt=this.db.compileStatement(INSERT);
  
         }
         catch(Exception e)
         {
             System.out.println(e);
         }
         }
  </code></pre>
  
  <p>Can anyone help me how to solve this problem.</p>
  
  <p>Thanks</p>