@@ -26,10 +26,10 @@ public function __construct(Connection $connection, TracerInterface $tracer)
26
26
parent ::__construct ($ connection );
27
27
}
28
28
29
- public function connect ()
29
+ public function connect (): bool
30
30
{
31
31
if ($ this ->isConnected ()) {
32
- return ;
32
+ return false ;
33
33
}
34
34
$ span = $ this ->tracer
35
35
->start ('dbal.connect ' )
@@ -38,13 +38,13 @@ public function connect()
38
38
->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
39
39
->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
40
40
try {
41
- parent ::connect ();
41
+ return parent ::connect ();
42
42
} catch (\Exception $ e ) {
43
43
$ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
44
44
->addTag (new ErrorTag ());
45
45
throw $ e ;
46
46
} finally {
47
- $ this -> tracer -> finish ( $ span ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ())));
47
+ $ span ->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))-> finish ( );
48
48
}
49
49
}
50
50
@@ -65,7 +65,7 @@ public function prepare($prepareString)
65
65
->addTag (new ErrorTag ());
66
66
throw $ e ;
67
67
} finally {
68
- $ this -> tracer -> finish ($ span );
68
+ $ span -> finish ();
69
69
}
70
70
}
71
71
@@ -86,7 +86,7 @@ public function executeQuery($query, array $params = [], $types = [], QueryCache
86
86
->addTag (new ErrorTag ());
87
87
throw $ e ;
88
88
} finally {
89
- $ this -> tracer -> finish ($ span );
89
+ $ span -> finish ();
90
90
}
91
91
}
92
92
@@ -107,27 +107,29 @@ public function executeUpdate($query, array $params = [], array $types = [])
107
107
->addTag (new ErrorTag ());
108
108
throw $ e ;
109
109
} finally {
110
- $ this -> tracer -> finish ($ span );
110
+ $ span -> finish ();
111
111
}
112
112
}
113
113
114
114
public function query ()
115
115
{
116
+ $ args = func_get_args ();
116
117
$ span = $ this ->tracer
117
118
->start ('dbal.query ' )
119
+ ->addTag (new DbStatementTag ($ args [0 ]))
118
120
->addTag (new DbInstanceTag ($ this ->getDatabase ()))
119
121
->addTag (new DbUser ($ this ->getUsername ()))
120
122
->addTag (new DbType ($ this ->getDatabasePlatform ()->getName ()))
121
123
->addTag (new DbalAutoCommitTag ($ this ->isAutoCommit ()))
122
124
->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()));
123
125
try {
124
- return parent ::query ();
126
+ return parent ::query (... $ args );
125
127
} catch (\Exception $ e ) {
126
128
$ span ->addTag (new DbalErrorCodeTag ($ e ->getCode ()))
127
129
->addTag (new ErrorTag ());
128
130
throw $ e ;
129
131
} finally {
130
- $ this -> tracer -> finish ($ span );
132
+ $ span -> finish ();
131
133
}
132
134
}
133
135
@@ -150,7 +152,7 @@ public function exec($statement)
150
152
->addTag (new ErrorTag ());
151
153
throw $ e ;
152
154
} finally {
153
- $ this -> tracer -> finish ($ span );
155
+ $ span -> finish ();
154
156
}
155
157
}
156
158
@@ -169,7 +171,7 @@ public function beginTransaction()
169
171
->addTag (new ErrorTag ());
170
172
throw $ e ;
171
173
} finally {
172
- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
174
+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
173
175
}
174
176
}
175
177
@@ -188,7 +190,7 @@ public function commit()
188
190
->addTag (new ErrorTag ());
189
191
throw $ e ;
190
192
} finally {
191
- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
193
+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
192
194
}
193
195
}
194
196
@@ -207,7 +209,7 @@ public function rollBack()
207
209
->addTag (new ErrorTag ());
208
210
throw $ e ;
209
211
} finally {
210
- $ this -> tracer -> finish ( $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ())));
212
+ $ span ->addTag (new DbalNestingLevelTag ($ this ->getTransactionNestingLevel ()))-> finish ( );
211
213
}
212
214
}
213
215
}
0 commit comments