예제 #1
0
def getAllPkByFkInDB(tablename, pkname, props):
    """根据所有的外键获取主键ID
    """
    props = FormatCondition(props)
    sql = """Select `%s` from `%s` where %s""" % (pkname, tablename, props)
    logger.debug(sql)
    result = dbpool.querySql(sql, False)
    return [key[0] for key in result]
예제 #2
0
def GetRecordList(tablename, pkname, pklist):
    """
    """
    pkliststr = ""
    for pkid in pklist:
        pkliststr += "%s," % pkid
    pkliststr = "(%s)" % pkliststr[:-1]
    sql = """SELECT * FROM `%s` WHERE `%s` IN %s""" % (tablename, pkname,
                                                       pkliststr)
    logger.debug(sql)
    result = dbpool.querySql(sql, True)
    return result
예제 #3
0
def GetRecordListByCondition(tablename, conditionStr):
    ''''add by xiaopao'''
    sql = 'select * from %s where %s' % (tablename, conditionStr)
    return dbpool.querySql(sql, True)
예제 #4
0
def GetRecordListByProps(tablename, props):
    ''''add by meng.xf'''
    props = FormatCondition(props)
    sql = 'select * from %s where %s' % (tablename, props)
    logger.debug(sql)
    return dbpool.querySql(sql, True)