Example #1
0
  public boolean insert(String u_id, OrderGoods orderGoods) {
    SQLiteDatabase mDb = service.openWritableDatabase(u_id);
    ContentValues initialValues = new ContentValues();
    initialValues.put(COLUMN_SHOP_ID, orderGoods.getShopId());
    initialValues.put(COLUMN_GOODS_ID, orderGoods.getGoodsId());
    initialValues.put(COLUMN_GOODS_TYPE, orderGoods.getType());
    initialValues.put(COLUMN_GOODS_NAME, orderGoods.getName());
    initialValues.put(COLUMN_GOODS_PRICE, orderGoods.getPrice());
    initialValues.put(COLUMN_GOODS_SALE_PRICE, orderGoods.getSalePrice());
    initialValues.put(COLUMN_GOODS_NUMBER, orderGoods.getGoodsNumber());

    boolean bool = mDb.insert(TABLE_ORDER, null, initialValues) != -1;
    System.out.println("insert state:" + bool);
    mDb.close();
    service.close();
    return bool;
  }