dal.py 文件源码

python
阅读 37 收藏 0 点赞 0 评论 0

项目:StuffShare 作者: StuffShare 项目源码 文件源码
def _select_aux(self, sql, fields, attributes):
        args_get = attributes.get
        cache = args_get('cache',None)
        if not cache:
            self.execute(sql)
            rows = self._fetchall()
        else:
            (cache_model, time_expire) = cache
            key = self.uri + '/' + sql + '/rows'
            if len(key)>200: key = hashlib_md5(key).hexdigest()
            def _select_aux2():
                self.execute(sql)
                return self._fetchall()
            rows = cache_model(key, _select_aux2, time_expire)
        if isinstance(rows, tuple):
            rows = list(rows)
        limitby = args_get('limitby', None) or (0, )
        rows = self.rowslice(rows, limitby[0], None)
        processor = args_get('processor', self.parse)
        cacheable = args_get('cacheable', False)
        return processor(rows, fields, self._colnames, cacheable=cacheable)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号