# Prerequisite: "nova.db" SQL database file created using the
# last-known-good-version of the Tesla Coil Nova Launcher 7.0.57
# <https://mobile.softpedia.com/apk/nova-launcher/7.0.57/>
cursor.execute(
"SELECT DISTINCT screen FROM favorites WHERE container = -100 ORDER BY screen ASC;"
)
screens = cursor.fetchall()
for (screen_num,) in screens:
cursor.execute(
"SELECT _id, title FROM favorites WHERE container = -100 AND screen = ?"
" AND intent IS NULL AND title IS NOT NULL AND TRIM(title) != '';",
(screen_num,),
)
folders = cursor.fetchall()
for folder_id, folder_name in folders:
If I were to adapt your db_iter concept while keeping parameterized
queries safe, I'd probably modify it to accept a parameters tuple
like this:
Python
def db_iter(conn, cmd, params=(), mapfn=lambda x: x):
"""Executes cmd with parameters and yields mapped results."""
for item in conn.cursor().execute(cmd, params):
yield mapfn(item)
Especially python where the lack of whitespace consistency completely
breaks the code.
| Sysop: | Jacob Catayoc |
|---|---|
| Location: | Pasay City, Metro Manila, Philippines |
| Users: | 4 |
| Nodes: | 4 (0 / 4) |
| Uptime: | 497100:10:27 |
| Calls: | 182 |
| Files: | 744 |
| D/L today: |
16 files (5,383K bytes) |
| Messages: | 73,587 |