mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-23 09:24:31 +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
|
||||
def indexes(self):
|
||||
sql = "select * from pragma_index_list(?)"
|
||||
sql = 'PRAGMA index_list("{}")'.format(self.name)
|
||||
indexes = []
|
||||
for row in list(self.db.conn.execute(sql, (self.name,)).fetchall()):
|
||||
column_sql = "select name from pragma_index_info(?) order by seqno"
|
||||
columns = [
|
||||
r[0] for r in self.db.conn.execute(column_sql, (row[1],)).fetchall()
|
||||
]
|
||||
for row in list(self.db.conn.execute(sql).fetchall()):
|
||||
column_sql = 'PRAGMA index_info("{}")'.format(row[1])
|
||||
columns = []
|
||||
for seqno, cid, name in self.db.conn.execute(column_sql).fetchall():
|
||||
columns.append(name)
|
||||
indexes.append(Index(*(row + (columns,))))
|
||||
return indexes
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue