Skip to content

Commit e815686

Browse files
authored
Merge pull request #130 from dataplat/feature/underscore-token
Adding support for underscore char in tokens
2 parents 27ccc05 + f0b0c6a commit e815686

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

internal/functions/Resolve-VariableToken.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
foreach ($obj in $InputObject) {
2525
if ($obj -is [string]) {
2626
$output = $obj
27-
foreach ($token in (Get-VariableToken -InputString $obj -RegexString $TokenRegex.Replace('token', '[a-zA-Z0-9\-.]+'))) {
27+
foreach ($token in (Get-VariableToken -InputString $obj -RegexString $TokenRegex.Replace('token', '[a-zA-Z0-9_\-.]+'))) {
2828
#Replace variables found in the config
2929
$tokenRegExString = $TokenRegex.Replace('token', [Regex]::Escape($token))
3030
if ($Runtime) {

tests/Invoke-DBOQuery.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ Describe "Invoke-DBOQuery tests" -Tag $commandName, IntegrationTests {
140140
}
141141
It "should run the query with custom variables and custom token template" {
142142
Set-PSFConfig -FullName dbops.config.variabletoken -Value '\$(token)\$'
143-
$query = "SELECT '`$Test`$' AS A, '`$Test2`$' AS B UNION ALL SELECT '3' AS A, '4' AS B"
144-
$result = Invoke-DBOQuery -Query $query -SqlInstance $script:mssqlInstance -Credential $script:mssqlCredential -As DataTable -Variables @{ Test = '1'; Test2 = '2' }
143+
$query = "SELECT '`$Test`$' AS A, '`$Test_2.1-3`$' AS B UNION ALL SELECT '3' AS A, '4' AS B"
144+
$result = Invoke-DBOQuery -Query $query -SqlInstance $script:mssqlInstance -Credential $script:mssqlCredential -As DataTable -Variables @{ Test = '1'; "Test_2.1-3" = '2' }
145145
$result.A | Should -Be '1', '3'
146146
$result.B | Should -Be '2', '4'
147147
(Get-PSFConfig -FullName dbops.config.variabletoken).ResetValue()

0 commit comments

Comments
 (0)