@@ -26,10 +26,10 @@ public function __construct(Connection $connection, TracerInterface $tracer)
2626 parent ::__construct ($ connection );
2727 }
2828
29- public function connect ()
29+ public function connect (): bool
3030 {
3131 if ($ this ->isConnected ()) {
32- return ;
32+ return false ;
3333 }
3434 $ span = $ this ->tracer
3535 ->start ('dbal.connect ' )
@@ -38,13 +38,13 @@ public function connect()
3838 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
3939 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
4040 try {
41- parent ::connect ();
41+ return parent ::connect ();
4242 } catch (\Exception $ e ) {
4343 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
4444 ->addTag (new ErrorTag ());
4545 throw $ e ;
4646 } finally {
47- $ this -> tracer -> finish ( $ span ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ())));
47+ $ span ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))-> finish ( );
4848 }
4949 }
5050
@@ -65,7 +65,7 @@ public function prepare($prepareString)
6565 ->addTag (new ErrorTag ());
6666 throw $ e ;
6767 } finally {
68- $ this -> tracer -> finish ($ span );
68+ $ span -> finish ();
6969 }
7070 }
7171
@@ -86,7 +86,7 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
8686 ->addTag (new ErrorTag ());
8787 throw $ e ;
8888 } finally {
89- $ this -> tracer -> finish ($ span );
89+ $ span -> finish ();
9090 }
9191 }
9292
@@ -107,27 +107,29 @@ public function executeUpdate($query, array $params = [], array $types = [])
107107 ->addTag (new ErrorTag ());
108108 throw $ e ;
109109 } finally {
110- $ this -> tracer -> finish ($ span );
110+ $ span -> finish ();
111111 }
112112 }
113113
114114 public function query ()
115115 {
116+ $ args = func_get_args ();
116117 $ span = $ this ->tracer
117118 ->start ('dbal.query ' )
119+ ->addTag (new DbStatementTag ($ args [0 ]))
118120 ->addTag (new DbInstanceTag ($ this ->getDatabase ()))
119121 ->addTag (new DbUser ($ this ->getUsername ()))
120122 ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
121123 ->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
122124 ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
123125 try {
124- return parent ::query ();
126+ return parent ::query (... $ args );
125127 } catch (\Exception $ e ) {
126128 $ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
127129 ->addTag (new ErrorTag ());
128130 throw $ e ;
129131 } finally {
130- $ this -> tracer -> finish ($ span );
132+ $ span -> finish ();
131133 }
132134 }
133135
@@ -150,7 +152,7 @@ public function exec($statement)
150152 ->addTag (new ErrorTag ());
151153 throw $ e ;
152154 } finally {
153- $ this -> tracer -> finish ($ span );
155+ $ span -> finish ();
154156 }
155157 }
156158
@@ -169,7 +171,7 @@ public function beginTransaction()
169171 ->addTag (new ErrorTag ());
170172 throw $ e ;
171173 } finally {
172- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
174+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
173175 }
174176 }
175177
@@ -188,7 +190,7 @@ public function commit()
188190 ->addTag (new ErrorTag ());
189191 throw $ e ;
190192 } finally {
191- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
193+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
192194 }
193195 }
194196
@@ -207,7 +209,7 @@ public function rollBack()
207209 ->addTag (new ErrorTag ());
208210 throw $ e ;
209211 } finally {
210- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
212+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
211213 }
212214 }
213215}
0 commit comments