mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-09-27 12:24:11 +02:00
Fix compatibility with SQLite prior to 3.16.0
pragma_index_info() and pragma_index_list() were introduced in 3.16.0 but the version of SQLite running in Travis CI is earlier than that, hence the test failures: https://travis-ci.com/simonw/sqlite-utils/jobs/137617744
This commit is contained in:
parent
4427d2d96f
commit
0aa28293ad
1 changed files with 6 additions and 6 deletions
|
|
@ -125,13 +125,13 @@ class Table:
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def indexes(self):
|
def indexes(self):
|
||||||
sql = "select * from pragma_index_list(?)"
|
sql = 'PRAGMA index_list("{}")'.format(self.name)
|
||||||
indexes = []
|
indexes = []
|
||||||
for row in list(self.db.conn.execute(sql, (self.name,)).fetchall()):
|
for row in list(self.db.conn.execute(sql).fetchall()):
|
||||||
column_sql = "select name from pragma_index_info(?) order by seqno"
|
column_sql = 'PRAGMA index_info("{}")'.format(row[1])
|
||||||
columns = [
|
columns = []
|
||||||
r[0] for r in self.db.conn.execute(column_sql, (row[1],)).fetchall()
|
for seqno, cid, name in self.db.conn.execute(column_sql).fetchall():
|
||||||
]
|
columns.append(name)
|
||||||
indexes.append(Index(*(row + (columns,))))
|
indexes.append(Index(*(row + (columns,))))
|
||||||
return indexes
|
return indexes
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue