예제 #1
0
def processEn():
    """
        处理英文描述软件
    """
    try:
        hasNotes = getHasNoteEns()
        noNotes = getNoNoteEns()
        sql = 'update adappls set note_en = \'%s\' where name = \'%s\' and (note_en is null or note_en = \'\') ' 
        i = 0
        params = []
        count = len(noNotes)
        print count
        for n in noNotes:
            param = []
            name = n[0] if n[0] != None else ''
            if hasNotes.has_key(name.upper()):
                i += 1
                note = hasNotes[name.upper()]
                try:
                    print sql%(note.replace('\'','\\\''), name.replace('\'','\\\''))
                    mysql_utils.excute(sql%(note.replace('\'','\\\''), name.replace('\'','\\\'')), con_params)
                except:
                    print traceback.format_exc()    
        print i
    except:
        print traceback.format_exc()
예제 #2
0
def process():
    sql = 'select mid, uid, content from ( SELECT min(id) as mid, uid, content, count(*) as sc FROM appl_reviews WHERE trashed = \'0\' and app_type = \'1\' and uid = \'秦友\'  group by uid,content) a where sc > 1'
    #sql = 'select mid, uid, content from ( SELECT min(id) as mid, uid, content, count(*) as sc FROM appl_reviews WHERE uid = \'userid\' group by uid,content) a where sc > 1'
    updateSql = 'update appl_reviews set trashed = \'1\' where  uid = \'%s\' and content = \'%s\' and id != %s ' 
    try:
        datas = getdbdatas(sql)
        for r in datas:
            mid = r[0] if r[0] != None else ''
            uid = r[1] if r[1] != None else ''
            content = r[2] if r[2] != None else ''
            print str(mid) + uid + content
            mysql_utils.excute(updateSql%(uid, content, mid), con_params)
            
    except:
        print traceback.format_exc()
예제 #3
0
def process():
    try:
        hasNotes = getHasNotes()
        noNotes = getNoNotes()
        print len(hasNotes)
        print len(noNotes)
        sql = 'update syappls set note = \'%s\' where name = \'%s\' and (note is null or note = \'\') ' 
        i = 0
        params = []
        count = len(noNotes)
        for n in noNotes:
            i += 1
            param = []
            name = n[0] if n[0] != None else ''
            if hasNotes.has_key(name.upper()):
                note = hasNotes[name.upper()]
                mysql_utils.excute(sql%(note.replace('\'','\\\''), name.replace('\'','\\\'')), con_params)
                #param.append(hasNotes[name])
                #param.append(name)
                #params.append(param)
            '''判断是否执行完成'''
            
            """
            if i == count:
                if len(params) > 0:
                    print len(params)
                    print params
                    #mysql_utils.excuteMany(sql, params, con_params)
                    params = []
                    break
            
            '''每1000条更新一次'''
            if i%1000 == 0:
                if len(params) > 0:
                    print len(params)
                    print params
                    #mysql_utils.excuteMany(sql, params, con_params)
                    params = []
                    continue
            """
        print i
    except:
        print traceback.format_exc()