@@ -134,7 +134,20 @@ private module Postgres {
134134 // pool.connect(function(err, client) { ... })
135135 result = pool ( ) .getMember ( "connect" ) .getParameter ( 0 ) .getParameter ( 1 )
136136 or
137+ // await pool.connect()
138+ result = pool ( ) .getMember ( "connect" ) .getReturn ( ) .getPromised ( )
139+ or
137140 result = pgpConnection ( ) .getMember ( "client" )
141+ or
142+ exists ( API:: CallNode call |
143+ call = pool ( ) .getMember ( "on" ) .getACall ( ) and
144+ call .getArgument ( 0 ) .getStringValue ( ) = [ "connect" , "acquire" ] and
145+ result = call .getParameter ( 1 ) .getParameter ( 0 )
146+ )
147+ or
148+ result = client ( ) .getMember ( "on" ) .getReturn ( )
149+ or
150+ result = API:: Node:: ofType ( "pg" , [ "Client" , "PoolClient" ] )
138151 }
139152
140153 /** Gets a constructor that when invoked constructs a new connection pool. */
@@ -151,6 +164,10 @@ private module Postgres {
151164 result = newPool ( ) .getInstance ( )
152165 or
153166 result = pgpDatabase ( ) .getMember ( "$pool" )
167+ or
168+ result = pool ( ) .getMember ( "on" ) .getReturn ( )
169+ or
170+ result = API:: Node:: ofType ( "pg" , "Pool" )
154171 }
155172
156173 /** A call to the Postgres `query` method. */
@@ -162,7 +179,11 @@ private module Postgres {
162179
163180 /** An expression that is passed to the `query` method and hence interpreted as SQL. */
164181 class QueryString extends SQL:: SqlString {
165- QueryString ( ) { this = any ( QueryCall qc ) .getAQueryArgument ( ) .asExpr ( ) }
182+ QueryString ( ) {
183+ this = any ( QueryCall qc ) .getAQueryArgument ( ) .asExpr ( )
184+ or
185+ this = API:: moduleImport ( "pg-cursor" ) .getParameter ( 0 ) .getARhs ( ) .asExpr ( )
186+ }
166187 }
167188
168189 /** An expression that is passed as user name or password when creating a client or a pool. */
0 commit comments