File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,8 @@ Bug Fixes
1616 * Improve parsing of stand-alone comments (issue26).
1717 * Detection of placeholders in paramterized queries (issue22,
1818 reported by Glyph Lefkowitz).
19+ * Add parsing of MS Access column names with braces (issue27,
20+ reported by frankz...@gmail.com).
1921
2022
2123Release 0.1.2 (Nov 23, 2010)
Original file line number Diff line number Diff line change @@ -189,6 +189,7 @@ class Lexer:
189189 (r"(''|'.*?[^\\]')" , tokens .String .Single ),
190190 # not a real string literal in ANSI SQL:
191191 (r'(""|".*?[^\\]")' , tokens .String .Symbol ),
192+ (r'(\[.*[^\]]\])' , tokens .Name ),
192193 (r'(LEFT |RIGHT )?(INNER |OUTER )?JOIN\b' , tokens .Keyword ),
193194 (r'END( IF| LOOP)?\b' , tokens .Keyword ),
194195 (r'NOT NULL\b' , tokens .Keyword ),
Original file line number Diff line number Diff line change @@ -95,3 +95,10 @@ def _get_tokens(sql):
9595 self .assert_ (t [- 1 ].ttype is sqlparse .tokens .Name .Placeholder )
9696 self .assertEqual (t [- 1 ].value , '$a' )
9797
98+ def test_access_symbol (self ): # see issue27
99+ t = sqlparse .parse ('select a.[foo bar] as foo' )[0 ].tokens
100+ self .assert_ (isinstance (t [- 1 ], sqlparse .sql .Identifier ))
101+ self .assertEqual (t [- 1 ].get_name (), 'foo' )
102+ self .assertEqual (t [- 1 ].get_real_name (), '[foo bar]' )
103+ self .assertEqual (t [- 1 ].get_parent_name (), 'a' )
104+
You can’t perform that action at this time.
0 commit comments