示例#1
0
  def createItem(p_itemName,p_itemType,p_itemPrice,p_itemImg):
    db = doSql()

    query = "SELECT * FROM add_item('"+\
    p_itemPrice+"','"+\
    p_itemName+"','"+\
    p_itemType+"','"+\
    p_itemImg+"');"
        
    item = Item()
    item.setId(0)
    item.setName(p_itemName)
    item.setType(p_itemType)
    item.setPrice(p_itemPrice)
    item.setImg(p_itemImg)
        
    ((status_code,
      ),) = db.execqry(query, True)

    return item
示例#2
0
  def createItemFromId(p_itemId):
    db = doSql()

    if not p_itemId:
      return None

    query = "SELECT * FROM get_item("+str(p_itemId)+");"
    
    ((
      id,
      name,
      iType,
      price,
      imgurl
    ),) = db.execqry(query, False)

    item = Item()
    item.setId(id)
    item.setName(name)
    item.setType(iType)
    item.setPrice(price)
    item.setImg(imgurl)
    
    return item