mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Fixed bug with keyset pagination over compound primary keys
Closes #190
This commit is contained in:
parent
89d9fbb91b
commit
31f63d1672
5 changed files with 88 additions and 10 deletions
|
|
@ -224,3 +224,19 @@ def test_temporary_docker_directory_uses_copy_if_hard_link_fails(mock_link):
|
|||
assert 'world' == open(hello).read()
|
||||
# It should be a copy, not a hard link
|
||||
assert 1 == os.stat(hello).st_nlink
|
||||
|
||||
|
||||
def test_compound_keys_after_sql():
|
||||
assert '([a] > :p0)' == utils.compound_keys_after_sql(['a'])
|
||||
assert '''
|
||||
([a] > :p0)
|
||||
or
|
||||
([a] = :p0 and [b] > :p1)
|
||||
'''.strip() == utils.compound_keys_after_sql(['a', 'b'])
|
||||
assert '''
|
||||
([a] > :p0)
|
||||
or
|
||||
([a] = :p0 and [b] > :p1)
|
||||
or
|
||||
([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