Exemple #1
0
 def save_spo_query_stat(self, rows):
     u"""rows:
     [
         [srcid, query, pv],
         ...
     ]
     """
     for data in tools.iter_list(rows): 
         sql = "insert into spo_query_stat (`side`,`srcid`,`query`,`pv`,`date`) values %s"
         values = []
         for row in data:
             s = "('%s','%s','%s','%s','%s')" % (self.side, row[0], self.escape_string(row[1]),\
                 row[2], self.date)
             values.append(s)
         values = ",".join(values)
         sql = sql % (values, )
         self.cur.execute(sql)
         self.conn.commit()
Exemple #2
0
 def save_spo_srcid_stat(self, stat, rows):
     u"""rows:
     [
         (srcid, value),
         ...
     ]
         
     """
     for data in tools.iter_list(rows): 
         sql = "insert into spo_srcid_stat (`side`,`srcid`,`stat`,`value`,`date`) \
         values %s"
         values = []
         for srcid, value in data:
             s = "('%s','%s','%s','%s','%s')" % (self.side, srcid, stat, value, self.date)
             values.append(s)
         values = ",".join(values)
         sql = sql % (values, )
         self.cur.execute(sql)
         self.conn.commit()
Exemple #3
0
 def save_midpage_url_stat(self, product_id, rows):
     u"""rows:
     [
         (url, click, show, rate),
         ...
     ]
         
     """
     for data in tools.iter_list(rows): 
         sql = "insert into midpage_url_stat_%s (`product_id`, `side`, `url`, `click_num`,\
             `show_num`, `click_rate`, `date`) values %s"
         values = []
         for line in data:
             s = "('%s','%s','%s','%s','%s','%s','%s')" % (product_id, self.side, line[0],\
                 line[1], line[2], line[3], self.date)
             values.append(s)
         values = ",".join(values)
         sql = sql % (self.month, values)
         self.cur.execute(sql)
         self.conn.commit()