diff options
| -rw-r--r-- | CHANGES | 1 | ||||
| -rw-r--r-- | sqlparse/filters.py | 6 | ||||
| -rw-r--r-- | tests/test_format.py | 2 |
3 files changed, 8 insertions, 1 deletions
@@ -9,6 +9,7 @@ Bug Fixes * Fixed an issue with trailing whitespaces (reported by Kris). * Better detection of escaped single quotes (issue13, reported by Martin Brochhaus, patch by bluemaro with test case by Dan Carley). + * Ignore identifier in double-quotes when changing cases (issue 21). * Lots of minor fixes targeting encoding, indentation, statement parsing and more (issues 12, 14, 15, 16, 19). * Code cleanup with a pinch of refactoring. diff --git a/sqlparse/filters.py b/sqlparse/filters.py index a3ae192..9d1e0b9 100644 --- a/sqlparse/filters.py +++ b/sqlparse/filters.py @@ -45,6 +45,12 @@ class KeywordCaseFilter(_CaseFilter): class IdentifierCaseFilter(_CaseFilter): ttype = (T.Name, T.String.Symbol) + def process(self, stack, stream): + for ttype, value in stream: + if ttype in self.ttype and not value.strip()[0] == '"': + value = self.convert(value) + yield ttype, value + # ---------------------- # statement process diff --git a/tests/test_format.py b/tests/test_format.py index 32e8bef..b56ceaf 100644 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -30,7 +30,7 @@ class TestFormat(TestCaseBase): identifier_case='foo') sql = 'select * from "foo"."bar"' res = sqlparse.format(sql, identifier_case="upper") - self.ndiffAssertEqual(res, 'select * from "FOO"."BAR"') + self.ndiffAssertEqual(res, 'select * from "foo"."bar"') def test_strip_comments_single(self): sql = 'select *-- statement starts here\nfrom foo' |
