当查询具有'having'子句时,Laravel getCountForPagination()会出现问题

时间:2018-02-19 17:14:21

标签: php laravel laravel-5

当查询中包含HAVING子句时,laravel中的COUNT(*)函数崩溃。 基本上它发生的是该函数从select中删除所有内容并添加HAVING并且from redis import Redis from collections import MutableMapping from pickle import loads, dumps class RedisStore(MutableMapping): def __init__(self, engine): self._store = Redis.from_url(engine) def __getitem__(self, key): return loads(self._store[dumps(key)]) def __setitem__(self, key, value): self._store[dumps(key)] = dumps(value) def __delitem__(self, key): del self._store[dumps(key)] def __iter__(self): return iter(self.keys()) def __len__(self): return len(self._store.keys()) def keys(self): return [loads(x) for x in self._store.keys()] def clear(self): self._store.flushdb() d = RedisStore('redis://localhost:6379/0') d['a'] = {'b': 1, 'c': 10} print repr(d.items()) # this will not work: (it updates a temporary copy and not the real data) d['a']['b'] = 2 print repr(d.items()) # this is how to update sub-structures: t = d['a'] t['b'] = 2 d['a'] = t print repr(d.items()) del d['a'] # Here is another way to implement dict-of-dict eg d['a']['b'] d[('a', 'b')] = 1 d[('a', 'b')] = 2 print repr(d.items()) # Hopefully you do not need the equivalent of d['a'] print repr([{x[0][1]: x[1]} for x in d.items() if x[0][0] == 'a']) del d[('a', 'b')] del d[('a', 'c')] 子句不再看到别名。

有没有解决方法呢?

0 个答案:

没有答案