datasette/datasette/utils
JSap0914 bf3e277c98
Fix named_parameters when string literals contain comment markers (#2783)
named_parameters stripped SQL comments before string literals in
separate passes. A string literal such as '-- TODO' would be treated
as the start of a line comment, swallowing the rest of the line and
hiding any named parameters that followed it. For example:

    select * from t where note = '-- TODO' and id = :id

returned [] instead of ['id'], so the query parameter input form
would be missing the :id field.

Match comments and string literals in a single left-to-right pass so
that whichever construct starts first wins, matching how SQL is
actually tokenized.

Co-authored-by: JSap0914 <JSap0914@users.noreply.github.com>
2026-07-07 14:23:31 -07:00
..
__init__.py Fix named_parameters when string literals contain comment markers (#2783) 2026-07-07 14:23:31 -07:00
actions_sql.py Switch to CTE to handle 600+ actions at once 2026-06-13 11:09:28 -07:00
asgi.py Add Response.error() for JSON errors in the standard format 2026-07-06 23:48:49 +00:00
baseconv.py Rename to_decimal/from_decimal to decode/encode, refs #1734 2022-05-02 12:44:09 -07:00
check_callable.py Fix for asyncio.iscoroutinefunction deprecation warnings 2025-10-08 20:32:16 -07:00
internal_db.py Switch to sqlite-utils migrations for internal.db, closes #2827 2026-07-07 13:58:48 -07:00
multipart.py Add request.form() for multipart form data and file uploads 2026-01-28 18:41:03 -08:00
permissions.py Black formatting 2026-02-17 13:30:24 -08:00
shutil_backport.py Upgrade to latest Black, closes #2239 2024-01-30 19:55:26 -08:00
sql_analysis.py Support CREATE VIEW / DROP VIEW in execute-write-sql 2026-07-02 08:56:04 -07:00
sqlite.py Fixes for SQL write with RETURNING (#2763) 2026-05-31 16:15:34 -07:00
testing.py Replace token-based CSRF with Sec-Fetch-Site header protection (#2689) 2026-04-14 17:11:36 -07:00