Skip to content

Commit 2b4ebf7

Browse files
committed
Python: Add support for .executescript
1 parent eb43fa2 commit 2b4ebf7

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

python/ql/lib/semmle/python/frameworks/PEP249.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,12 @@ module PEP249 {
4949
}
5050

5151
private string getSqlKwargName() {
52-
result in ["sql", "statement", "operation", "query", "query_string"]
52+
result in ["sql", "statement", "operation", "query", "query_string", "sql_script"]
5353
}
5454

5555
/**
56-
* A call to `execute` or `executemany` method on a database cursor or a connection.
56+
* A call to an execute method on a database cursor or a connection, such as `execute`
57+
* or `executemany`.
5758
*
5859
* See
5960
* - https://peps.python.org/pep-0249/#execute
@@ -67,7 +68,7 @@ module PEP249 {
6768
exists(API::Node start |
6869
start instanceof DatabaseCursor or start instanceof DatabaseConnection
6970
|
70-
this = start.getMember(["execute", "executemany"]).getACall()
71+
this = start.getMember(["execute", "executemany", "executescript"]).getACall()
7172
)
7273
}
7374

python/ql/test/library-tests/frameworks/stdlib/pep249.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
cursor = db.cursor()
88
cursor.execute("some sql", (42,)) # $ getSql="some sql"
9-
cursor.executescript("sql") # $ MISSING: getSql="sql"
10-
cursor.executescript(sql_script="sql") # $ MISSING: getSql="sql"
9+
cursor.executescript("sql") # $ getSql="sql"
10+
cursor.executescript(sql_script="sql") # $ getSql="sql"
1111

1212
import sqlite3.dbapi2
1313
conn = sqlite3.dbapi2.connect()

0 commit comments

Comments
 (0)