mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
28 lines
1.0 KiB
Python
28 lines
1.0 KiB
Python
import aiosqlite
|
|
|
|
# see https://pypi.org/project/aiosqlite/
|
|
|
|
async def test():
|
|
db = await aiosqlite.connect(...)
|
|
|
|
await db.execute("sql") # $ getSql="sql" constructedSql="sql"
|
|
await db.execute(sql="sql") # $ getSql="sql" constructedSql="sql"
|
|
|
|
cursor = await db.cursor()
|
|
cursor.execute("sql") # $ constructedSql="sql"
|
|
|
|
cursor = await db.execute("sql") # $ getSql="sql" constructedSql="sql"
|
|
cursor.execute("sql") # $ constructedSql="sql"
|
|
|
|
async with aiosqlite.connect(...) as db:
|
|
db.row_factory = aiosqlite.Row
|
|
async with db.execute("sql") as cursor: # $ getSql="sql" constructedSql="sql"
|
|
async for row in cursor:
|
|
print(row['column'])
|
|
|
|
# nonstandard
|
|
await db.execute_insert("sql") # $ getSql="sql" constructedSql="sql"
|
|
await db.execute_fetchall("sql") # $ getSql="sql" constructedSql="sql"
|
|
await db.executescript("sql") # $ getSql="sql" constructedSql="sql"
|
|
await db.executescript(sql_script="sql") # $ getSql="sql" constructedSql="sql"
|