Ejemplo n.º 1
0
  def commit(self):
    db = doSql()

    db.execqry("SELECT * FROM update_post("+\
	str(self.id)+",'"+\
	self.reply+"','"+\
	self.date+"');", True)
Ejemplo n.º 2
0
 def commit(self):
   db = doSql()
   
   db.execqry("SELECT * FROM update_product("+\
   str(self.prodId)+",'"+\
   self.prodName+",'"+\
   self.prodDim+",'"+\
   self.prodPrice+",'"+\
   self.prodCapacity+",'"+\
   self.prodType+");", True)
Ejemplo n.º 3
0
  def createUser(p_username,p_password,p_email):
    db = doSql()

    query = "SELECT * FROM add_user('"+\
    p_username+"','"+\
    p_password+"','"+\
    p_email+"');"
        
    ((status_code,
      ),) = db.execqry(query, True)

    return status_code
Ejemplo n.º 4
0
  def createItemList():
    db = doSql()

    query = "SELECT * FROM get_all_items();"
    rawItemList = db.execqry(query, False)
    itemList = []

    if len(rawItemList) > 0 and not rawItemList[0] == ['None']:
      for i in rawItemList:
        from factory_item import ItemFactory
      
        itemList += [ItemFactory.createItemFromId(i[0]).getItem()]

    return itemList
Ejemplo n.º 5
0
    def createLogList():
        db = doSql()

        query = "SELECT * FROM get_all_logs();"
        rawLogList = db.execqry(query, False)
        #raise Exception(rawPostList)
        logList = []

        if len(rawLogList) > 0 and not rawLogList[0] == ['None']:
            for i in rawLogList:
                from factory_log import LogFactory

                logList += [LogFactory.createLogFromId(i[0]).getLog()]
        return logList
Ejemplo n.º 6
0
    def createLog(p_foo, p_val, p_ret):
        db = doSql()

        log = Log()
        log.setFoo(p_foo)
        log.setVal(p_val)
        log.setRet(p_ret)

        query = "SELECT * FROM add_log('"+\
        log.getLog()["function"]+"','"+\
        log.getLog()["value"]+"','"+\
        str(c_date.now())+"','"+\
        log.getLog()["return"]+"');"

        ((status_code, ), ) = db.execqry(query, True)

        return status_code
Ejemplo n.º 7
0
    def createLogFromId(p_logId):
        db = doSql()

        if not p_logId:
            return None

        query = "SELECT * FROM get_log(" + str(p_logId) + ");"

        ((id, foo, val, date, ret), ) = db.execqry(query, False)

        log = Log()
        log.setId(id)
        log.setFoo(foo)
        log.setVal(val)
        log.setDate(date)
        log.setRet(ret)

        return log
Ejemplo n.º 8
0
  def createUserFromId(p_userId):
    db = doSql()

    if not p_userId:
      return None

    query = "SELECT * FROM get_user("+str(p_userId)+");"
        
    ((
      id,
      username,
      uType
    ),) = db.execqry(query, False)

    user = User()
    user.setId(id)
    user.setName(username)
    user.setType(uType)

    return user
Ejemplo n.º 9
0
  def createItemPage(index, offset):
    db = doSql()
    
    query = "SELECT * FROM get_item_section("+str(index)+","+str(offset)+");"
    rawItemList = db.execqry(query, False)
    
    itemList = []

    if len(rawItemList) > 0 and not rawItemList[0] == ['None']:
      for i in rawItemList:  
        from factory_item import ItemFactory
      
        try: 
          itemList += [ItemFactory.createItemFromId(i[0]).getItem()]
        except ValueError:
          pass

    #raise Exception(itemList)
    return itemList
    
Ejemplo n.º 10
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
Ejemplo n.º 11
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