mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Replaced self.ds.execute with db.execute in more places
This commit is contained in:
parent
efa54b439f
commit
f1442a8151
2 changed files with 5 additions and 10 deletions
|
|
@ -300,8 +300,7 @@ class Database:
|
||||||
bits = [table_definition_rows[0][0] + ";"]
|
bits = [table_definition_rows[0][0] + ";"]
|
||||||
# Add on any indexes
|
# Add on any indexes
|
||||||
index_rows = list(
|
index_rows = list(
|
||||||
await self.ds.execute(
|
await self.execute(
|
||||||
self.name,
|
|
||||||
"select sql from sqlite_master where tbl_name = :n and type='index' and sql is not null",
|
"select sql from sqlite_master where tbl_name = :n and type='index' and sql is not null",
|
||||||
{"n": table},
|
{"n": table},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -533,17 +533,13 @@ class TableView(RowTableShared):
|
||||||
if request.raw_args.get("_timelimit"):
|
if request.raw_args.get("_timelimit"):
|
||||||
extra_args["custom_time_limit"] = int(request.raw_args["_timelimit"])
|
extra_args["custom_time_limit"] = int(request.raw_args["_timelimit"])
|
||||||
|
|
||||||
results = await self.ds.execute(
|
results = await db.execute(sql, params, truncate=True, **extra_args)
|
||||||
database, sql, params, truncate=True, **extra_args
|
|
||||||
)
|
|
||||||
|
|
||||||
# Number of filtered rows in whole set:
|
# Number of filtered rows in whole set:
|
||||||
filtered_table_rows_count = None
|
filtered_table_rows_count = None
|
||||||
if count_sql:
|
if count_sql:
|
||||||
try:
|
try:
|
||||||
count_rows = list(
|
count_rows = list(await db.execute(count_sql, from_sql_params))
|
||||||
await self.ds.execute(database, count_sql, from_sql_params)
|
|
||||||
)
|
|
||||||
filtered_table_rows_count = count_rows[0][0]
|
filtered_table_rows_count = count_rows[0][0]
|
||||||
except QueryInterrupted:
|
except QueryInterrupted:
|
||||||
pass
|
pass
|
||||||
|
|
@ -795,7 +791,7 @@ class RowView(RowTableShared):
|
||||||
params = {}
|
params = {}
|
||||||
for i, pk_value in enumerate(pk_values):
|
for i, pk_value in enumerate(pk_values):
|
||||||
params["p{}".format(i)] = pk_value
|
params["p{}".format(i)] = pk_value
|
||||||
results = await self.ds.execute(database, sql, params, truncate=True)
|
results = await db.execute(sql, params, truncate=True)
|
||||||
columns = [r[0] for r in results.description]
|
columns = [r[0] for r in results.description]
|
||||||
rows = list(results.rows)
|
rows = list(results.rows)
|
||||||
if not rows:
|
if not rows:
|
||||||
|
|
@ -876,7 +872,7 @@ class RowView(RowTableShared):
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
rows = list(await self.ds.execute(database, sql, {"id": pk_values[0]}))
|
rows = list(await db.execute(sql, {"id": pk_values[0]}))
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
# Almost certainly hit the timeout
|
# Almost certainly hit the timeout
|
||||||
return []
|
return []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue