~ubuntu-branches/debian/sid/sqlalchemy/sid

« back to all changes in this revision

Viewing changes to lib/sqlalchemy/sql/compiler.py

  • Committer: Package Import Robot
  • Author(s): Piotr Ożarowski
  • Date: 2014-06-27 20:17:13 UTC
  • mfrom: (1.4.28)
  • Revision ID: package-import@ubuntu.com-20140627201713-g6p1kq8q1qenztrv
Tags: 0.9.6-1
* New upstream release
* Remove Python 3.X build tag files, thanks to Matthias Urlichs for the
  patch (closes: #747852)
* python-fdb isn't in the Debian archive yet so default dialect for firebird://
  URLs is changed to obsolete kinterbasdb, thanks to Russell Stuart for the
  patch (closes: #752145)

Show diffs side-by-side

added added

removed removed

Lines of Context:
93
93
    operators.ge: ' >= ',
94
94
    operators.eq: ' = ',
95
95
    operators.concat_op: ' || ',
96
 
    operators.between_op: ' BETWEEN ',
97
96
    operators.match_op: ' MATCH ',
98
97
    operators.in_op: ' IN ',
99
98
    operators.notin_op: ' NOT IN ',
522
521
                        OPERATORS[operators.as_] + \
523
522
                        self.preparer.format_label(label, labelname)
524
523
        elif render_label_only:
525
 
            return labelname
 
524
            return self.preparer.format_label(label, labelname)
526
525
        else:
527
526
            return label.element._compiler_dispatch(self,
528
527
                                    within_columns_clause=False,
956
955
                if escape else ''
957
956
            )
958
957
 
 
958
    def visit_between_op_binary(self, binary, operator, **kw):
 
959
        symmetric = binary.modifiers.get("symmetric", False)
 
960
        return self._generate_generic_binary(
 
961
                        binary, " BETWEEN SYMMETRIC "
 
962
                                if symmetric else " BETWEEN ", **kw)
 
963
 
 
964
    def visit_notbetween_op_binary(self, binary, operator, **kw):
 
965
        symmetric = binary.modifiers.get("symmetric", False)
 
966
        return self._generate_generic_binary(
 
967
                        binary, " NOT BETWEEN SYMMETRIC "
 
968
                                if symmetric else " NOT BETWEEN ", **kw)
 
969
 
959
970
    def visit_bindparam(self, bindparam, within_columns_clause=False,
960
971
                                            literal_binds=False,
961
972
                                            skip_bind_expression=False,
1470
1481
                'within_columns_clause': False
1471
1482
            })
1472
1483
 
1473
 
        # the actual list of columns to print in the SELECT column list.
1474
 
        inner_columns = [
1475
 
            c for c in [
1476
 
                self._label_select_column(select,
1477
 
                                    column,
1478
 
                                    populate_result_map, asfrom,
1479
 
                                    column_clause_args,
1480
 
                                    name=name)
1481
 
                for name, column in select._columns_plus_names
1482
 
                ]
1483
 
            if c is not None
1484
 
        ]
1485
 
 
1486
1484
        text = "SELECT "  # we're off to a good start !
1487
1485
 
1488
1486
        if select._hints:
1503
1501
            text += self._generate_prefixes(select, select._prefixes, **kwargs)
1504
1502
 
1505
1503
        text += self.get_select_precolumns(select)
 
1504
 
 
1505
        # the actual list of columns to print in the SELECT column list.
 
1506
        inner_columns = [
 
1507
            c for c in [
 
1508
                self._label_select_column(select,
 
1509
                                    column,
 
1510
                                    populate_result_map, asfrom,
 
1511
                                    column_clause_args,
 
1512
                                    name=name)
 
1513
                for name, column in select._columns_plus_names
 
1514
                ]
 
1515
            if c is not None
 
1516
        ]
 
1517
 
1506
1518
        text += ', '.join(inner_columns)
1507
1519
 
1508
1520
        if froms:
1827
1839
                text += " " + extra_from_text
1828
1840
 
1829
1841
        if update_stmt._whereclause is not None:
1830
 
            text += " WHERE " + self.process(update_stmt._whereclause)
 
1842
            t = self.process(update_stmt._whereclause)
 
1843
            if t:
 
1844
                text += " WHERE " + t
1831
1845
 
1832
1846
        limit_clause = self.update_limit_clause(update_stmt)
1833
1847
        if limit_clause:
1962
1976
            implicit_return_defaults = self.dialect.implicit_returning and \
1963
1977
                                stmt.table.implicit_returning and \
1964
1978
                                stmt._return_defaults
 
1979
        else:
 
1980
            implicit_return_defaults = False
1965
1981
 
1966
1982
        if implicit_return_defaults:
1967
1983
            if stmt._return_defaults is True:
2132
2148
                            c in implicit_return_defaults:
2133
2149
                            self.returning.append(c)
2134
2150
                        elif not c.primary_key:
2135
 
                            # dont add primary key column to postfetch
 
2151
                            # don't add primary key column to postfetch
2136
2152
                            self.postfetch.append(c)
2137
2153
                    else:
2138
2154
                        values.append(
2249
2265
                                delete_stmt, delete_stmt._returning)
2250
2266
 
2251
2267
        if delete_stmt._whereclause is not None:
2252
 
            text += " WHERE "
2253
 
            text += delete_stmt._whereclause._compiler_dispatch(self)
 
2268
            t = delete_stmt._whereclause._compiler_dispatch(self)
 
2269
            if t:
 
2270
                text += " WHERE " + t
2254
2271
 
2255
2272
        if self.returning and not self.returning_precedes_values:
2256
2273
            text += " " + self.returning_clause(