コード例 #1
0
ファイル: stmt.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     selector = self.selector
     if self.inner_selections:
         selector += ": "
         selector += with_parens(
             ", ".join(construct_sequence(self.inner_selections)),
             combo="{}",
         )
     return selector
コード例 #2
0
ファイル: stmt.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     query = "INSERT"
     query += " " + protected_name(self.name)
     if self.fields:
         query += " " + with_parens(
             ", ".join(
                 f"{protected_name(key, prefix=False)} := {construct(value)}"
                 for key, value in self.fields.items()),
             combo="{}",
         )
     return query
コード例 #3
0
ファイル: stmt.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     query = "UPDATE"
     query += " " + protected_name(self.name)
     if self.filters is not None:
         query += f" FILTER {construct(self.filters)}"
     query += " SET"
     query += " " + with_parens(
         ", ".join(
             f"{protected_name(key, prefix=False)} := {construct(value)}"
             for key, value in self.assigns.items()),
         combo="{}",
     )
     return query
コード例 #4
0
ファイル: stmt.py プロジェクト: abdulniyaspm/reiz.io
    def construct(self):
        if self.with_block:
            query = construct(self.with_block, top_level=True) + " SELECT"
        else:
            query = "SELECT"

        query += " " + protected_construct(self.name)
        if self.selections:
            query += with_parens(", ".join(construct_sequence(
                self.selections)),
                                 combo="{}")
        if self.filters is not None:
            query += f" FILTER {construct(self.filters)}"
        if self.ordered is not None:
            query += f" ORDER BY {construct(self.ordered)}"
        if self.offset is not None:
            query += f" OFFSET {self.offset}"
        if self.limit is not None:
            query += f" LIMIT {self.limit}"
        return query
コード例 #5
0
ファイル: stmt.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     query = construct(self.query)
     check = construct(self.operator) + " " + construct(self.argument)
     return query + with_parens(check, combo="[]")
コード例 #6
0
ファイル: expr.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     body = ", ".join(construct_sequence(self.items))
     return with_parens(body, combo=self.PARENS)
コード例 #7
0
ファイル: expr.py プロジェクト: abdulniyaspm/reiz.io
 def construct(self):
     body = ", ".join(construct_sequence(self.args))
     return self.func + with_parens(body)