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]
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
def GetRecordListByCondition(tablename, conditionStr): ''''add by xiaopao''' sql = 'select * from %s where %s' % (tablename, conditionStr) return dbpool.querySql(sql, True)
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)