Fixed bug with detecting FTS tables

Closes #135
sanic-07
Simon Willison 2017-12-06 20:54:25 -08:00
rodzic 67ad77a307
commit 709f4f2798
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 17E2DEA2588B7F52
2 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -300,7 +300,7 @@ def detect_fts_sql(table):
sql like '%VIRTUAL TABLE%USING FTS%content="{table}"%'
or (
tbl_name = "{table}"
and sql not like 'CREATE VIEW%'
and sql like '%VIRTUAL TABLE%USING FTS%'
)
)
'''.format(table=table)

Wyświetl plik

@ -147,11 +147,13 @@ def test_detect_fts():
);
CREATE VIEW Test_View AS SELECT * FROM Dumb_Table;
CREATE VIRTUAL TABLE "Street_Tree_List_fts" USING FTS4 ("qAddress", "qCaretaker", "qSpecies", content="Street_Tree_List");
CREATE VIRTUAL TABLE r USING rtree(a, b, c);
'''
conn = sqlite3.connect(':memory:')
conn.executescript(sql)
assert None is utils.detect_fts(conn, 'Dumb_Table')
assert None is utils.detect_fts(conn, 'Test_View')
assert None is utils.detect_fts(conn, 'r')
assert 'Street_Tree_List_fts' == utils.detect_fts(conn, 'Street_Tree_List')