File tree Expand file tree Collapse file tree
python/ql/test/library-tests/frameworks/hdbcli Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77cursor .executemany ("some sql" , (42 ,)) # $ getSql="some sql"
88
99cursor .close ()
10+
11+
12+ # Connection stored in a class attribute (`self._conn`) and used in another method.
13+ #
14+ # This is currently NOT detected: the `Connection::instance()`/`execute()` predicates in
15+ # PEP249.qll are based on type tracking, which cannot follow a value that is stored into a
16+ # `self` attribute in one method and read from a `self` attribute in another method (see the
17+ # `MISSING` markers below). Regular (global) data flow handles this case correctly, so the
18+ # limitation is specific to the type-tracking-based modeling.
19+ class Database :
20+ def __init__ (self ):
21+ self ._conn = dbapi .connect (address = "hostname" , port = 300 , user = "username" )
22+
23+ def get_connection (self ):
24+ return self ._conn
25+
26+ def run_via_getter (self ):
27+ conn = self .get_connection ()
28+ cursor = conn .cursor ()
29+ cursor .execute ("getter sql" ) # $ MISSING: getSql="getter sql"
30+
31+ def run_direct (self ):
32+ self ._conn .execute ("direct sql" ) # $ MISSING: getSql="direct sql"
33+
34+
35+ db = Database ()
36+ db .run_via_getter ()
37+ db .run_direct ()
You can’t perform that action at this time.
0 commit comments