Code example for SQLiteStatement

Methods: bindDouble, bindLong, bindNull, bindString, clearBindings, executeInsert

0
      insertStatement = db.compileStatement(INSERT);
   } 
 
   @Override 
   public long save(Item entity) {
      insertStatement.clearBindings();
      insertStatement.bindString(1, entity.getName());
      insertStatement.bindString(2, entity.getImageUrl());
      insertStatement.bindLong(3, entity.getSku());
      if(entity.getShortDescrption() == null) insertStatement.bindNull(4);
      else insertStatement.bindString(4, entity.getShortDescrption());
      if(entity.getLongDescption() == null) insertStatement.bindNull(5);
      else insertStatement.bindString(5, entity.getLongDescption());
      insertStatement.bindString(6, entity.getOrderable());
      insertStatement.bindString(7, Integer.toString(entity.getInstoreAvail()));
      insertStatement.bindDouble(8, entity.getCurrPrice());
      insertStatement.bindString(9, entity.getDate());
      
      return insertStatement.executeInsert();
   } 
    
   public Item find(long sku) {
      long itemId = 0L;
      String sql = "select _id from " + ItemTable.TABLE_NAME + " where " + ItemColumns.SKU + " = " + sku;