mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 08:39:17 +01:00
Add a note about SQL injection
This commit is contained in:
parent
3bc653b989
commit
a0ae664ae0
1 changed files with 2 additions and 2 deletions
|
|
@ -242,12 +242,12 @@ There are a few coding conventions we use in beets:
|
|||
|
||||
To fetch Item objects from the database, use lib.items(…) and supply a query
|
||||
as an argument. Resist the urge to write raw SQL for your query. If you must
|
||||
use lower-level queries into the database, do this:
|
||||
use lower-level queries into the database, do this, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
with lib.transaction() as tx:
|
||||
rows = tx.query("SELECT …")
|
||||
rows = tx.query("SELECT path FROM items WHERE album_id = ?", (album_id,))
|
||||
|
||||
Transaction objects help control concurrent access to the database and assist
|
||||
in debugging conflicting accesses.
|
||||
|
|
|
|||
Loading…
Reference in a new issue