source: OpenRLabs-Git/deploy/rlabs-docker/web2py-rlabs/gluon/packages/dal/pydal/dialects/couchdb.py

main
Last change on this file was 42bd667, checked in by David Fuertes <dfuertes@…>, 4 years ago

Historial Limpio

  • Property mode set to 100755
File size: 1.4 KB
Line 
1from ..adapters.couchdb import CouchDB
2from .base import NoSQLDialect
3from . import dialects
4
5
6@dialects.register_for(CouchDB)
7class CouchDBDialect(NoSQLDialect):
8    def _and(self, first, second, query_env={}):
9        return "(%s && %s)" % (
10            self.expand(first, query_env=query_env),
11            self.expand(second, query_env=query_env),
12        )
13
14    def _or(self, first, second, query_env={}):
15        return "(%s || %s)" % (
16            self.expand(first, query_env=query_env),
17            self.expand(second, query_env=query_env),
18        )
19
20    def eq(self, first, second=None, query_env={}):
21        if second is None:
22            return "(%s == null)" % self.expand(first, query_env=query_env)
23        return "(%s == %s)" % (
24            self.expand(first, query_env=query_env),
25            self.expand(second, first.type, query_env=query_env),
26        )
27
28    def ne(self, first, second=None, query_env={}):
29        if second is None:
30            return "(%s != null)" % self.expand(first, query_env=query_env)
31        return "(%s != %s)" % (
32            self.expand(first, query_env=query_env),
33            self.expand(second, first.type, query_env=query_env),
34        )
35
36    def comma(self, first, second, query_env={}):
37        return "%s + %s" % (
38            self.expand(first, query_env=query_env),
39            self.expand(second, query_env=query_env),
40        )
Note: See TracBrowser for help on using the repository browser.