clauses were not properly interpreted by the Firebird dialect.
Pull request courtesy effem-git.
+ .. change::
+ :tags: bug, firebird
+ :tickets: 3381
+
+ Fixed support for "literal_binds" mode when using limit/offset
+ with Firebird, so that the values are again rendered inline when
+ this is selected. Related to :ticket:`3034`.
+
.. change::
:tags: bug, sqlite
:tickets: 3378
def visit_sequence(self, seq):
return "gen_id(%s, 1)" % self.preparer.format_sequence(seq)
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
"""Called when building a ``SELECT`` statement, position is just
before column list Firebird puts the limit and offset right
after the ``SELECT``...
result = ""
if select._limit_clause is not None:
- result += "FIRST %s " % self.process(select._limit_clause)
+ result += "FIRST %s " % self.process(select._limit_clause, **kw)
if select._offset_clause is not None:
- result += "SKIP %s " % self.process(select._offset_clause)
+ result += "SKIP %s " % self.process(select._offset_clause, **kw)
if select._distinct:
result += "DISTINCT "
return result
- def limit_clause(self, select):
+ def limit_clause(self, select, **kw):
"""Already taken care of in the `get_select_precolumns` method."""
return ""
self.process(binary.left, **kw),
self.process(binary.right, **kw))
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
""" MS-SQL puts TOP, it's version of LIMIT here """
s = ""
if s:
return s
else:
- return compiler.SQLCompiler.get_select_precolumns(self, select)
+ return compiler.SQLCompiler.get_select_precolumns(
+ self, select, **kw)
def get_from_hint_text(self, table, text):
return text
def visit_false(self, element, **kw):
return "false"
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
"""Add special MySQL keywords in place of DISTINCT.
.. note::
raise exc.CompileError("Unrecognized hint: %r" % hint)
return "ONLY " + sqltext
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
if select._distinct is not False:
if select._distinct is True:
return "DISTINCT "
[self.process(col) for col in select._distinct]
) + ") "
else:
- return "DISTINCT ON (" + self.process(select._distinct) + ") "
+ return "DISTINCT ON (" + \
+ self.process(select._distinct, **kw) + ") "
else:
return ""
'milliseconds': 'millisecond'
})
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
s = select._distinct and "DISTINCT " or ""
# TODO: don't think Sybase supports
# bind params for FIRST / TOP
text += self._generate_prefixes(
select, select._prefixes, **kwargs)
- text += self.get_select_precolumns(select)
+ text += self.get_select_precolumns(select, **kwargs)
# the actual list of columns to print in the SELECT column list.
inner_columns = [
else:
return "WITH"
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
"""Called when building a ``SELECT`` statement, position is just
before column list.
def temporary_tables(self):
"""target database supports temporary tables"""
return skip_if(
- ["mssql"], "sql server has some other syntax?"
+ ["mssql", "firebird"], "not supported (?)"
)
@property
class MyCompiler(compiler.SQLCompiler):
- def get_select_precolumns(self, select):
+ def get_select_precolumns(self, select, **kw):
result = ""
if select._limit:
result += "FIRST %s " % self.process(
literal(
- select._limit))
+ select._limit), **kw)
if select._offset:
result += "SKIP %s " % self.process(
literal(
- select._offset))
+ select._offset), **kw)
return result
def limit_clause(self, select, **kw):