mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
escape_sqlite_table_name => escape_sqlite, handles reserved words
It can be used for column names as well as table names. Reserved word list from https://www.sqlite.org/lang_keywords.html
This commit is contained in:
parent
0e5f51adfe
commit
8f0d44d646
7 changed files with 68 additions and 25 deletions
|
|
@ -227,16 +227,16 @@ def test_temporary_docker_directory_uses_copy_if_hard_link_fails(mock_link):
|
|||
|
||||
|
||||
def test_compound_keys_after_sql():
|
||||
assert '(([a] > :p0))' == utils.compound_keys_after_sql(['a'])
|
||||
assert '((a > :p0))' == utils.compound_keys_after_sql(['a'])
|
||||
assert '''
|
||||
(([a] > :p0)
|
||||
((a > :p0)
|
||||
or
|
||||
([a] = :p0 and [b] > :p1))
|
||||
(a = :p0 and b > :p1))
|
||||
'''.strip() == utils.compound_keys_after_sql(['a', 'b'])
|
||||
assert '''
|
||||
(([a] > :p0)
|
||||
((a > :p0)
|
||||
or
|
||||
([a] = :p0 and [b] > :p1)
|
||||
(a = :p0 and b > :p1)
|
||||
or
|
||||
([a] = :p0 and [b] = :p1 and [c] > :p2))
|
||||
(a = :p0 and b = :p1 and c > :p2))
|
||||
'''.strip() == utils.compound_keys_after_sql(['a', 'b', 'c'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue