示例#1
0
def updateProfiles(weiboids):
    myconnect = GetConnect()
    for w in weiboids:
        sql = "update profile set is_education = 1 where weiboid = '%s'" % str(
            w)
        print sql
        myconnect.executeDB(sql)
示例#2
0
def updateSchoolers(weiboids, schoolname=None):
    myconnect = GetConnect()
    for w in weiboids:
        sql = "update %s set is_wb_ori_no_pic = 1 where weiboid = '%s'" % (
            schoolname, str(w))
        print sql
        myconnect.executeDB(sql)
def main(sourcetable, destable):
	myconnect = GetConnect()
	sql = "select * from %s" % sourcetable
	numrows = myconnect.getCount(sql)
	myconnect2 = GetConnect()
	for r in xrange(numrows):
		row = myconnect.cursor.fetchone()
		wmd5, weiboid, wcontent = row[0], row[1], row[3]
		segments = str(getSegments(wcontent))
		keywords, is_meaningful = getKeywordsAndIs_Meaningful(wcontent)
		insert_sql = "replace into %s(wmd5, weiboid, segments, keywords, is_meaningful) values('%s', '%s', '%s', '%s', %s)" % (destable, wmd5, weiboid, segments, keywords, is_meaningful)
		try:
			myconnect2.executeDB(insert_sql)
		except Exception, e:
			print "Error %d: %s" % (e.args[0],e.args[1])
def main(sourcetable, destable):
    myconnect = GetConnect()
    sql = "select * from %s" % sourcetable
    numrows = myconnect.getCount(sql)
    myconnect2 = GetConnect()
    for r in xrange(numrows):
        row = myconnect.cursor.fetchone()
        wmd5, weiboid, wcontent = row[0], row[1], row[3]
        segments = str(getSegments(wcontent))
        keywords, is_meaningful = getKeywordsAndIs_Meaningful(wcontent)
        insert_sql = "replace into %s(wmd5, weiboid, segments, keywords, is_meaningful) values('%s', '%s', '%s', '%s', %s)" % (
            destable, wmd5, weiboid, segments, keywords, is_meaningful)
        try:
            myconnect2.executeDB(insert_sql)
        except Exception, e:
            print "Error %d: %s" % (e.args[0], e.args[1])
def updateSchools(weiboids, schooltable):
	myconnect = GetConnect()
	for w in weiboids:
		sql = "update %s set is_profile = 1 where weiboid = '%s'" % (schooltable, str(w))
		#print sql
		myconnect.executeDB(sql)
def updateSchoolers(weiboids, schoolname=None):
	myconnect = GetConnect()
	for w in weiboids:
		sql = "update %s set is_wb_ori_no_pic = 1 where weiboid = '%s'" % (schoolname, str(w))
		print sql
		myconnect.executeDB(sql)
def updateProfiles(weiboids):
	myconnect = GetConnect()
	for w in weiboids:
		sql = "update profile set is_education = 1 where weiboid = '%s'" % str(w)
		print sql
		myconnect.executeDB(sql)