kopia lustrzana https://github.com/simonw/datasette
Don't incorrectly detect VIEWs as supporting FTS
rodzic
a81c62d848
commit
c5c923d93c
|
@ -287,7 +287,10 @@ def detect_fts_sql(table):
|
|||
where rootpage = 0
|
||||
and (
|
||||
sql like '%VIRTUAL TABLE%USING FTS%content="{table}"%'
|
||||
or tbl_name = "{table}"
|
||||
or (
|
||||
tbl_name = "{table}"
|
||||
and sql not like 'CREATE VIEW%'
|
||||
)
|
||||
)
|
||||
'''.format(table=table)
|
||||
|
||||
|
|
|
@ -143,9 +143,11 @@ def test_detect_fts():
|
|||
"PlantType" TEXT,
|
||||
"qCaretaker" TEXT
|
||||
);
|
||||
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");
|
||||
'''
|
||||
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 'Street_Tree_List_fts' == utils.detect_fts(conn, 'Street_Tree_List')
|
||||
|
|
Ładowanie…
Reference in New Issue