@@ -251,38 +251,24 @@ Method UpdatePyExecutableLines(pName As %String, ByRef pPyCodeUnit) As %Status
251
251
252
252
Set tFromHash = pPyCodeUnit .Hash
253
253
Set tToHash = ..Hash
254
-
255
- &sql (
256
- DECLARE C1 CURSOR FOR
257
- SELECT map .ToLine
258
- INTO :hToLine
259
- FROM TestCoverage_Data .CodeUnitMap map
260
- JOIN TestCoverage_Data .CodeUnit fromCodeUnit
261
- ON map .FromHash = fromCodeUnit .Hash
262
- JOIN TestCoverage_Data .CodeUnit toCodeUnit
263
- ON map .ToHash = toCodeUnit .Hash
264
- AND fromCodeUnit .Hash = :tFromHash
265
- AND toCodeUnit .Hash = :tToHash
266
- WHERE TestCoverage .BIT_VALUE (fromCodeUnit .ExecutableLines ,map .FromLine ) <> 0
267
- )
268
- &sql (OPEN C1)
269
- If (SQLCODE < 0 ) {
270
- Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
254
+ set sql = " SELECT map.ToLine FROM TestCoverage_Data.CodeUnitMap map " _
255
+ " JOIN TestCoverage_Data.CodeUnit fromCodeUnit " _
256
+ " ON fromCodeUnit.Hash = map.FromHash " _
257
+ " WHERE map.FromHash = ? " _
258
+ " AND map.ToHash = ? " _
259
+ " AND TestCoverage.BIT_VALUE(fromCodeUnit.ExecutableLines,map.FromLine) <> 0"
260
+
261
+ set resultSet = ##class (%SQL.Statement ).%ExecDirect (, sql , tFromHash , tToHash )
262
+ If (resultSet .%SQLCODE < 0 ) {
263
+ Throw ##class (%Exception.SQL ).CreateFromSQLCODE (resultSet .%SQLCODE , resultSet .%Message )
271
264
}
272
- For {
273
- &SQL (FETCH C1 )
274
- If (SQLCODE < 0 ) {
275
- Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
276
- } ElseIf (SQLCODE ) {
277
- Quit
278
- }
279
- // Process the fetched rows
280
- // hToLine contains the line number in the .cls file corresponding to executable lines in the .py file
265
+ while resultSet .%Next (.tSC ) {
266
+ $$$ThrowOnError(tSC )
267
+ Set hToLine = resultSet .%GetData (1 )
281
268
Set $Bit (tBitString , hToLine ) = 1
282
269
}
283
- &sql (CLOSE C1)
284
- If (SQLCODE < 0 ) {
285
- Throw ##class (%Exception.SQL ).CreateFromSQLCODE (SQLCODE ,%msg )
270
+ If (resultSet .%SQLCODE < 0 ) {
271
+ Throw ##class (%Exception.SQL ).CreateFromSQLCODE (resultSet .%SQLCODE , resultSet .%Message )
286
272
}
287
273
}
288
274
Set ..ExecutableLines = $BITLOGIC (..ExecutableLines | tBitString )
@@ -362,8 +348,6 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
362
348
Set tMethodName = tMethod
363
349
Set tFullMap (tMethodStart ) = $lb (" CLS" , tClass ,tMethodName , -1 , -1 ) ; -1 because the class
364
350
; definition doesn't have the +1 offset from the {
365
-
366
- Do ..MethodMap .GetNext (.tMethod )
367
351
For i = tMethodStart +1 :1 :tMethodEnd {
368
352
Set tClassLineNum = i -tMethodStart
369
353
Set tFullMap (i ) = $lb (" CLS" , tClass ,tMethodName , tClassLineNum , tClassLineNum )
@@ -375,6 +359,7 @@ Method UpdateSourceMap(pSourceNamespace As %String, ByRef pCache) As %Status
375
359
Set tSC = $$$ERROR($$$GeneralError," Compiled .py code doesn't match .CLS python code " )
376
360
}
377
361
}
362
+ Do ..MethodMap .GetNext (.tMethod )
378
363
}
379
364
}
380
365
0 commit comments