Added two new sample queries.
This commit is contained in:
Родитель
fa1a221fa3
Коммит
a7d1263279
|
@ -0,0 +1,26 @@
|
|||
(: Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license. :)
|
||||
|
||||
(: Find references to string literals that are likely to contain
|
||||
Direct SQL text. :)
|
||||
|
||||
(: @Language Xpp :)
|
||||
(: @Category Informational :)
|
||||
|
||||
|
||||
<SqlStringLiterals>
|
||||
{
|
||||
for $a in /*
|
||||
for $sl in $a//StringLiteralExpression
|
||||
where contains(lower-case($sl/@Value), "select " )
|
||||
or contains(lower-case($sl/@Value), "update " )
|
||||
or contains(lower-case($sl/@Value), "insert " )
|
||||
or contains(lower-case($sl/@Value), "delete " )
|
||||
order by string-length($sl/@Value) descending
|
||||
return <Literal Artifact='{$a/@Artifact}' Package='{$a/@Package}'
|
||||
StartLine='{$sl/@StartLine}' EndLine='{$sl/@EndLine}' StartCol='{$sl/@StartCol}' EndCol='{$sl/@EndCol}'
|
||||
Value='{$sl/@Value}' >
|
||||
</Literal>
|
||||
|
||||
}
|
||||
</SqlStringLiterals>
|
|
@ -0,0 +1,29 @@
|
|||
(: Copyright (c) Microsoft Corporation.
|
||||
Licensed under the MIT license. :)
|
||||
|
||||
(: This query enumerates internal interfaces that are implemented in classes across
|
||||
package boundaries. :)
|
||||
(: @Category Informational :)
|
||||
(: @Language Xpp :)
|
||||
|
||||
let $internalInterfaces := <InternalInterfaces>
|
||||
{
|
||||
for $i in /Interface
|
||||
where $i[@IsInternal='true']
|
||||
return <InternalInterface Artifact='{$i/@Artifact}' Name='{lower-case($i/@Name)}' Package='{$i/@Package}'/>
|
||||
}
|
||||
</InternalInterfaces>
|
||||
|
||||
(: Find classes implementing the interfaces :)
|
||||
let $classes := <Classes>
|
||||
{
|
||||
for $c in /Class/Implements
|
||||
let $interfaceName := lower-case($c/text())
|
||||
for $i in $internalInterfaces/InternalInterface[@Name=$interfaceName]
|
||||
where lower-case($i/@Package) != lower-case($c/../@Package)
|
||||
return <T InterfaceName='{$interfaceName}' Artifact='{$c/../@Artifact}' InterfacePackage='{$i/@Package}' ClassPackage='{$c/../@Package}'>
|
||||
</T>
|
||||
}
|
||||
</Classes>
|
||||
|
||||
return ($classes)
|
Загрузка…
Ссылка в новой задаче