Title: Feature Request: Handle DBNull as $null · Issue #9561 · PowerShell/PowerShell · GitHub
Open Graph Title: Feature Request: Handle DBNull as $null · Issue #9561 · PowerShell/PowerShell
X Title: Feature Request: Handle DBNull as $null · Issue #9561 · PowerShell/PowerShell
Description: Summary of the new feature/enhancement As a scripter who has recently been working with databases quite a bit, it's become a headache to check constantly for [DBNull]::Value. It has a tendency to "leak" outside of my database code, and I...
Open Graph Description: Summary of the new feature/enhancement As a scripter who has recently been working with databases quite a bit, it's become a headache to check constantly for [DBNull]::Value. It has a tendency to "...
X Description: Summary of the new feature/enhancement As a scripter who has recently been working with databases quite a bit, it's become a headache to check constantly for [DBNull]::Value. It has a tendency ...
Opengraph URL: https://github.com/PowerShell/PowerShell/issues/9561
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Feature Request: Handle DBNull as $null","articleBody":"# Summary of the new feature/enhancement\r\n\r\nAs a scripter who has recently been working with databases quite a bit, it's become a headache to check constantly for [DBNull]::Value. It has a tendency to \"leak\" outside of my database code, and I need to start checking for DbNull values all over the rest of my code as well.\r\n\r\nPowerShell already handles both $null and an empty string in the same manner. Can it also treat [DBNull]::Value as $null for purposes of conditionals?\r\n\r\nHere is a contrived example of what I mean,\r\n\r\n```powershell\r\n$myVar = $null\r\nif (-not $myVar) {\r\n # This will run\r\n 'MyVar is null'\r\n}\r\n\r\n$myVar = ''\r\nif (-not $myVar) {\r\n # This will also run\r\n 'MyVar is null'\r\n}\r\n\r\n$myVar = [DbNull]::Value\r\nif (-not $myVar) {\r\n # This will not run\r\n 'MyVar is null'\r\n}\r\n```\r\n\r\nThe last case is what I'd like to see changed - I'd like that to be handled in the same way as the first two cases.","author":{"url":"https://github.com/replicaJunction","@type":"Person","name":"replicaJunction"},"datePublished":"2019-05-08T14:14:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":8},"url":"https://github.com/9561/PowerShell/issues/9561"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3b7cf89b-679f-a7f3-0745-de7d4c1f12d9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9BA8:166EF4:4E56F6:6F523D:6A59DF4F |
| html-safe-nonce | 6c6d5adb49cfc59e507943cf6c9b258b23742a70d4fa08746338c68a02e3358c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkE4OjE2NkVGNDo0RTU2RjY6NkY1MjNEOjZBNTlERjRGIiwidmlzaXRvcl9pZCI6IjY2ODU5MzA4NDIyMDMyMTc3NDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 6bcecf6c85aba5e0e343ac570230c55e94300f6abe817e670bf07a9d9061b81e |
| hovercard-subject-tag | issue:441758114 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/PowerShell/PowerShell/9561/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9f338b61599318207434e76ed9964d9187a87e9aa65c23df3255eafb1d8fb213/PowerShell/PowerShell/issues/9561 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9f338b61599318207434e76ed9964d9187a87e9aa65c23df3255eafb1d8fb213/PowerShell/PowerShell/issues/9561 |
| og:image:alt | Summary of the new feature/enhancement As a scripter who has recently been working with databases quite a bit, it's become a headache to check constantly for [DBNull]::Value. It has a tendency to "... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | replicaJunction |
| hostname | github.com |
| expected-hostname | github.com |
| None | ba3976babb66479b1c943a8edc0777d96157da48fadc0161f9ddb219deee8353 |
| turbo-cache-control | no-preview |
| go-import | github.com/PowerShell/PowerShell git https://github.com/PowerShell/PowerShell.git |
| octolytics-dimension-user_id | 11524380 |
| octolytics-dimension-user_login | PowerShell |
| octolytics-dimension-repository_id | 49609581 |
| octolytics-dimension-repository_nwo | PowerShell/PowerShell |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 49609581 |
| octolytics-dimension-repository_network_root_nwo | PowerShell/PowerShell |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 26f17126414f953984d8ae42f57c0db48e7dbde3 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width