def getContestDetail(self, cid): whereclause = ' cid = {} '.format(cid) sql = getQuerySQL('contest', whereclause, ' cid ') rs = FetchOne(sql) return rs
def getPID(self, oj, prob): sql = getQueryDetailSQL( 'problem', ' virtualOJ,virtualProb ', ' originOJ = "{}" and originProb = "{}" '.format(oj, prob), ' pid ') rs = FetchOne(sql) return rs
def getContestStatus(self, cid): sql = getQueryDetailSQL(' contest ', ' cstatus ', ' cid = {} '.format(cid), ' 1=1 ') rs = FetchOne(sql) return rs[0]
def getContestStatus(self, cid): sql = getQuerySQL('contest', ' cid = {} '.format(cid), ' cid ') # print(sql) rs = FetchOne(sql) return rs[10]
def UpdateProblemDetail(problem, pid): pretreat_ProblemDetail(problem) sql = getQuerySQL('problemdetail', ' pid={} '.format(pid), ' did ') rs = FetchOne(sql) if rs is None: InsertProblemDetail(problem) else: clause = 'problemdetail.pid = %d' % pid sql = getUpdateSQL('problemdetail', data=problem, clause=clause) ExeSQL(sql)
def getUserInfo(self, username): if len(username) == 0: return None where = ' username = "******" '.format(username) sql = getQuerySQL('user', whereclause=where, ordclause=' uid ') rs = FetchOne(sql) print(rs) return rs
def CheckContestIfTry(uid,pid,cid): sql = 'SELECT count(DISTINCT pid) FROM status WHERE uid = {} and pid = {} AND cid = {} ;'.format(uid,pid,cid) return FetchOne(sql)
def CheckContestIfAccept(uid,pid,cid) : sql = 'SELECT count(DISTINCT pid) FROM status WHERE uid = {} and pid = {} and cid = {} and status like "%accept%";'.format(uid,pid,cid) return FetchOne(sql)
def getSubmitData(self, sid): sql = getQuerySQL('status', ' sid = {} '.format(sid), ' sid ') rs = FetchOne(sql) return rs
def CheckPasswrod(self, username, password): sql = checkUserSQL(username=username, password=password) rs = FetchOne(sql) return rs