[
  {
    "path": ".gitignore",
    "content": "#this directory is created by the build script but should not be committed to the repo\nOutput/\n\n#binarysrc/packages/* \n## Ignore Visual Studio temporary files, build results, and\n## files generated by popular Visual Studio add-ons.\n##\n## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore\n\n# User-specific files\n*.rsuser\n*.suo\n*.user\n*.userosscache\n*.sln.docstates\n\n# User-specific files (MonoDevelop/Xamarin Studio)\n*.userprefs\n\n# Mono auto generated files\nmono_crash.*\n\n# Build results\n[Dd]ebug/\n[Dd]ebugPublic/\n[Rr]elease/\n[Rr]eleases/\nx64/\nx86/\n[Ww][Ii][Nn]32/\n[Aa][Rr][Mm]/\n[Aa][Rr][Mm]64/\nbld/\n[Bb]in/\n[Oo]bj/\n[Ll]og/\n[Ll]ogs/\n\n# Visual Studio 2015/2017 cache/options directory\n.vs/\n# Uncomment if you have tasks that create the project's static files in wwwroot\n#wwwroot/\n\n# Visual Studio 2017 auto generated files\nGenerated\\ Files/\n\n# MSTest test Results\n[Tt]est[Rr]esult*/\n[Bb]uild[Ll]og.*\n\n# NUnit\n*.VisualState.xml\nTestResult.xml\nnunit-*.xml\n\n# Build Results of an ATL Project\n[Dd]ebugPS/\n[Rr]eleasePS/\ndlldata.c\n\n# Benchmark Results\nBenchmarkDotNet.Artifacts/\n\n# .NET Core\nproject.lock.json\nproject.fragment.lock.json\nartifacts/\n\n# ASP.NET Scaffolding\nScaffoldingReadMe.txt\n\n# StyleCop\nStyleCopReport.xml\n\n# Files built by Visual Studio\n*_i.c\n*_p.c\n*_h.h\n*.ilk\n*.meta\n*.obj\n*.iobj\n*.pch\n*.pdb\n*.ipdb\n*.pgc\n*.pgd\n*.rsp\n*.sbr\n*.tlb\n*.tli\n*.tlh\n*.tmp\n*.tmp_proj\n*_wpftmp.csproj\n*.log\n*.tlog\n*.vspscc\n*.vssscc\n.builds\n*.pidb\n*.svclog\n*.scc\n\n# Chutzpah Test files\n_Chutzpah*\n\n# Visual C++ cache files\nipch/\n*.aps\n*.ncb\n*.opendb\n*.opensdf\n*.sdf\n*.cachefile\n*.VC.db\n*.VC.VC.opendb\n\n# Visual Studio profiler\n*.psess\n*.vsp\n*.vspx\n*.sap\n\n# Visual Studio Trace Files\n*.e2e\n\n# TFS 2012 Local Workspace\n$tf/\n\n# Guidance Automation Toolkit\n*.gpState\n\n# ReSharper is a .NET coding add-in\n_ReSharper*/\n*.[Rr]e[Ss]harper\n*.DotSettings.user\n\n# TeamCity is a build add-in\n_TeamCity*\n\n# DotCover is a Code Coverage Tool\n*.dotCover\n\n# AxoCover is a Code Coverage Tool\n.axoCover/*\n!.axoCover/settings.json\n\n# Coverlet is a free, cross platform Code Coverage Tool\ncoverage*.json\ncoverage*.xml\ncoverage*.info\n\n# Visual Studio code coverage results\n*.coverage\n*.coveragexml\n\n# NCrunch\n_NCrunch_*\n.*crunch*.local.xml\nnCrunchTemp_*\n\n# MightyMoose\n*.mm.*\nAutoTest.Net/\n\n# Web workbench (sass)\n.sass-cache/\n\n# Installshield output folder\n[Ee]xpress/\n\n# DocProject is a documentation generator add-in\nDocProject/buildhelp/\nDocProject/Help/*.HxT\nDocProject/Help/*.HxC\nDocProject/Help/*.hhc\nDocProject/Help/*.hhk\nDocProject/Help/*.hhp\nDocProject/Help/Html2\nDocProject/Help/html\n\n# Click-Once directory\npublish/\n\n# Publish Web Output\n*.[Pp]ublish.xml\n*.azurePubxml\n# Note: Comment the next line if you want to checkin your web deploy settings,\n# but database connection strings (with potential passwords) will be unencrypted\n*.pubxml\n*.publishproj\n\n# Microsoft Azure Web App publish settings. Comment the next line if you want to\n# checkin your Azure Web App publish settings, but sensitive information contained\n# in these scripts will be unencrypted\nPublishScripts/\n\n# NuGet Packages\n*.nupkg\n# NuGet Symbol Packages\n*.snupkg\n# The packages folder can be ignored because of Package Restore\n**/[Pp]ackages/*\n# except build/, which is used as an MSBuild target.\n!**/[Pp]ackages/build/\n# Uncomment if necessary however generally it will be regenerated when needed\n#!**/[Pp]ackages/repositories.config\n# NuGet v3's project.json files produces more ignorable files\n*.nuget.props\n*.nuget.targets\n\n# Microsoft Azure Build Output\ncsx/\n*.build.csdef\n\n# Microsoft Azure Emulator\necf/\nrcf/\n\n# Windows Store app package directories and files\nAppPackages/\nBundleArtifacts/\nPackage.StoreAssociation.xml\n_pkginfo.txt\n*.appx\n*.appxbundle\n*.appxupload\n\n# Visual Studio cache files\n# files ending in .cache can be ignored\n*.[Cc]ache\n# but keep track of directories ending in .cache\n!?*.[Cc]ache/\n\n# Others\nClientBin/\n~$*\n*~\n*.dbmdl\n*.dbproj.schemaview\n*.jfm\n*.pfx\n*.publishsettings\norleans.codegen.cs\n\n# Including strong name files can present a security risk\n# (https://github.com/github/gitignore/pull/2483#issue-259490424)\n#*.snk\n\n# Since there are multiple workflows, uncomment next line to ignore bower_components\n# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)\n#bower_components/\n\n# RIA/Silverlight projects\nGenerated_Code/\n\n# Backup & report files from converting an old project file\n# to a newer Visual Studio version. Backup files are not needed,\n# because we have git ;-)\n_UpgradeReport_Files/\nBackup*/\nUpgradeLog*.XML\nUpgradeLog*.htm\nServiceFabricBackup/\n*.rptproj.bak\n\n# SQL Server files\n*.mdf\n*.ldf\n*.ndf\n\n# Business Intelligence projects\n*.rdl.data\n*.bim.layout\n*.bim_*.settings\n*.rptproj.rsuser\n*- [Bb]ackup.rdl\n*- [Bb]ackup ([0-9]).rdl\n*- [Bb]ackup ([0-9][0-9]).rdl\n\n# Microsoft Fakes\nFakesAssemblies/\n\n# GhostDoc plugin setting file\n*.GhostDoc.xml\n\n# Node.js Tools for Visual Studio\n.ntvs_analysis.dat\nnode_modules/\n\n# Visual Studio 6 build log\n*.plg\n\n# Visual Studio 6 workspace options file\n*.opt\n\n# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)\n*.vbw\n\n# Visual Studio 6 auto-generated project file (contains which files were open etc.)\n*.vbp\n\n# Visual Studio 6 workspace and project file (working project files containing files to include in project)\n*.dsw\n*.dsp\n\n# Visual Studio 6 technical files\n*.ncb\n*.aps\n\n# Visual Studio LightSwitch build output\n**/*.HTMLClient/GeneratedArtifacts\n**/*.DesktopClient/GeneratedArtifacts\n**/*.DesktopClient/ModelManifest.xml\n**/*.Server/GeneratedArtifacts\n**/*.Server/ModelManifest.xml\n_Pvt_Extensions\n\n# Paket dependency manager\n.paket/paket.exe\npaket-files/\n\n# FAKE - F# Make\n.fake/\n\n# CodeRush personal settings\n.cr/personal\n\n# Python Tools for Visual Studio (PTVS)\n__pycache__/\n*.pyc\n\n# Cake - Uncomment if you are using it\n# tools/**\n# !tools/packages.config\n\n# Tabs Studio\n*.tss\n\n# Telerik's JustMock configuration file\n*.jmconfig\n\n# BizTalk build output\n*.btp.cs\n*.btm.cs\n*.odx.cs\n*.xsd.cs\n\n# OpenCover UI analysis results\nOpenCover/\n\n# Azure Stream Analytics local run output\nASALocalRun/\n\n# MSBuild Binary and Structured Log\n*.binlog\n\n# NVidia Nsight GPU debugger configuration file\n*.nvuser\n\n# MFractors (Xamarin productivity tool) working folder\n.mfractor/\n\n# Local History for Visual Studio\n.localhistory/\n\n# Visual Studio History (VSHistory) files\n.vshistory/\n\n# BeatPulse healthcheck temp database\nhealthchecksdb\n\n# Backup folder for Package Reference Convert tool in Visual Studio 2017\nMigrationBackup/\n\n# Ionide (cross platform F# VS Code tools) working folder\n.ionide/\n\n# Fody - auto-generated XML schema\nFodyWeavers.xsd\n\n# VS Code files for those working on multiple tools\n.vscode/*\n!.vscode/settings.json\n!.vscode/tasks.json\n!.vscode/launch.json\n!.vscode/extensions.json\n*.code-workspace\n\n# Local History for Visual Studio Code\n.history/\n\n# Windows Installer files from build outputs\n*.cab\n*.msi\n*.msix\n*.msm\n*.msp\n\n# JetBrains Rider\n*.sln.iml\n"
  },
  {
    "path": "Docs/Clear-SqlMessage.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Clear-SqlMessage\n\n## SYNOPSIS\nClears all available informational messages.\n\n## SYNTAX\n\n```\nClear-SqlMessage [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nClear-SqlMessage removes all informational messages generated by Invoke-SqlScalar, Invoke-SqlQuery, or Invoke-SqlUpdate.  Not all providers support informational messages.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Clear-SqlMessage\n```\n\nClear the message queue for the connection\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Close-SqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Close-SqlConnection\n\n## SYNOPSIS\nCloses the SqlConnection.\n\n## SYNTAX\n\n```\nClose-SqlConnection [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nCloses the connection and disposes of the underlying object.  This will also rollback the current transaction if there is one.  Can specify which SqlConnection with the -ConnectionName parameter.  Cmdlet supports piping connectionNames.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Close-SqlConnection\n```\n\nCloses the sql connection.\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Complete-SqlTransaction.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Complete-SqlTransaction\n\n## SYNOPSIS\nComplete a SQL transaction.\n\n## SYNTAX\n\n```\nComplete-SqlTransaction [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nComplete (COMMIT) a SQL transaction.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Complete-SqlTransaction\n```\n\nCommits the SQL transaction\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Get-SqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Get-SqlConnection\n\n## SYNOPSIS\nGets the underlying provider connection object.\n\n## SYNTAX\n\n```\nGet-SqlConnection [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nGets the underlying provider connection object for the current connection or for the connection name specified.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Get-SqlConnection\n```\n\nReturns the provider-specific Connection object.\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Get-SqlMessage.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Get-SqlMessage\n\n## SYNOPSIS\nReturns any available informational messages.\n\n## SYNTAX\n\n```\nGet-SqlMessage [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\n Get-SqlMessage returns any informational messages generated by Invoke-SqlScalar, Invoke-SqlQuery, or Invoke-SqlUpdate.  Not all providers support informational messages.\n\nSQL Server, if you use Print or Raiserror without the \"NoWait\", then messages will be batched to 8kb and then sent.  To get messages immediately sent, your query needs to use:\n    RAISERROR('your message', 10,1) WITH NOWAIT\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Get-SqlMessage\n```\n\nReturns all the messages in the queue.\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Get-SqlTransaction.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Get-SqlTransaction\n\n## SYNOPSIS\nGets the underlying provider transaction object.\n\n## SYNTAX\n\n```\nGet-SqlTransaction [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nGets the underlying provider transaction object for the current connection or for the connection name specified.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Get-SqlTransaction\n```\n\nReturns the provider specific transaction object.\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Invoke-SqlBulkCopy.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Invoke-SqlBulkCopy\n\n## SYNOPSIS\nExecutes a bulk copy between two connections.\n\n## SYNTAX\n\n### table (Default)\n```\nInvoke-SqlBulkCopy [-SourceConnectionName <String>] [-DestinationConnectionName <String>]\n [-DestinationTable <String>] -SourceTable <String> [-ColumnMap <Hashtable>] [-BatchSize <Int32>]\n [-BatchTimeout <Int32>] [-Notify] [-NotifyAction <System.Action`1[System.Int64]>] [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n### query\n```\nInvoke-SqlBulkCopy [-SourceConnectionName <String>] [-DestinationConnectionName <String>]\n -DestinationTable <String> -SourceQuery <String[]> [-SourceParameters <Hashtable>] [-ColumnMap <Hashtable>]\n [-BatchSize <Int32>] [-BatchTimeout <Int32>] [-Notify] [-NotifyAction <System.Action`1[System.Int64]>]\n [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nExecutes a bulk copy operation between two connections.  This is highly optimized if the destination has a managed bulkcopy implemenation, otherwise it is only generally optimized.  For example, SQL Server has a bulk copy class (SqlBulkCopy) that is easily implemented and provides an efficient means of inserting data into SQL Server.\n\nThe default implemenation, if the provider does not provider a managed bulk copy mechanism is to prepare the sql insert, and wrap multiple inserts into a single transaction (batching).  This provides a significant performance improvement over looping with Invoke-SqlUpdate.\n\nCONSIDERATIONS\n* You must specify either a SourceConnectionName or DestinationConnectionName, whichever one is not specified will use 'default', not specifying either will cause an error.      \n* If you don't specify DestinationTable, it will use SourceTable; however DestinationTable is required if you use SourceQuery.\n* If you specify ColumnMap and Source Table, then the select against the SourceConnection will be limited to the columns you specified in ColumnMap.\n\nReturns number of rows copied.\n\n## EXAMPLES\n\n## PARAMETERS\n\n### -BatchSize\nHow many inserts are batched together at one time.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 500\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -BatchTimeout\nHow long, in seconds, that each batch can take. Defaults to the command timeout for the source connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ColumnMap\nKey is the column name in the source connection.  Value is the column name in the destination connection.\n\n```yaml\nType: Hashtable\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -DestinationConnectionName\nUser defined name for connection where data will be inserted to.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: DstCN\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -DestinationTable\nThe name of the table to write to in the destination connection.  If not specified, will be taken from SourceTable parameter.\n\n```yaml\nType: String\nParameter Sets: table\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n```yaml\nType: String\nParameter Sets: query\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Notify\nIf present, as each batch completes a progress notification will be generated with the total number of rows inserted so far.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -NotifyAction\nProvide a scriptblock to be executed after every BatchSize number of rows are inserted.\nScriptblock will be called with the number of rows inserted so far.\n\n```yaml\nType: System.Action`1[System.Int64]\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -SourceConnectionName\nUser defined name for connection where data will be queried from.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: SrcCN\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -SourceParameters\nParameters needed for the source query.\n\n```yaml\nType: Hashtable\nParameter Sets: query\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -SourceQuery\nThe query to determine the source data, instead of specifying a table.\n\n```yaml\nType: String[]\nParameter Sets: query\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -SourceTable\nThe name of the table in the source connection.\n\n```yaml\nType: String\nParameter Sets: table\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.String[]\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Invoke-SqlQuery.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Invoke-SqlQuery\n\n## SYNOPSIS\nExecutes a query and returns data.\n\n## SYNTAX\n\n### object (Default)\n```\nInvoke-SqlQuery [-ConnectionName <String>] [-Query] <String[]> [-CommandTimeout <Int32>]\n [[-ParamObject] <PSObject>] [-Stream] [-AsDataTable] [-UseTypesFromProvider] [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n### hashtable\n```\nInvoke-SqlQuery [-ConnectionName <String>] [-Query] <String[]> [-Parameters] <Hashtable>\n [-CommandTimeout <Int32>] [-Stream] [-AsDataTable] [-UseTypesFromProvider] [-WhatIf] [-Confirm]\n [<CommonParameters>]\n```\n\n## DESCRIPTION\nExecutes a query against the targeted connection and returns the data.  This can handle multiple result sets (if underlying provider supports it).  If there are multiple result sets, the output is datatables, otherwise datarows.\n\nIf the -Stream switch is used, only the first result set is returned and the output is a PSObject for each row in the result set.\n\nSupports piping in objects, which will be converted to parameters and the query will be executed for once for each object piped in.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Invoke-SqlQuery -Query \"SELECT * FROM TABLE\"\n```\n\nRun a simple query and return the output\n\n### Example 2\n```powershell\nPS C:\\> Invoke-SqlQuery -Query \"SELECT * FROM TABLE WHERE col1=@id' AND colb > @someDate\" -Parameters @{id = 1; someDate = (Get-Date)}\n```\n\nRuns a simple query with parameters\n\n### Example 3\n```powershell\nPS C:\\> $obj = [PSCustomObject]@{id = 1; sd = (Get-date)}\nPS C:\\> $obj | Invoke-SqlQuery -Query \"SELECT * FROM TABLE WHERE col1=@id' AND colb > @someDate\"\n```\n\nRuns a simple query, passing in parameters via object\n\n## PARAMETERS\n\n### -AsDataTable\nForces the return objects to be one or more datatables. If combined with -Stream, -AsDataTable will be ignored.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe timeout, in seconds, for this SQL statement, defaults to the command timeout for the SqlConnection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Parameters\nParameters required by the query. Key matches the parameter name, Value is the value of the parameter.\n\n```yaml\nType: Hashtable\nParameter Sets: hashtable\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ParamObject\nThe object that contains the parameters for the query, member names match the parameter name.\n\n```yaml\nType: PSObject\nParameter Sets: object\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Query\nSQL statement to run.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 0\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Stream\nUses a datareader to stream PSObject representing the results of the query to the pipeline, results will appear as soon as the connection begins returning data.  Only returns the first resultset if there are multiples. If combined with -AsDataTable, -AsDataTable will be ignored.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -UseTypesFromProvider\nWill attempt to return the provider specific data types instead of standard .NET datatypes.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: ProviderTypes\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Management.Automation.PSObject\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Invoke-SqlScalar.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Invoke-SqlScalar\n\n## SYNOPSIS\nExecutes a Scalar query.\n\n## SYNTAX\n\n### object (Default)\n```\nInvoke-SqlScalar [-ConnectionName <String>] [-Query] <String[]> [-CommandTimeout <Int32>]\n [[-ParamObject] <PSObject>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n### hashtable\n```\nInvoke-SqlScalar [-ConnectionName <String>] [-Query] <String[]> [-Parameters] <Hashtable>\n [-CommandTimeout <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nExecutes a Scalar query against the targeted connection.  If the sql statement generates multiple rows and/or columns, only the first column of the first row is returned.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Invoke-SqlScalar -Query \"SELECT Count(1) FROM TABLE\"\n```\n\nSimple Scalar query\n\n### Example 2\n```powershell\nPS C:\\> Invoke-SqlQuery -Query \"SELECT Count(1) FROM TABLE WHERE colb > @someDate\" -Parameters @{someDate = (Get-Date)}\n```\n\nSimple Scalar query with parameters\n\n### Example 3\n```powershell\nPS C:\\> $obj = [PSCustomObject]@{sd = (Get-date)}\nPS C:\\> $obj | Invoke-SqlScalar -Query \"SELECT Count(1) FROM TABLE WHERE colb> @sd\"\n```\n\nSimple Scalar query with parameters populated by object\n\n## PARAMETERS\n\n### -CommandTimeout\nThe timeout, in seconds, for this SQL statement, defaults to the command timeout for the SqlConnection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Parameters\nParameters required by the query. Key matches the parameter name, Value is the value of the parameter.\n\n```yaml\nType: Hashtable\nParameter Sets: hashtable\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ParamObject\nThe object that contains the parameters for the query, member names match the parameter name.\n\n```yaml\nType: PSObject\nParameter Sets: object\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Query\nSQL statement to run.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 0\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Management.Automation.PSObject\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Invoke-SqlUpdate.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Invoke-SqlUpdate\n\n## SYNOPSIS\nExecutes a query and returns number of record affected.\n\n## SYNTAX\n\n### object (Default)\n```\nInvoke-SqlUpdate [-ConnectionName <String>] [-Query] <String[]> [-CommandTimeout <Int32>]\n [[-ParamObject] <PSObject>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n### hashtable\n```\nInvoke-SqlUpdate [-ConnectionName <String>] [-Query] <String[]> [-Parameters] <Hashtable>\n [-CommandTimeout <Int32>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n### cmd\n```\nInvoke-SqlUpdate [-ConnectionName <String>] [-Query] <String[]> [-CommandTimeout <Int32>] -Command <IDbCommand>\n [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nExecutes a query against the targeted connection and returns the the number of records affected.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Invoke-SqlUpdate -Query \"UPDATE employees SET salary = @val WHERE manager = @managerId\" -Parameters @{val = 999999; managerId = 549}\n```\n\nUpdates the employee table setting the salary to 999999 for all rows with managerid of 549\n\n### Example 2\n```powershell\nPS C:\\> $obj = [PSCustomObject]@{id = 549; val = 999999}\nPS C:\\> $obj | Invoke-SqlUpdate -Query \"UPDATE employees SET salary = @val WHERE manager = @id\"\n```\n\nUpdates the employee table setting the salary to 999999 for all rows with managerid of 549 using an object\n\n## PARAMETERS\n\n### -Command\na Data.DbCommand object to execute (or a provider specific version).\n\n```yaml\nType: IDbCommand\nParameter Sets: cmd\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe timeout, in seconds, for this SQL statement, defaults to the command timeout for the SqlConnection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Parameters\nParameters required by the query. Key matches the parameter name, Value is the value of the parameter.\n\n```yaml\nType: Hashtable\nParameter Sets: hashtable\nAliases:\n\nRequired: True\nPosition: 1\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ParamObject\nThe object that contains the parameters for the query, member names match the parameter name.\n\n```yaml\nType: PSObject\nParameter Sets: object\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByValue)\nAccept wildcard characters: False\n```\n\n### -Query\nSQL statement to run.\n\n```yaml\nType: String[]\nParameter Sets: (All)\nAliases:\n\nRequired: True\nPosition: 0\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Management.Automation.PSObject\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Open-MySqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Open-MySqlConnection\n\n## SYNOPSIS\nOpen a connection to a MySql Database.\n\n## SYNTAX\n\n### default (Default)\n```\nOpen-MySqlConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-Database] <String>] [-Port <Int32>] [-SSLMode <String>] [[-Credential] <PSCredential>]\n [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### conn\n```\nOpen-MySqlConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Credential] <PSCredential>]\n -ConnectionString <String> [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpen a connection to a MySql Database.\n        \nMySqlConnector: High Performance .NET MySQL Driver @ https://mysqlconnector.net/\n.NET Provider @ https://www.nuget.org/packages/MySqlConnector/\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> Open-MySqlConnection -server 'localhost' -database 'DBname' -Credential (Get-Credential)\n```\n\nOpens a connection to localhost using a credential retrieved from the user.\n\n## PARAMETERS\n\n### -Additional\nHashtable to provide additional connection parameters.\n\n```yaml\nType: Hashtable\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 30\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionString\nSpecifies a provider specific connectionstring to be used.\n\n```yaml\nType: String\nParameter Sets: conn\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Credential\nA PSCredential object providing the proper credentials to access to the datasource (if required).\n\n```yaml\nType: PSCredential\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Database\nDatabase name.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: InitialCatalog\n\nRequired: False\nPosition: 1\nDefault value: mysql\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Port\nPort to connect on, if different from default (3306).\n\n```yaml\nType: Int32\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 3306\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Server\nThe Server for the connection.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: Host\n\nRequired: False\nPosition: 0\nDefault value: localhost\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -SSLMode\nWhich SLLMode to use (defaults to Preferred)\nDisabled: (equivalent to 'None') Do not use SSL.\nPreferred: Use SSL if the server supports it.\nRequired: Always use SSL. Deny connection if server does not support SSL. Does not validate CA or hostname.\nVerifyCA: Always use SSL. Validates the CA but tolerates hostname mismatch.\nVerifyFull: Always use SSL. Validates CA and hostname.\n\n```yaml\nType: String\nParameter Sets: default\nAliases:\nAccepted values: None, Preferred, Required, VerifyCA, VerifyFull\n\nRequired: False\nPosition: Named\nDefault value: Preferred\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n### System.Management.Automation.PSCredential\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Open-OracleConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Open-OracleConnection\n\n## SYNOPSIS\nOpen a connection to a Oracle Database.\n\n## SYNTAX\n\n### default (Default)\n```\nOpen-OracleConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-ServiceName] <String>] [-Port <Int32>] [-Privilege <String>] [[-Credential] <PSCredential>]\n [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### tns\n```\nOpen-OracleConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] -TnsName <String>\n [-Privilege <String>] [[-Credential] <PSCredential>] [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### conn\n```\nOpen-OracleConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [-Privilege <String>]\n -ConnectionString <String> [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpen a connection to a Oracle Database.\n        \nOracle Managed Data Access @ http://www.oracle.com/technetwork/topics/dotnet/index-085163.html\nProvider for .NET @ https://www.nuget.org/packages/Oracle.ManagedDataAccess\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -Additional\nHashtable to provide additional connection parameters.\n\n```yaml\nType: Hashtable\nParameter Sets: default, tns\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 30\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionString\nSpecifies a provider specific connectionstring to be used.\n\n```yaml\nType: String\nParameter Sets: conn\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Credential\nA PSCredential object providing the proper credentials to access to the datasource (if required).\n\n```yaml\nType: PSCredential\nParameter Sets: default, tns\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Port\nPort to connect on, if different from default (1521).\n\n```yaml\nType: Int32\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 1521\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Privilege\nDetermines the elevated privileges the connection has: SYSDBA, SYSOPER, SYSASM.  By default, none.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\nAccepted values: None, SYSASM, SYSDBA, SYSOPER\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Server\nThe datasource for the connection.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: Host, DataSource\n\nRequired: False\nPosition: 0\nDefault value: localhost\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ServiceName\nOracle ServiceName (SID).\n\n```yaml\nType: String\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -TnsName\nThe TnsName to connect to.\n\n```yaml\nType: String\nParameter Sets: tns\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n### System.Management.Automation.PSCredential\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Open-PostGreConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Open-PostGreConnection\n\n## SYNOPSIS\nOpen a connection to a PostGre Database.\n\n## SYNTAX\n\n### default (Default)\n```\nOpen-PostGreConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-Database] <String>] [-Port <Int32>] [-MaxAutoPrepare <Int32>] [-SSLMode <String>]\n [[-Credential] <PSCredential>] [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### conn\n```\nOpen-PostGreConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Credential] <PSCredential>]\n -ConnectionString <String> [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpen a connection to a PostGre Database.\n        \nPostGreSQL @ https://www.postgresql.org/\nPostGre via Npgsql @ http://www.npgsql.org/\n.NET Provider @ https://www.nuget.org/packages/Npgsql\nGeometry: http://www.npgsql.org/doc/types/nts.html\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -Additional\nHashtable to provide additional connection parameters.\n\n```yaml\nType: Hashtable\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 30\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionString\nSpecifies a provider specific connectionstring to be used.\n\n```yaml\nType: String\nParameter Sets: conn\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Credential\nA PSCredential object providing the proper credentials to access to the datasource (if required).\n\n```yaml\nType: PSCredential\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Database\nDatabase name.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: InitialCatalog\n\nRequired: False\nPosition: 1\nDefault value: postgres\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -MaxAutoPrepare\nThe maximum number SQL statements that can be automatically prepared at any given point. Beyond this number the least-recently-used statement will be recycled. Zero disables automatic preparation.  DEFAULTS TO 25.\n\n```yaml\nType: Int32\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 25\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Port\nPort to connect on, if different from default (5432).\n\n```yaml\nType: Int32\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 5432\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Server\nThe Server for the connection.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: Host\n\nRequired: False\nPosition: 0\nDefault value: localhost\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -SSLMode\nWhich SLLMode to use (defaults to Preferred)\nDisabled: Do not use SSL.\nPreferred: Use SSL if the server supports it.\nRequired: Always use SSL. Deny connection if server does not support SSL. Does not validate CA or hostname.\nVerifyCA: Always use SSL. Validates the CA but tolerates hostname mismatch.\nVerifyFull: Always use SSL. Validates CA and hostname.\n\n\n```yaml\nType: String\nParameter Sets: default\nAliases:\nAccepted values: Disable, Prefer, Require, VerifyCA, VerifyFull\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n### System.Management.Automation.PSCredential\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Open-SQLConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Open-SQLConnection\n\n## SYNOPSIS\nOpen a connection to a SQL Server.\n\n## SYNTAX\n\n### default (Default)\n```\nOpen-SQLConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-Database] <String>] [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### credential\n```\nOpen-SQLConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-Database] <String>] [[-Credential] <PSCredential>] [-AzureAD] [-Additional <Hashtable>]\n [<CommonParameters>]\n```\n\n### token\n```\nOpen-SQLConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Server] <String>]\n [[-Database] <String>] [-AzureToken <String>] [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### conn\n```\nOpen-SQLConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-Credential] <PSCredential>]\n [-AzureToken <String>] -ConnectionString <String> [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpen a connection to a SQL Server.  Default authentication is Integrated Windows Authetication.\n\nMicrosoft.Data.SqlClient.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -Additional\nHashtable to provide additional connection parameters.\n\n```yaml\nType: Hashtable\nParameter Sets: default, credential, token\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -AzureAD\nUse this when connecting to an Azure SQL Database and you are using Azure AD credentials. You can specify the credentials by passing in a credential object to the Credential parameter.\n\n```yaml\nType: SwitchParameter\nParameter Sets: credential\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -AzureToken\nPass in Azure Token (make sure you use the proper resource). If your token begins with \"bearer \" that will be stripped off first.\n\n```yaml\nType: String\nParameter Sets: token, conn\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 30\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionString\nSpecifies a provider specific connectionstring to be used.\n\n```yaml\nType: String\nParameter Sets: conn\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Credential\nA PSCredential object providing the proper credentials to access to the datasource (if required).\n\n```yaml\nType: PSCredential\nParameter Sets: credential, conn\nAliases:\n\nRequired: False\nPosition: 2\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Database\nThe database to connect to.\n\n```yaml\nType: String\nParameter Sets: default, credential, token\nAliases: SqlDatabase, InitialCatalog\n\nRequired: False\nPosition: 1\nDefault value: master\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Server\nThe server to connect to\n\n```yaml\nType: String\nParameter Sets: default, credential, token\nAliases: SqlInstance, SqlServer, DataSource\n\nRequired: False\nPosition: 0\nDefault value: localhost\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n### System.Management.Automation.PSCredential\n\n### System.Management.Automation.SwitchParameter\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Open-SQLiteConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Open-SQLiteConnection\n\n## SYNOPSIS\nOpen a connection to a SQLite database file.\n\n## SYNTAX\n\n### default (Default)\n```\nOpen-SQLiteConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [[-DataSource] <String>]\n [[-Password] <String>] [-Additional <Hashtable>] [<CommonParameters>]\n```\n\n### conn\n```\nOpen-SQLiteConnection [-ConnectionName <String>] [-CommandTimeout <Int32>] [-ConnectionString <String>]\n [<CommonParameters>]\n```\n\n## DESCRIPTION\nOpen a connection to a SQLite database file.\nSQLite Development Team @ https://sqlite.org/\n.NET Provider @ http://system.data.sqlite.org/\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -Additional\nHashtable to provide additional connection parameters.\n\n```yaml\nType: Hashtable\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: 30\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionString\nSpecifies a provider specific connectionstring to be used.\n\n```yaml\nType: String\nParameter Sets: conn\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -DataSource\nThe datasource for the connection.\n\n```yaml\nType: String\nParameter Sets: default\nAliases: FilePath\n\nRequired: False\nPosition: 0\nDefault value: :memory:\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Password\nPassword for the database file.\n\n```yaml\nType: String\nParameter Sets: default\nAliases:\n\nRequired: False\nPosition: 1\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n### System.Collections.Hashtable\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Set-SqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Set-SqlConnection\n\n## SYNOPSIS\nSet options on the SqlConnection.\n\n## SYNTAX\n\n```\nSet-SqlConnection [-ConnectionName <String>] [[-Database] <String>] [-CommandTimeout <Int32>] [-WhatIf]\n [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nSet Database and/or Command Timeout for the SqlConnection. Changing the database may not be valid for all providers.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -CommandTimeout\nThe default command timeout to be used for all commands executed against this connection.\n\n```yaml\nType: Int32\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: Named\nDefault value: default\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Database\nThe database to connect to.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases:\n\nRequired: False\nPosition: 0\nDefault value: None\nAccept pipeline input: True (ByPropertyName)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n### System.Int32\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Show-SqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Show-SqlConnection\n\n## SYNOPSIS\nLists the current SqlConnection.\n\n## SYNTAX\n\n### single (Default)\n```\nShow-SqlConnection [[-ConnectionName] <String>] [<CommonParameters>]\n```\n\n### all\n```\nShow-SqlConnection [-All] [<CommonParameters>]\n```\n\n## DESCRIPTION\nLists the current SqlConnection information or outputs a list of all SqlConnections currently active.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -All\nIf present, will return list of all connection names.\n\n```yaml\nType: SwitchParameter\nParameter Sets: all\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: single\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/SimplySql.md",
    "content": "---\nModule Name: SimplySql\nModule Guid: 71b1095f-dcb6-497d-8b47-a69c284aec64\nDownload Help Link: {{ Update Download Link }}\nHelp Version: {{ Please enter version of help manually (X.X.X.X) format }}\nLocale: en-US\n---\n\n# SimplySql Module\n## Description\nSimplySql - Talking to relational databases the PowerShell way.   Simple commands... Powerful opportunities.\n\n## SimplySql Cmdlets\n### [Clear-SqlMessage](Clear-SqlMessage.md)\nClears all available informational messages.\n\n### [Close-SqlConnection](Close-SqlConnection.md)\nCloses the SqlConnection.\n\n### [Complete-SqlTransaction](Complete-SqlTransaction.md)\nComplete a SQL transaction.\n\n### [Get-SqlConnection](Get-SqlConnection.md)\nGets the underlying provider connection object.\n\n### [Get-SqlMessage](Get-SqlMessage.md)\nReturns any available informational messages.\n\n### [Get-SqlTransaction](Get-SqlTransaction.md)\nGets the underlying provider transaction object.\n\n### [Invoke-SqlBulkCopy](Invoke-SqlBulkCopy.md)\nExecutes a bulk copy between two connections.\n\n### [Invoke-SqlQuery](Invoke-SqlQuery.md)\nExecutes a query and returns data.\n\n### [Invoke-SqlScalar](Invoke-SqlScalar.md)\nExecutes a Scalar query.\n\n### [Invoke-SqlUpdate](Invoke-SqlUpdate.md)\nExecutes a query and returns number of record affected.\n\n### [Open-MySqlConnection](Open-MySqlConnection.md)\nOpen a connection to a MySql Database.\n\n### [Open-OracleConnection](Open-OracleConnection.md)\nOpen a connection to a Oracle Database.\n\n### [Open-PostGreConnection](Open-PostGreConnection.md)\nOpen a connection to a PostGre Database.\n\n### [Open-SQLConnection](Open-SQLConnection.md)\nOpen a connection to a SQL Server.\n\n### [Open-SQLiteConnection](Open-SQLiteConnection.md)\nOpen a connection to a SQLite database file.\n\n### [Set-SqlConnection](Set-SqlConnection.md)\nSet options on the SqlConnection.\n\n### [Show-SqlConnection](Show-SqlConnection.md)\nLists the current SqlConnection.\n\n### [Start-SqlTransaction](Start-SqlTransaction.md)\nStart a sql transaction.\n\n### [Test-SqlConnection](Test-SqlConnection.md)\nTests to see if there is a connection.\n\n### [Undo-SqlTransaction](Undo-SqlTransaction.md)\nUndo a SQL transaction.\n\n"
  },
  {
    "path": "Docs/Start-SqlTransaction.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Start-SqlTransaction\n\n## SYNOPSIS\nStart a sql transaction.\n\n## SYNTAX\n\n```\nStart-SqlTransaction [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nStart (BEGIN) a sql transaction.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Test-SqlConnection.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Test-SqlConnection\n\n## SYNOPSIS\nTests to see if there is a connection.\n\n## SYNTAX\n\n### single (Default)\n```\nTest-SqlConnection [[-ConnectionName] <String>] [-Detailed] [<CommonParameters>]\n```\n\n### all\n```\nTest-SqlConnection [-All] [<CommonParameters>]\n```\n\n## DESCRIPTION\nTests to see if there is a connection, use the -All switch to determine if there are any connections.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -All\nReturns true if there are any connections, otherwise false.\n\n```yaml\nType: SwitchParameter\nParameter Sets: all\nAliases:\n\nRequired: True\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: single\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Detailed\nIf present, will only return return if connection is found and in an Open state.\n\n```yaml\nType: SwitchParameter\nParameter Sets: single\nAliases:\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/Undo-SqlTransaction.md",
    "content": "---\nexternal help file: SimplySql.Cmdlets.dll-Help.xml\nModule Name: SimplySql\nonline version:\nschema: 2.0.0\n---\n\n# Undo-SqlTransaction\n\n## SYNOPSIS\nUndo a SQL transaction.\n\n## SYNTAX\n\n```\nUndo-SqlTransaction [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]\n```\n\n## DESCRIPTION\nUndo (ROLLBACK) a SQL transaction.\n\n## EXAMPLES\n\n### Example 1\n```powershell\nPS C:\\> {{ Add example code here }}\n```\n\n{{ Add example description here }}\n\n## PARAMETERS\n\n### -ConnectionName\nUser defined name for connection.\n\n```yaml\nType: String\nParameter Sets: (All)\nAliases: cn\n\nRequired: False\nPosition: 0\nDefault value: default\nAccept pipeline input: True (ByPropertyName, ByValue)\nAccept wildcard characters: False\n```\n\n### -Confirm\nPrompts you for confirmation before running the cmdlet.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: cf\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### -WhatIf\nShows what would happen if the cmdlet runs.\nThe cmdlet is not run.\n\n```yaml\nType: SwitchParameter\nParameter Sets: (All)\nAliases: wi\n\nRequired: False\nPosition: Named\nDefault value: None\nAccept pipeline input: False\nAccept wildcard characters: False\n```\n\n### CommonParameters\nThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).\n\n## INPUTS\n\n### System.String\n\n## OUTPUTS\n\n### System.Object\n## NOTES\n\n## RELATED LINKS\n"
  },
  {
    "path": "Docs/about_SimplySql.md",
    "content": "﻿# SimplySql\n## about_SimplySql\n\n# SHORT DESCRIPTION\nSimplySql - Talking to relational databases the PowerShell way.\nSimple commands... Powerful opportunities.\n\n# LONG DESCRIPTION\nSimplySql is a module that provides an intuitive set of cmdlets for talking to databases that abstracts the vendor specifics, allowing you to focus on getting work done.\n\nThe basic pattern is to connect to a database, execute one or more sql statements and then close your database connection.  This module provides cmdlets that map to this basic pattern.\n\nOpen/Close/Show/Test/Set/Get -SqlConnection\n  - Open/Close cmdlets enable you to connect to databases in straightforward terms without worrying about differences between database vendors.  There is a specific \"Open-*\" cmdlet for each provider. (Open-SqlConnection, Open-SQLiteConnection, Open-OracleConnection, Open-PostGreConnection, Open-MySqlConnection).\n\n  - Show/Test cmdlets allow you to see what connections are currently active in your powershell session and see specific details about those connections.\n    \n  - Set cmdlet allows you to change the default commandTimeout and the database/catalog in use (if the provider supports it).\n\n  - Get cmdlet returns the underlying connection object itself. \n\nInvoke- SqlScalar/SqlQuery/SqlUpdate\n  - These cmdlets allow you to execute sql statements against the database connections that you have opened.  Any type of statement can be used with any cmdlet, but the output is tailored to specific types of activity.\n    \n  - SqlScalar is great for returning a single value.\n    \n  - SqlQuery is used for returning one or more result sets (output is DataRow for single resultset and Table for multiple resultsets).  You can use the switch -Stream to return PSObject instead of DataRow.\n    \n  - SqlUpdate is used for making modifications (insert, update, delete, etc) and its output is the number of rows effected.\n\nGet/Clear -SqlMessage\n  - These cmdlets provider access to informational messages, if the provider supports them.\n  - Get will return the messages generated by Invoke-SqlScalar/SqlQuery/SqlUpdate cmdlets.  Messages are consumed as they are read and can be cleared, without reading, by calling the Clear cmdlet.\n  - The messages are timestamped to when they were received by calling command (and not necessarily when they were generated on the server since many implementations are Asynchronous.)\n\nInvoke-SqlBulkCopy\n  - This is intended to make moving data from one connection to another connection (even cross vendor) simple.  This is highly optimized for all providers.\n\nStart/Complete/Undo -SqlTransaction\n  - These cmdlets provide a simple way to wrap Invoke-Sql* (except for SqlBulkCopy) into a transaction and then either commit or rollback. \n  - Complete-SqlTransaction maps to COMMIT and Undo-SqlTransaction maps to ROLLBACK.\n\n# EXAMPLES\n```powershell\nOpen-SQLiteConnection\nInvoke-SqlUpdate -Query \"CREATE TABLE test (path text, size real, created datetime)\" | Out-Null\n\n$InsertQuery = \"INSERT INTO test (path, size, created) VALUES (@path, @size, @created)\"\n\n[int]$recordsInserted = 0\nGet-ChildItem -Recurse |\n    ForEach-Object {\n        $recordsInserted += Invoke-SqlUpdate -Query $InsertQuery -Parameters @{\n                path = $_.FullName\n                size = $_.Length\n                created = $_.CreationTime\n            }\n    }\n\nWrite-Host \"Insert $recordsInserted\"\n\n$query = \"SELECT * FROM test WHERE size > @size or created < @dt\"\nInvoke-SqlQuery -Query $query -Parameters @{\n        size = 100kb\n        dt = (Get-Date).AddYears(-2)\n    } -Stream\n\nClose-SqlConnection\n```\n# SEE ALSO\nabout_SimplySql_Providers\n\n# KEYWORDS\nSimplySql\n"
  },
  {
    "path": "HandleVerbose.ps1",
    "content": "[cmdletBinding()]\nparam([parameter(Position=0)][string]$Summary, [parameter(position=1)][string]$StepValue, [parameter(ValueFromPipeline)]$thisItem)\nbegin { \n    if ($VerbosePreference -ne \"Continue\" -and -not [string]::IsNullOrWhiteSpace($summary)){\n        Write-Host \"  $Summary...\" -NoNewline\n    }\n}\nprocess {\n    if($VerbosePreference -eq \"Continue\") { $thisItem }\n    elseif(-not [string]::IsNullOrWhiteSpace($StepValue)) { Write-Host $StepValue -NoNewline}\n}\nend {\n    if ($VerbosePreference -ne \"Continue\" -and -not [string]::IsNullOrWhiteSpace($summary)){\n        Write-Host \"Done!\"\n    }\n}"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2020 Mithrandyr\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "ModuleManifest/SimplySql.psd1",
    "content": "#\n# Module manifest for module 'SimplySql'\n#\n# Generated by: Mithrandyr\n#\n# Generated on: 4/28/2026\n#\n\n@{\n\n# Script module or binary module file associated with this manifest.\nRootModule = 'SimplySql.Cmdlets.dll'\n\n# Version number of this module.\nModuleVersion = '2.2.0.106'\n\n# Supported PSEditions\n# CompatiblePSEditions = @()\n\n# ID used to uniquely identify this module\nGUID = '71b1095f-dcb6-497d-8b47-a69c284aec64'\n\n# Author of this module\nAuthor = 'Mithrandyr'\n\n# Company or vendor of this module\nCompanyName = 'SolarNet'\n\n# Copyright statement for this module\nCopyright = '(c) 2022 Mithrandyr. All rights reserved.'\n\n# Description of the functionality provided by this module\nDescription = 'Querying SQL (SQL Server, Oracle, PostgreSql, SQLite, & mySql) the PowerShell way: simple commands... powerful opportunities.\n\nSimplySql is a module that provides an intuitive set of cmdlets for talking to databases that abstracts the vendor specifics, allowing you to focus on getting work done.  The basic pattern is to connect to a database, execute one or more sql statements and then close your database connection.  This module provides cmdlets that map to this basic pattern.  Each provider has its own Open-*Connection cmdlet -> Open-SqlConnection, Open-SQLiteConnection, Open-OracleConnection, Open-PostGreConnection, Open-MySqlConnection.  The rest of the commands are provider agnostic.\n\nOpen/Close/Show/Test/Set/Get -SqlConnection >> Control as many active connections as you want.\nInvoke- SqlScalar/SqlQuery/SqlUpdate >> Interact with those connections.\nGet/Clear -SqlMessage >> Get Informational messages, if provider supports it.\nInvoke-SqlBulkCopy >> Bulk Dataload from one connection to another.\nStart/Complete/Undo -SqlTransaction >> Utilize transactions!'\n\n# Minimum version of the Windows PowerShell engine required by this module\nPowerShellVersion = '5.0'\n\n# Name of the Windows PowerShell host required by this module\n# PowerShellHostName = ''\n\n# Minimum version of the Windows PowerShell host required by this module\n# PowerShellHostVersion = ''\n\n# Minimum version of Microsoft .NET Framework required by this module. This prerequisite is valid for the PowerShell Desktop edition only.\n# DotNetFrameworkVersion = ''\n\n# Minimum version of the common language runtime (CLR) required by this module. This prerequisite is valid for the PowerShell Desktop edition only.\n# CLRVersion = ''\n\n# Processor architecture (None, X86, Amd64) required by this module\n# ProcessorArchitecture = ''\n\n# Modules that must be imported into the global environment prior to importing this module\n# RequiredModules = @()\n\n# Assemblies that must be loaded prior to importing this module\n# RequiredAssemblies = @()\n\n# Script files (.ps1) that are run in the caller's environment prior to importing this module.\n# ScriptsToProcess = @()\n\n# Type files (.ps1xml) to be loaded when importing this module\n# TypesToProcess = @()\n\n# Format files (.ps1xml) to be loaded when importing this module\n# FormatsToProcess = @()\n\n# Modules to import as nested modules of the module specified in RootModule/ModuleToProcess\n# NestedModules = @()\n\n# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.\nFunctionsToExport = @()\n\n# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.\nCmdletsToExport = 'Clear-SqlMessage', 'Close-SqlConnection', 'Complete-SqlTransaction', \n               'Get-SqlConnection', 'Get-SqlMessage', 'Get-SqlTransaction', \n               'Invoke-SqlBulkCopy', 'Invoke-SqlQuery', 'Invoke-SqlScalar', \n               'Invoke-SqlUpdate', 'Open-MySqlConnection', 'Open-OracleConnection', \n               'Open-PostGreConnection', 'Open-SQLConnection', \n               'Open-SQLiteConnection', 'Set-SqlConnection', 'Show-SqlConnection', \n               'Start-SqlTransaction', 'Test-SqlConnection', 'Undo-SqlTransaction'\n\n# Variables to export from this module\n# VariablesToExport = @()\n\n# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.\nAliasesToExport = 'csc', 'isq', 'iss', 'isu', 'ssc', 'tsc'\n\n# DSC resources to export from this module\n# DscResourcesToExport = @()\n\n# List of all modules packaged with this module\n# ModuleList = @()\n\n# List of all files packaged with this module\n# FileList = @()\n\n# Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell.\nPrivateData = @{\n\n    PSData = @{\n\n        # Tags applied to this module. These help with module discovery in online galleries.\n        Tags = 'SQL','SQLite','Database','Oracle','MySql','PostGre','Npgsql','MSSQL'\n\n        # A URL to the license for this module.\n        LicenseUri = 'https://github.com/mithrandyr/SimplySql/blob/master/LICENSE'\n\n        # A URL to the main website for this project.\n        ProjectUri = 'https://github.com/mithrandyr/SimplySql'\n\n        # A URL to an icon representing this module.\n        # IconUri = ''\n\n        # ReleaseNotes of this module\n        ReleaseNotes = 'Currently Supporting Microsoft SQL, SQLite, MySql, PostGre and Oracle.  Check project repository for full Release Notes.  Latest addition is support for PostGIS Geometry datatype in PostGreSQL.'\n\n        # Prerelease string of this module\n        # Prerelease = ''\n\n        # Flag to indicate whether the module requires explicit user acceptance for install/update/save\n        # RequireLicenseAcceptance = $false\n\n        # External dependent modules of this module\n        # ExternalModuleDependencies = @()\n\n    } # End of PSData hashtable\n\n } # End of PrivateData hashtable\n\n# HelpInfo URI of this module\n# HelpInfoURI = ''\n\n# Default prefix for commands exported from this module. Override the default prefix using Import-Module -Prefix.\n# DefaultCommandPrefix = ''\n\n}\n\n"
  },
  {
    "path": "README.md",
    "content": "# SimplySql\n\n## Introduction\n\n[![Powershell Gallery](https://img.shields.io/powershellgallery/v/SimplySql.svg)](https://www.powershellgallery.com/packages/SimplySql/)\n[![PowerShell Gallery](https://img.shields.io/powershellgallery/dt/SimplySql.svg)](https://www.powershellgallery.com/packages/SimplySql/)\n\n**Update (2/8/2024):** V2 is Released!!!.\n\nQuerying SQL (SQL Server, Oracle, PostgreSql, SQLite, & mySql) the PowerShell way: simple commands... powerful opportunities.\n\nSimplySql is a module that provides an intuitive set of cmdlets for talking to databases that abstracts the vendor specifics, allowing you to focus on getting work done.\n\nThe basic pattern is to connect to a database, invoke one or more sql statements and then close your database connection. This module provides cmdlets that map to this basic pattern.  Each Provider has its own 'Open-*Connection' cmdlet, but the remaining cmdlets are provider agnostic (MSSQL: Open-SqlConnection, Oracle: Open-OracleConnection, SQLite: Open-SQLiteConnection, etc).  You can have multiple connections open, just distinguish them through the use of the -ConnectionName parameter on every command (if no ConnectionName is specified, it defaults to 'default').\n\n```Powershell\n    Open-*Connection -DataSource \"SomeServer\" -InitialCatalog \"SomeDB\"\n    $data = Invoke-SqlQuery -query \"SELECT * FROM someTable\"\n\n    #or using parameters\n    $data = Invoke-SqlQuery -query \"SELECT * FROM someTable WHERE someCol = @var\" -Parameters @{var = 'a value'}\n    Close-SqlConnection\n```\n\nSee the [Wiki](https://github.com/mithrandyr/SimplySql/wiki) for more details\n\n## Breaking Changes for 2.0\n- UserName/Password parameters are no longer present on `Open-*Connection` cmdlets.  Instead, provide a PSCredential object.\n\n## Status\n\nIt has been released to PowerShellGallery.  Installation is as simple as\n\n    Install-Module SimplySql -Scope CurrentUser\n\nThis module requires PowerShell Version 5.0 or greater\n\n## Database Providers\n\n- Microsoft Sql Server : [Microsoft.Data.SqlClient 5.2.2](https://www.nuget.org/packages/Microsoft.Data.SqlClient/5.2.2)\n- MySQL : [MySqlConnector 2.4.0](https://www.nuget.org/packages/MySqlConnector/2.4.0)\n- Oracle : [Oracle.ManagedDataAccess.Core 2.19.250](https://www.nuget.org/packages/Oracle.ManagedDataAccess.Core/2.19.250) (this is the latest version supporting .NET Standard 2.0)\n- SQLite : [System.Data.SQLite.Core 1.0.119](https://www.nuget.org/packages/System.Data.SQLite.Core/1.0.119)\n- PostgreSQL : [Npgsql (8.0.6)](https://www.nuget.org/packages/Npgsql/8.0.6)\n\n## Latest Version\n## 2.2.0\n* Added support for OSX-ARM64 thanks to @johnnygtech\n* Fixed an issue with -ColumnMap on Invoke-SqlBulkCopy\n\n## 2.1.0\n* Updated some packages that had vulnerabilities\n* Updated Provider Packages\n* Added `-NotifyAction` back in and updated tests to test for this\n* Changed how the `/bin/` folder is built, this should create .NET Framework or .NET Core dlls and hopefully fix the MySqlConnector issue with .NET Standard packages.\n\n## 2.0.4\n* Fixing issue with incorrect query results when querying only some columns of a primary key table\n\n## 2.0.3\n* Providers updated.\n* Minor changes to -Privilege and -SSLMode (Oracle and MySql/PostGre respectively), changed from ENUM to STRING\n\n### 2.0.0\n* First release to support Windows PowerShell 5.1, PS Core and PS7.\n* Migrated the base provider class to .Net & all providers\n* Updated to latest versions of providers (that support .NET Standard 2.0)\n* Leveraged Optimized BulkCopy functionality in each provider.\n\n[View Version History](VersionHistory.md)\n"
  },
  {
    "path": "Tests/mssql.tests.ps1",
    "content": "$ErrorActionPreference = \"Stop\"\n\nDescribe \"MSSQL\" {\n    BeforeAll {\n        $srvName = \"$($env:COMPUTERNAME)\\SQLEXPRESS\"\n        if($srvName -eq \"\\SQLEXPRESS\") { $srvName = \"$($env:NAME).\\SQLEXPRESS\" }  #pscore on non-windows\n        $c = [pscredential]::new(\"simplysql\", (ConvertTo-SecureString -Force -AsPlainText \"simplysql\"))\n        $connHT = @{\n            DataSource = $srvName\n            Credential = $c\n        }\n        Open-SqlConnection @connHT\n        Invoke-SqlUpdate \"IF EXISTS (SELECT * FROM sys.databases WHERE name = 'test') DROP DATABASE test; CREATE DATABASE test\" | Should -Be -1\n        Close-SqlConnection\n    }\n    AfterAll {\n        Open-SqlConnection @connHT -Database master\n        @(isq \"sp_who2\" | ? dbname -eq test | % spid).foreach({ isu \"KILL $_\" })\n        Invoke-SqlUpdate \"DROP Database Test\" | Should -Be -1\n        Close-SqlConnection\n    }\n    BeforeEach { Open-SqlConnection @connHT -Database \"test\" }\n    AfterEach { Show-SqlConnection -all | Close-SqlConnection }\n\n    It \"Test ConnectionString Switch\" {\n        {\n            $connStr = \"Data Source=$srvName;TrustServerCertificate=true\"\n            if ($connHT.ContainsKey(\"Credential\")) {\n                Open-SqlConnection -ConnectionString $connStr -ConnectionName Test -Credential $connHT.Credential -ErrorAction Stop\n            }\n            else {\n                Open-SqlConnection -ConnectionString \"$connStr;Integrated Security=SSPI\" -ConnectionName Test -ErrorAction Stop\n            }\n\n            Close-SqlConnection -ConnectionName Test\n        } | Should -Not -Throw\n    }\n\n    It \"Test Integrated Security\" {\n        if ($PSVersionTable.PSEdition -eq \"Desktop\" -or $PSVersionTable.Platform -like \"Win*\") {\n            {\n                Open-SqlConnection -Server $srvName -ConnectionName \"Test\" -ErrorAction Stop\n                Close-SqlConnection -ConnectionName \"Test\"                \n            } | Should -Not -Throw\n        }\n        else {\n            Set-ItResult -Skipped -Because \"Environment does not support Windows Integrated Auth\"\n        }\n        \n    }\n\n    It \"Invoke-SqlScalar\" {\n        Invoke-SqlScalar -Query \"SELECT GETDATE()\" | Should -BeOfType System.DateTime\n    }\n\n    It \"Invoke-SqlUpdate\" {\n        Invoke-SqlUpdate -Query \";WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n            , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n            , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n            , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n            , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            , tally(n) AS (SELECT ROW_NUMBER() OVER (ORDER BY N) FROM f)\n            SELECT RAND(n) AS colDec\n                , CAST(RAND(n*n / 4) * 1000000 AS int) AS colInt\n                , CAST(NEWID() AS VARCHAR(50)) AS colText\n            INTO tmpTable\n            FROM tally\" | Should -Be 65536\n    }\n\n    Context \"Invoke-SqlQuery\" {\n        It \"No ResultSet Warning\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE temp (cola int)\"\n            Invoke-SqlQuery -Query \"INSERT INTO temp VALUES (1)\" -WarningAction SilentlyContinue -WarningVariable w\n            Invoke-SqlUpdate -Query \"DROP TABLE temp\"\n            $w | Should -BeLike \"Query returned no resultset.*\"\n        }\n\n        It \"Normal\" {\n            Invoke-SqlQuery -Query \"SELECT TOP 1000 * FROM tmpTable\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    \n        It \"With Primary Key\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE #tmpPK (col1 varchar(25), col2 int, PRIMARY KEY (col1, col2));\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO #tmpPK SELECT 'A', 1\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO #tmpPK SELECT 'A', 2\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO #tmpPK SELECT 'B', 3\" | Out-Null\n\n            Invoke-SqlQuery -Query \"SELECT col1 FROM #tmpPK\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 3\n        }\n\n        It \"Multiple columns of same name\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\"\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"Multiple columns of same name with -stream\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\" -Stream\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"With -stream\" {\n            Invoke-SqlQuery -Query \"SELECT TOP 1000 * FROM tmpTable\" -Stream |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    }\n    Context \"Invoke-SqlBulkCopy\" {\n        It \"Normal\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable2 FROM tmpTable WHERE 1=2\"\n            Open-SqlConnection @connHT -ConnectionName bcp \n            Set-SqlConnection -Database test -ConnectionName bcp\n        \n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable2 |\n            Should -Be 65536\n        }\n\n        It \"With -Notify\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable20 FROM tmpTable WHERE 1=2\"\n            Open-SqlConnection @connHT -ConnectionName bcp \n            Set-SqlConnection -Database test -ConnectionName bcp\n        \n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable2 -Notify |\n            Should -Be 65536\n        }\n    \n        It \"With -NotifyAction\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable10 FROM tmpTable WHERE 1=2\"\n            Open-SqlConnection @connHT -ConnectionName bcp \n            Set-SqlConnection -Database test -ConnectionName bcp\n        \n            $result = @{val = 0 }\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable2 -NotifyAction { param($rows) $result.val = $rows }\n            $result.val | Should -Be 65536\n        }\n        \n        It \"With -ColumnMap\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable11 FROM tmpTable WHERE 1=2\"\n            Open-SqlConnection @connHT -ConnectionName bcp \n            Set-SqlConnection -Database test -ConnectionName bcp\n        \n            $columns = @{colDec = \"colDec\"; colInt = \"colInt\"; colText = \"colText\"}\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable2 -ColumnMap $columns |\n            Should -Be 65536\n        }\n    }\n\n    Context \"Transaction...\" {\n        It \"Invoke-SqlBulkCopy\" {\n            Open-SqlConnection @connHT -ConnectionName bcp -Database test\n\n            Start-SqlTransaction -ConnectionName bcp    \n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable3 FROM tmpTable WHERE 1=2\" -ConnectionName bcp\n            { Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable3 -Notify -ea Stop |\n                Should -Be 65536 } | Should -Not -Throw\n            Undo-SqlTransaction -ConnectionName bcp\n            \n            { Invoke-SqlScalar -Query \"SELECT COUNT(1) FROM tmpTable3\" -ea Stop } | Should -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlQuery\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlUpdate\" {\n            Start-SqlTransaction\n            { Invoke-SqlUpdate \"CREATE TABLE transactionTest (id int)\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1 FROM transactionTest\" -ea Stop } | Should -Throw\n        }\n    }\n\n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlScalar\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlQuery\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            {\n                Invoke-SqlUpdate \"CREATE TABLE t(x varchar(255))\" -ErrorAction Stop\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlUpdate \"INSERT INTO t SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"INSERT INTO t SELECT @Name\"-ErrorAction Stop\n                Invoke-SqlUpdate \"DROP TABLE t\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n    }\n\n    Context \"Validations...\" {\n        It \"Handles JSON as PSObject\" {\n            Invoke-SqlScalar \"SELECT @json\" -Parameters @{json = (1..5 | ConvertTo-Json -Compress) } | Should -Be \"[1,2,3,4,5]\"\n        }\n    }\n}"
  },
  {
    "path": "Tests/mysql.tests.ps1",
    "content": "$ErrorActionPreference = \"Stop\"\nDescribe \"MySql\" {\n    BeforeAll {\n        $srvName = $env:COMPUTERNAME\n        if([string]::IsNullOrWhiteSpace($srvName)) { $srvName = \"{0}.\" -f $env:NAME }  #pscore on non-windows\n        $u = \"root\"\n        $p = \"root\"\n        $db = \"mysql\"\n        $c = [pscredential]::new($u, (ConvertTo-SecureString -Force -AsPlainText $p))\n\n        Open-MySqlConnection -Server $srvName -Database $db -Credential $c\n        Invoke-SqlUpdate -Query \"CREATE OR REPLACE VIEW $db.generator_16\n            AS SELECT 0 n UNION ALL SELECT 1  UNION ALL SELECT 2  UNION ALL \n            SELECT 3   UNION ALL SELECT 4  UNION ALL SELECT 5  UNION ALL\n            SELECT 6   UNION ALL SELECT 7  UNION ALL SELECT 8  UNION ALL\n            SELECT 9   UNION ALL SELECT 10 UNION ALL SELECT 11 UNION ALL\n            SELECT 12  UNION ALL SELECT 13 UNION ALL SELECT 14 UNION ALL \n            SELECT 15;\n\n            CREATE OR REPLACE VIEW $db.generator_256\n            AS SELECT ( ( hi.n << 4 ) | lo.n ) AS n\n                FROM $db.generator_16 lo, $db.generator_16 hi;\n\n            CREATE OR REPLACE VIEW $db.generator_64k\n            AS SELECT ( ( hi.n << 8 ) | lo.n ) AS n\n                FROM $db.generator_256 lo, $db.generator_256 hi;\" | Out-Null\n        Close-SqlConnection\n    }\n    AfterAll {\n        Open-MySqlConnection -Server $srvName -Database $db -Credential $c\n        Invoke-SqlUpdate \"DROP TABLE IF EXISTS transactionTest;\n                        DROP TABLE IF EXISTS $db.tmpTable;\n                        DROP TABLE IF EXISTS $db.tmpTable2;\n                        DROP TABLE IF EXISTS $db.tmpTable20;\n                        DROP TABLE IF EXISTS $db.tmpTable21;\n                        DROP TABLE IF EXISTS $db.tmpTable22;\n                        DROP TABLE IF EXISTS $db.tmpTable3;\n                        DROP TABLE IF EXISTS $db.tmpPK;\n                        DROP VIEW IF EXISTS $db.generator_64k;\n                        DROP VIEW IF EXISTS $db.generator_256;\n                        DROP VIEW IF EXISTS $db.generator_16;\"\n        Close-SqlConnection\n    }\n    BeforeEach { Open-MySqlConnection -Server $srvName -Database $db -Credential $c }\n    AfterEach { Show-SqlConnection -all | Close-SqlConnection }\n\n    It \"Test ConnectionString Switch \" {\n        {\n            Open-MySqlConnection -ConnectionString \"server=$srvName;database=$db;port=3306;user id=$u;password=$p;useaffectedrows=True;allowuservariables=True;sslmode=none\" -ConnectionName Test -ea Stop\n            Close-SqlConnection -ConnectionName Test\n        } | Should -Not -Throw\n    }\n\n    It \"UserName/Password Are Removed\" {\n        {\n            Open-MySqlConnection -Server $srvName -UserName $u -Password $p -Database $db -ConnectionName test\n            Close-SqlConnection -ConnectionName test\n        } | Should -Throw\n    }\n\n    It \"Invoke-SqlScalar\" {\n        Invoke-SqlScalar -Query \"SELECT Now()\" | Should -BeOfType System.DateTime\n    }\n\n    It \"Invoke-SqlUpdate\" {\n        Invoke-SqlUpdate -Query \"\n        CREATE TABLE $db.tmpTable (colDec REAL, colInt Int, colText varchar(36));\n        INSERT INTO $db.tmpTable\n            SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\" | Should -Be 65536\n    \n    }\n\n    Context \"Invoke-SqlQuery\" {\n        It \"No ResultSet Warning\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE temp (cola int)\"\n            Invoke-SqlQuery -Query \"INSERT INTO temp VALUES (1)\" -WarningAction SilentlyContinue -WarningVariable w\n            Invoke-SqlUpdate -Query \"DROP TABLE temp\"\n            $w | Should -BeLike \"Query returned no resultset.*\"\n        }\n\n        It \"Normal\" {\n            Invoke-SqlQuery -Query \"\n            SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\n            LIMIT 1000\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n\n        It \"With Primary Key\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE tmpPK (col1 varchar(25), col2 int, PRIMARY KEY (col1, col2));\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 1\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 2\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'B', 3\" | Out-Null\n\n            Invoke-SqlQuery -Query \"SELECT col1 FROM tmpPK\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 3\n        }\n    \n        It \"Multiple columns of same name\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\"\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"Multiple columns of same name With -stream\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\" -Stream\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"With -stream\" {\n            Invoke-SqlQuery -Query \"\n            SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\n            LIMIT 1000\" -Stream |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    }\n\n    Context \"Invoke-SqlBulkCopy\" {\n        It \"Normal\" {\n            $query = \"SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\"\n        \n            Open-MySqlConnection -ConnectionName bcp -Server $srvName -Database mysql -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE $db.tmpTable2 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable \"$db.tmpTable2\" |\n            Should -Be 65536\n        }\n\n        It \"With -Notify\" {\n            $query = \"SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\"\n        \n            Open-MySqlConnection -ConnectionName bcp -Server $srvName -Database mysql -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE $db.tmpTable20 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable \"$db.tmpTable20\" -Notify |\n            Should -Be 65536\n        }\n\n        It \"With -NotifyAction\" {\n            $query = \"SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\"\n        \n            Open-MySqlConnection -ConnectionName bcp -Server $srvName -Database mysql -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE $db.tmpTable21 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            $result = @{val = 0 }\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable \"$db.tmpTable21\" -NotifyAction { param($rows) $result.val = $rows }\n            $result.val | Should -Be 65536\n        }\n\n        It \"With -ColumnMap\" {\n            $query = \"SELECT rand() AS colDec\n                , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                , uuid() AS colText\n            FROM $db.generator_64k\"\n        \n            Open-MySqlConnection -ConnectionName bcp -Server $srvName -Database mysql -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE $db.tmpTable22 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            $columns = @{colDec = \"colDec\"; colInt = \"colInt\"; colText = \"colText\"}\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable \"$db.tmpTable22\" -ColumnMap $columns |\n            Should -Be 65536\n        }\n    }\n\n    Context \"Transaction...\" {\n        It \"Invoke-SqlBulkCopy\" {\n            $query = \"SELECT rand() AS colDec\n                    , CAST(rand() * 1000000000 AS SIGNED) AS colInt\n                    , uuid() AS colText\n                FROM $db.generator_64k\"\n            \n            Open-MySqlConnection -ConnectionName bcp -Server $srvName -Database mysql -Credential $c\n            \n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE $db.tmpTable3 (colDec REAL, colInt INTEGER, colText TEXT)\"\n            Start-SqlTransaction bcp\n            \n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable \"$db.tmpTable3\" -Notify | Should -Be 65536\n            Invoke-SqlScalar -Query \"SELECT COUNT(1) FROM $db.tmpTable3\" -cn bcp | Should -Be 65536\n\n            Undo-SqlTransaction bcp\n            Invoke-SqlScalar -Query \"SELECT COUNT(1) FROM $db.tmpTable3\" -cn bcp | Should -Be 0\n        }\n\n        It \"Invoke-SqlScalar\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlQuery\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlUpdate\" {\n            Invoke-SqlUpdate \"CREATE TABLE transactionTest (id int)\"\n            Start-SqlTransaction\n            { Invoke-SqlUpdate \"INSERT INTO transactionTest VALUES (1)\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n            Invoke-SqlScalar \"SELECT Count(1) FROM transactionTest\" | Should -Be 0\n            Invoke-SqlUpdate \"DROP TABLE transactionTest\"\n        }\n    }\n    \n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlScalar\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlQuery\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            {\n                Invoke-SqlUpdate \"CREATE TABLE t(x varchar(255))\" -ErrorAction Stop\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlUpdate \"INSERT INTO t SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"INSERT INTO t SELECT @Name\"-ErrorAction Stop\n                Invoke-SqlUpdate \"DROP TABLE t\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n    }\n    \n    Context \"Validations...\" {\n        It \"Handles JSON as PSObject\" {\n            Invoke-SqlScalar \"SELECT @json\" -Parameters @{json = (1..5 | ConvertTo-Json -Compress) } | Should -Be \"[1,2,3,4,5]\"\n        }\n    }\n}\n\n<#\n    http://use-the-index-luke.com/blog/2011-07-30/mysql-row-generator#mysql_generator_code\n#>"
  },
  {
    "path": "Tests/oracle.tests.ps1",
    "content": "$ErrorActionPreference = \"Stop\"\nDescribe \"Oracle\" {\n    BeforeAll {\n        $srvName = $env:COMPUTERNAME\n        if([string]::IsNullOrWhiteSpace($srvName)) { $srvName = \"{0}.\" -f $env:NAME }  #pscore on non-windows\n        $u = \"hr\"\n        $p = \"hr\"\n        $c = [pscredential]::new($u, (ConvertTo-SecureString -Force -AsPlainText $p))        \n    }\n    BeforeEach { Open-OracleConnection -DataSource $srvName -ServiceName xe -Credential $c }\n    AfterEach { Show-SqlConnection -all | Close-SqlConnection }\n    AfterAll {\n        Open-OracleConnection -DataSource $srvName -ServiceName xe -Credential $c\n        foreach ($tbl in @(\"transactionTest\", \"tmpTable\", \"tmpTable2\", \"t\", \"tmpPK\")) {\n            $query = \"BEGIN\n                    EXECUTE IMMEDIATE 'DROP TABLE $tbl';\n                EXCEPTION\n                    WHEN OTHERS THEN\n                    IF SQLCODE != -942 THEN\n                        RAISE;\n                    END IF;\n                END;\"\n            Invoke-SqlUpdate $query | Out-Null\n        }\n        Close-SqlConnection\n    }\n\n    It \"Test ConnectionString Switch\" {\n        {\n            $connstr = 'USER ID={0};PASSWORD={1};DATA SOURCE=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={2})(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=xe)))\";STATEMENT CACHE SIZE=5;' -f $u, $p, $srvName\n            Open-OracleConnection -ConnectionName Test -ConnectionString $connstr -ea Stop\n            Close-SqlConnection -ConnectionName Test\n        } | Should -Not -Throw\n    }\n\n    It \"UserName/Password Are Removed\" {\n        {\n            Open-OracleConnection -DataSource $srvName -ServiceName xe -UserName $u -Password $p -ConnectionName test\n            Close-SqlConnection -ConnectionName test\n        } | Should -Throw\n    }\n\n    It \"Invoke-SqlScalar\" {\n        Invoke-SqlScalar -Query \"SELECT 1 FROM DUAL\" | Should -BeOfType System.Decimal\n    }\n\n    It \"Positional Binding\" {\n        $result = Invoke-SqlQuery \"SELECT :a AS First, :b AS Second, :c AS Third FROM dual\" -Parameters @{c = \"Third\"; a = \"First\"; b = \"Second\" }\n        $result.First | Should -Be \"First\"\n        $result.Second | Should -Be \"Second\"\n        $result.Third | Should -Be \"Third\"\n    }\n\n    It \"Invoke-SqlUpdate\" {\n        Invoke-SqlUpdate -Query \"CREATE TABLE tmpTable (colDec REAL, colInt INTEGER, colText varchar(20))\"\n        Invoke-SqlUpdate -Query \"INSERT INTO tmpTable\n            SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 65536\" | Should -Be 65536\n\n        Invoke-SqlUpdate -Query \"DROP TABLE tmpTable\"            \n    }\n\n    Context \"Invoke-SqlQuery\" {\n        It \"No ResultSet Warning\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE temp (cola int)\"\n            Invoke-SqlQuery -Query \"INSERT INTO temp VALUES (1)\" -WarningAction SilentlyContinue -WarningVariable w\n            Invoke-SqlUpdate -Query \"DROP TABLE temp\"\n            $w | Should -BeLike \"Query returned no resultset.*\"\n        }\n\n        It \"Normal\" {\n            Invoke-SqlQuery -Query \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 1000\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n\n        It \"With Primary Key\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE tmpPK (col1 varchar(25), col2 int, PRIMARY KEY (col1, col2))\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 1 FROM dual\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 2 FROM dual\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'B', 3 FROM dual\" | Out-Null\n\n            Invoke-SqlQuery -Query \"SELECT col1 FROM tmpPK\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 3\n        }\n\n        It \"Multiple columns of same name\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a FROM dual\"\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"Multiple columns of same name With -stream\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a FROM dual\" -Stream\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"With -stream\" {\n            Invoke-SqlQuery -Stream -Query \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 1000\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    }\n\n    Context \"Invoke-SqlBulkCopy\" {\n        It \"Normal\" -Tag bulkcopy {\n            $query = \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 65536\"\n        \n            Open-OracleConnection -ConnectionName bcp -DataSource $srvName -ServiceName xe -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable2 (colDec NUMBER(38,10), colInt INTEGER, colText varchar(20))\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable2 |\n            Should -Be 65536\n        \n            Invoke-SqlUpdate -ConnectionName bcp -Query \"DROP TABLE tmpTable2\"\n        }\n\n        It \"With -Notify\" -Tag bulkcopy {\n            $query = \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 65536\"\n        \n            Open-OracleConnection -ConnectionName bcp -DataSource $srvName -ServiceName xe -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable2 (colDec NUMBER(38,10), colInt INTEGER, colText varchar(20))\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable2 -Notify |\n            Should -Be 65536\n        \n            Invoke-SqlUpdate -ConnectionName bcp -Query \"DROP TABLE tmpTable2\"\n        }\n        \n        It \"With -NotifyAction\" -Tag bulkcopy {\n            $query = \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 65536\"\n        \n            Open-OracleConnection -ConnectionName bcp -DataSource $srvName -ServiceName xe -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable2 (colDec NUMBER(38,10), colInt INTEGER, colText varchar(20))\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable2 -Notify |\n            Should -Be 65536\n        \n            Invoke-SqlUpdate -ConnectionName bcp -Query \"DROP TABLE tmpTable2\"\n        }\n\n        It \"With -ColumnMap\" -Tag bulkcopy {\n            $query = \"SELECT dbms_random.random /1000000000000. AS colDec\n                , dbms_random.random AS colInt\n                , dbms_random.string('x',20) AS colText\n            FROM dual\n            CONNECT BY ROWNUM <= 65536\"\n        \n            Open-OracleConnection -ConnectionName bcp -DataSource $srvName -ServiceName xe -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable2 (colDec NUMBER(38,10), colInt INTEGER, colText varchar(20))\"\n\n            $columns = @{colDec = \"colDec\"; colInt = \"colInt\"; colText = \"colText\"}\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable2 -ColumnMap $columns |\n            Should -Be 65536\n        \n            Invoke-SqlUpdate -ConnectionName bcp -Query \"DROP TABLE tmpTable2\"\n        }\n    }\n\n    Context \"Transaction...\" {\n        It \"Invoke-SqlBulkCopy\" -Tag bulkcopytransaction {\n            $query = \"SELECT dbms_random.random /1000000000000. AS colDec\n                    , dbms_random.random AS colInt\n                    , dbms_random.string('x',20) AS colText\n                FROM dual\n                CONNECT BY ROWNUM <= 65536\"\n            \n            Open-OracleConnection -ConnectionName bcp -DataSource $srvName -ServiceName xe -Credential $c\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable2 (colDec NUMBER(38,10), colInt INTEGER, colText varchar(20))\"\n            \n            Start-SqlTransaction -ConnectionName bcp        \n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable2 -Notify |\n            Should -Be 65536\n            Invoke-SqlScalar -ConnectionName bcp -Query \"SELECT COUNT(1) FROM tmpTable2\" | Should -Be 65536\n            Undo-SqlTransaction -ConnectionName bcp\n            Invoke-SqlScalar -ConnectionName bcp -Query \"SELECT COUNT(1) FROM tmpTable2\" | Should -Be 0\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"DROP TABLE tmpTable2\"\n        }\n\n        It \"Invoke-SqlScalar\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1 FROM dual\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlQuery\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1 FROM dual\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlUpdate\" {\n            Invoke-SqlUpdate \"CREATE TABLE transactionTest (id int)\"\n            Start-SqlTransaction\n            { Invoke-SqlUpdate \"INSERT INTO transactionTest VALUES (1)\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n            Invoke-SqlScalar \"SELECT Count(1) FROM transactionTest\" | Should -Be 0\n            Invoke-SqlUpdate \"DROP TABLE transactionTest\"\n        }\n    }\n\n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlScalar\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlScalar \"SELECT :Name FROM dual\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"SELECT :Name FROM dual\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlQuery\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlQuery \"SELECT :Name FROM dual\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlQuery \"SELECT :Name FROM dual\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            {\n                Invoke-SqlUpdate \"CREATE TABLE t(x varchar(255))\" -ErrorAction Stop\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlUpdate \"INSERT INTO t SELECT :Name FROM dual\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"INSERT INTO t SELECT :Name FROM dual\"-ErrorAction Stop\n                Invoke-SqlUpdate \"DROP TABLE t\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n    }\n\n    Context \"Validations...\" {\n        It \"Handles JSON as PSObject\" {\n            Invoke-SqlScalar \"SELECT :json FROM dual\" -Parameters @{json = (1..5 | ConvertTo-Json -Compress) } | Should -Be \"[1,2,3,4,5]\"\n        }\n    }\n}\n<#\n    requires that the predefined account HR is unlocked and has password hr\n    using oracle 11.2g Express instance\n#>"
  },
  {
    "path": "Tests/postgre.tests.ps1",
    "content": "$ErrorActionPreference = \"Stop\"\nDescribe \"PostGre\" {\n    BeforeEach { Open-PostGreConnection -Server $srvName -Database $db -Credential $c }\n    AfterEach { Show-SqlConnection -all | Close-SqlConnection }\n    BeforeAll {\n        #warm up connection\n        $srvName = $env:COMPUTERNAME  #pscore on non-windows\n        if([string]::IsNullOrWhiteSpace($srvName)) { $srvName = \"{0}.\" -f $env:NAME }\n        $u = \"postgres\"\n        $p = \"postgres\"\n        $db = \"postgres\"\n        $c = [pscredential]::new($u, (ConvertTo-SecureString -Force -AsPlainText $p))\n        Open-PostGreConnection -Server $srvName -Database $db -Credential $c\n        Close-SqlConnection\n    }\n    AfterAll {\n        Open-PostGreConnection -Server $srvName -Database $db -Credential $c\n        Invoke-SqlUpdate \"DROP TABLE IF EXISTS transactionTest, tmpTable, tmpTable2, tmpTable21, tmpTable22, tmpTable23, t, tmpPK;\"\n        Close-SqlConnection\n    }\n\n    It \"Test ConnectionString Switch\" {\n        {\n            Open-PostGreConnection -ConnectionString \"Max Auto Prepare=25;Host=$srvName;Database=$db;Port=5432;Username=$u;password=$p\" -ConnectionName Test -ea Stop\n            Close-SqlConnection -ConnectionName Test\n        } | Should -Not -Throw\n    }\n    \n    It \"UserName/Password Are Removed\" {\n        {\n            Open-PostGreConnection -Server $srvName -Database $db -UserName $u -Password $p -ConnectionName test\n            Close-SqlConnection -ConnectionName test\n        } | Should -Throw\n    }\n\n    It \"Invoke-SqlScalar\" {\n        Invoke-SqlScalar -Query \"SELECT Now()\" | Should -BeOfType System.DateTime\n    }\n\n    It \"Invoke-SqlUpdate\" {\n        Invoke-SqlUpdate -Query \"CREATE TABLE tmpTable (colDec decimal, colInt Int, colText varchar(50))\"\n        Invoke-SqlUpdate -Query \";WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n            , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n            , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n            , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n            , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            , tally(n) AS (SELECT ROW_NUMBER() OVER (ORDER BY N) FROM f)\n            INSERT INTO tmpTable\n                SELECT random() AS colDec\n                    , CAST(random() * 1000000 AS int) AS colInt\n                    , CAST(Random() AS VARCHAR(50)) AS colText                \n                FROM tally\" | Should -Be 65536\n    }\n    Context \"Invoke-SqlQuery\" {\n        It \"No ResultSet Warning\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE temp (cola int)\"\n            Invoke-SqlQuery -Query \"INSERT INTO temp VALUES (1)\" -WarningAction SilentlyContinue -WarningVariable w\n            Invoke-SqlUpdate -Query \"DROP TABLE temp\"\n            $w | Should -BeLike \"Query returned no resultset.*\"\n        }\n        It \"Normal\" {\n            Invoke-SqlQuery -Query \"SELECT * FROM tmpTable LIMIT 1000\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n\n        It \"With Primary Key\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE tmpPK (col1 varchar(25), col2 int, PRIMARY KEY (col1, col2));\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 1\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 2\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'B', 3\" | Out-Null\n\n            Invoke-SqlQuery -Query \"SELECT col1 FROM tmpPK\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 3\n        }\n\n        It \"Multiple columns of same name\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\"\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"Multiple columns of same name With -stream\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\" -Stream\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"With -stream\" {\n            Invoke-SqlQuery -Query \"SELECT * FROM tmpTable LIMIT 1000\" -Stream |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    }\n    \n    Context \"Invoke-SqlBulkCopy\" {\n        It \"Normal\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable2 FROM tmpTable WHERE 1=2\"\n            Open-PostGreConnection -Server $srvName -Database $db -ConnectionName bcp -Credential $c\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable2 |\n            Should -Be 65536\n            Close-SqlConnection -ConnectionName bcp\n        }\n        \n        It \"With -Notify\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable21 FROM tmpTable WHERE 1=2\"\n            Open-PostGreConnection -Server $srvName -Database $db -ConnectionName bcp -Credential $c\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable21 -Notify |\n            Should -Be 65536\n            Close-SqlConnection -ConnectionName bcp\n        }\n\n        It \"With -NotifyAction\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable22 FROM tmpTable WHERE 1=2\"\n            Open-PostGreConnection -Server $srvName -Database $db -ConnectionName bcp -Credential $c\n            \n            $result = @{val = 0 }\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable22 -NotifyAction { param($rows) $result.val = $rows }\n            $result.val | Should -Be 65536\n\n            Close-SqlConnection -ConnectionName bcp\n        }\n\n        It \"With -ColumnMap\" {\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable23 FROM tmpTable WHERE 1=2\"\n            Open-PostGreConnection -Server $srvName -Database $db -ConnectionName bcp -Credential $c\n            \n            $columns = @{colDec = \"colDec\"; colInt = \"colInt\"; colText = \"colText\"}\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable23 -ColumnMap $columns |\n            Should -Be 65536\n            \n            Close-SqlConnection -ConnectionName bcp\n        }\n    }\n\n    Context \"Transaction...\" {\n        It \"Invoke-SqlBulkCopy\" {\n            Open-PostGreConnection -Server $srvName -Database $db -ConnectionName bcp -Credential $c\n            \n            Start-SqlTransaction -ConnectionName bcp\n            Invoke-SqlUpdate -Query \"SELECT * INTO tmpTable3 FROM tmpTable WHERE 1=2\" -ConnectionName bcp\n            { Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceTable tmpTable -DestinationTable tmpTable3 -Notify |\n                Should -Be 65536 } | Should -Not -Throw\n            Undo-SqlTransaction -ConnectionName bcp\n\n            { Invoke-SqlScalar -ConnectionName bcp -Query \"SELECT COUNT(1) FROM tmpTable3\" -ea Stop } | Should -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlQuery\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlUpdate\" {\n            Start-SqlTransaction\n            { Invoke-SqlUpdate \"CREATE TABLE transactionTest (id int)\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1 FROM transactionTest\" -ea Stop } | Should -Throw\n        }\n    }\n    \n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlScalar\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"SELECT @Name \" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlQuery\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            {\n                Invoke-SqlUpdate \"CREATE TABLE t(x varchar(255))\" -ErrorAction Stop\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlUpdate \"INSERT INTO t SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"INSERT INTO t SELECT @Name\"-ErrorAction Stop\n                Invoke-SqlUpdate \"DROP TABLE t\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n    }\n\n    Context \"Validations...\" {\n        It \"Handles JSON as PSObject\" {\n            Invoke-SqlScalar \"SELECT @json\" -Parameters @{json = (1..5 | ConvertTo-Json -Compress) } | Should -Be \"[1,2,3,4,5]\"\n        }\n    }\n}"
  },
  {
    "path": "Tests/sqlite.tests.ps1",
    "content": "$ErrorActionPreference = \"Stop\"\nDescribe \"SQLite\" {\n    BeforeEach { Open-SQLiteConnection }\n    AfterEach { Show-SqlConnection -all | Close-SqlConnection }\n    AfterAll {\n        Remove-Item \"$home\\temp.db\"        \n    }\n    \n    It \"Test ConnectionString Switch\" {\n        {\n            Open-SQLiteConnection -ConnectionString \"Data Source=:memory:\" -ConnectionName Test -ea Stop\n            Close-SqlConnection -ConnectionName Test\n        } | Should -Not -Throw\n    }\n    \n    It \"Invoke-SqlScalar\" {\n        Invoke-SqlScalar -Query \"SELECT 1\" | Should -BeOfType System.Int64\n    }\n\n    It \"Invoke-SqlUpdate\" {\n        Invoke-SqlUpdate -Query \"\n        CREATE TABLE tmpTable (colDec REAL, colInt INTEGER, colText TEXT)\n        ;WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            INSERT INTO tmpTable\n                SELECT random()/1000000000000. AS colDec\n                    , random() AS colInt\n                    , hex(randomblob(20)) AS colText\n                FROM f\" | Should -Be 65536\n        \n        Invoke-SqlUpdate -Query \"DROP TABLE tmpTable\" | Out-Null\n    }\n    \n    Context \"Invoke-SqlQuery\" {\n        It \"No ResultSet Warning\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE temp (cola int)\"\n            Invoke-SqlQuery -Query \"INSERT INTO temp VALUES (1)\" -WarningAction SilentlyContinue -WarningVariable w\n            Invoke-SqlUpdate -Query \"DROP TABLE temp\"\n            $w | Should -BeLike \"Query returned no resultset.*\"\n        }\n        It \"Normal\" {\n            Invoke-SqlQuery -Query \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\n            LIMIT 1000\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    \n        It \"With Primary Key\" {\n            Invoke-SqlUpdate -Query \"CREATE TABLE tmpPK (col1 varchar(25), col2 int, PRIMARY KEY (col1, col2));\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 1\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'A', 2\" | Out-Null\n            Invoke-SqlUpdate -Query \"INSERT INTO tmpPK SELECT 'B', 3\" | Out-Null\n\n            Invoke-SqlQuery -Query \"SELECT col1 FROM tmpPK\" |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 3\n        }\n\n        It \"Multiple columns of same name\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\"\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"Multiple columns of same name With -stream\" {\n            $val = Invoke-SqlQuery \"SELECT 1 AS a, 2 AS a, 3 AS a\" -Stream\n            $val.a | Should -Be 1\n            $val.a1 | Should -Be 2\n            $val.a2 | Should -Be 3\n        }\n\n        It \"With -stream\" {\n            Invoke-SqlQuery -Query \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\n            LIMIT 1000\" -Stream |\n            Measure-Object |\n            Select-Object -ExpandProperty Count |\n            Should -Be 1000\n        }\n    }\n    Context \"Invoke-SqlBulkCopy\" {\n        It \"Normal\" {\n            $query = \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\"\n        \n            Open-SQLiteConnection -ConnectionName bcp -DataSource \"$home\\temp.db\"\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable |\n            Should -Be 65536\n        \n            Close-SqlConnection -ConnectionName bcp\n        }\n\n        It \"With -Notify\" {\n            $query = \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\"\n        \n            Open-SQLiteConnection -ConnectionName bcp -DataSource \"$home\\temp.db\"\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable21 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable21 -Notify |\n            Should -Be 65536\n        \n            Close-SqlConnection -ConnectionName bcp\n        }\n\n        It \"With -NotifyAction\" {\n            $query = \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\"\n        \n            Open-SQLiteConnection -ConnectionName bcp -DataSource \"$home\\temp.db\"\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable22 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            $result = @{val = 0 }\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable22 -NotifyAction { param($rows) $result.val = $rows }\n            $result.val | Should -Be 65536\n        \n            Close-SqlConnection -ConnectionName bcp\n        }\n\n        It \"With -ColumnMap\" {\n            $query = \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\"\n        \n            Open-SQLiteConnection -ConnectionName bcp -DataSource \"$home\\temp.db\"\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable23 (colDec REAL, colInt INTEGER, colText TEXT)\"\n\n            $columns = @{colDec = \"colDec\"; colInt = \"colInt\"; colText = \"colText\"}\n            Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable -ColumnMap $columns |\n            Should -Be 65536\n        \n            Close-SqlConnection -ConnectionName bcp        \n        }\n    }\n    \n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlBulkCopy\" {\n            $query = \"WITH a(n) AS (SELECT 1 UNION ALL SELECT 1)\n                , b(n) AS (SELECT 1 FROM a CROSS JOIN a AS x)\n                , c(n) AS (SELECT 1 FROM b CROSS JOIN b AS x)\n                , d(n) AS (SELECT 1 FROM c CROSS JOIN c AS x)\n                , e(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n                , f(n) AS (SELECT 1 FROM d CROSS JOIN d AS x)\n            SELECT random()/1000000000000. AS colDec\n                , random() AS colInt\n                , hex(randomblob(20)) AS colText\n            FROM f\"\n\n            Open-SQLiteConnection -ConnectionName bcp -DataSource \"$home\\temp.db\"\n        \n            Start-SqlTransaction -ConnectionName bcp\n            Invoke-SqlUpdate -ConnectionName bcp -Query \"CREATE TABLE tmpTable3 (colDec REAL, colInt INTEGER, colText TEXT)\"\n            { Invoke-SqlBulkCopy -DestinationConnectionName bcp -SourceQuery $query -DestinationTable tmpTable3 -Notify |\n                Should -Be 65536 } | Should -Not -Throw\n            Undo-SqlTransaction -ConnectionName bcp\n\n            { Invoke-SqlScalar -ConnectionName bcp -Query \"SELECT COUNT(1) FROM tmpTable3\" -ea Stop } | Should -Throw\n        }\n\n\n        It \"Invoke-SqlScalar\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlQuery\" {\n            Start-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1\" } | Should -Not -Throw\n            Undo-SqlTransaction\n        }\n\n        It \"Invoke-SqlUpdate\" {\n            Start-SqlTransaction\n            { Invoke-SqlUpdate \"CREATE TABLE transactionTest (id int)\" -ea Stop } | Should -Not -Throw\n            Undo-SqlTransaction\n            { Invoke-SqlScalar \"SELECT 1 FROM transactionTest\" -ea Stop } | Should -Throw\n        }\n    }\n    \n    Context \"PipelineInput...\" {\n        It \"Invoke-SqlScalar\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlQuery\" {\n            {\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlQuery \"SELECT @Name\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n\n        It \"Invoke-SqlScalar\" {\n            {\n                Invoke-SqlUpdate \"CREATE TABLE t(x varchar(255))\" -ErrorAction Stop\n                [PSCustomObject]@{Name = \"test\" } | Invoke-SqlUpdate \"INSERT INTO t SELECT @Name\" -ErrorAction Stop\n                Get-ChildItem | Invoke-SqlScalar \"INSERT INTO t SELECT @Name\"-ErrorAction Stop\n                Invoke-SqlUpdate \"DROP TABLE t\" -ErrorAction Stop\n            } | Should -Not -Throw\n        }\n    }\n\n    Context \"Validations...\" {\n        It \"Handles JSON as PSObject\" {\n            Invoke-SqlScalar \"SELECT @json\" -Parameters @{json = (1..5 | ConvertTo-Json -Compress) } | Should -Be \"[1,2,3,4,5]\"\n        }\n    }\n}"
  },
  {
    "path": "VersionHistory.md",
    "content": "# Version History\n\n### 1.9.1\n* Updating SQLite library.  Interop Version: 1.0.117.0 & SQLite Server Version: 3.40.0 thanks @JediNite\n### 1.9.0\n* Updated classes to use `::new()` constructor.  thanks @joalcorn\n* Updated MySql provider to use new library (8.0.28).  thanks @twerthi\n\n### 1.8.0\n* Minor Update, enhancing progress notifications for Invoke-SqlBulkCopy, you can now specify -NotifyAction and pass in a scriptblock\n### 1.7.0\n\n* Minor update to expose the transaction object to the user via the new `Get-SqlTransaction` cmdlet.\n\n### 1.6.2\n\n* added support for .Net Framework 4.6.1 (included library 'DataReaderToPSObject' is compiled against .Net Standard 2.0 which requires shims on .Net 4.6.1).  (@jantari)\n\n### 1.6.1\n\n* added support for Azure Token authentication to SQL Server\n\n### 1.6.0\n\n* Updated DataReaderToObject.dll (@ili101)\n* Added -TrustServerCertificate to Open-PostgreConnection (@ili101)\n* Added -ProviderTypes to Invoke-SqlQuery (@ili1010)\n\n### 1.5.9\n\n* Fixed issue with `Open-OracleConnection` help (@PaulWalkerUK)\n* Added -AsDataTable to Open-SqlQuery (@ili101)\n* Added -TrustSSL to Open-PostGreConnection, allowing for self-signed certificates (@ili101)\n* Updated -ConnectionName parameter on all cmdlets to no longer allow null or empty strings.\n* Added better handling around SqlTransactions when an error is thrown (for SQL Server this happens when the server takes longer than the connectionTimeout, however the transaction action (COMMIT or ROLLBACK) still goes through properly).\n* Added default value (\"postgres\") to -Database for Open-PostGreConnection.\n* Added -DBAPrivilege to Open-OracleConnection to allow connecting as SYSOPER or SYSDBA.\n\n### 1.5.4\n\n* Fixed issue with loading the Geometry npgsql extension (Npgsql.NetTopologySuite) when database in connection string did not have PostGIS installed.\n* Automatically load geometry npgsql extension on database switch and on re-opening the connection (if current database has PostGIS installed).\n\n### 1.5.3\n\n* Fixed issue with Geometry not being supported in PostGre provider.\n\n### 1.5.2\n\n* Fixed issue with OracleProvider -- binding by position rather than by parameter name. (@Abrechnung1)\n\n### 1.5.1\n\n* Updated tests for Pester v4\n* Fixed issue with transactions for MSSQL.\n* Fixed issue with ```Show-SqlConnection -all | Close-SqlConnection``` when there are no open connections.\n* Updated MySql Provider to 8.0.12, added parameter for SSLmode\n* Updated SQLite provider to 1.0.109.1\n* Updated Oracle provider to 18.3 (added support for oracleCredential)\n* Updated PostGre provider (npgsql) to 4.0.2\n\n### 1.4.1\n\n* Added support for SSL connections to PostGre provider.\n\n### 1.4.0\n\n* Added support for PSCredential on MySql, Oracle and PostGre providers, marking UserName/Password as deprecated.  Sql Provider already had support, added deprecation warning.  SQLite only has -Password, no change to this provider.\n\n### 1.3.8\n\n* Fixed issue with Invoke-SqlQuery throwing an error when there is no resultset, now creates a warning.\n* Added Pester tests to cover this scenario.\n\n### 1.3.7\n\n* Fixed issue with SqlConnection not accepting ConnectionStrings (root issue, you can't assign a connection string to an existing SqlConnectionStringBuilder.)\n* Fixed issue with MySqlConnection and PostGreConnection, can't assign connection string to *ConnectionStringBuilder, instead simply create the connection object if connectionstring is passed in.\n\n### 1.3.6\n\n* Fixed issue with -Parameters on Invoke-SqlQuery/Scalar/Update, passing in '$false' as a value was failing to pass anything at all.\n\n### 1.3.5\n\n* Fixed issue with Postgre that got released in version 1.3.4.\n\n### 1.3.4\n\n* Updated help: cmdlets and the about_* files (about_SimplySql & about SimplySql_Providers).\n* Updated provider DLLs for PostGre, MySql, and SQLite.\n\n### 1.3.3\n\n* Fixed issue where -ConnectionString was not working properly with the Oracle Provider.\n\n### 1.3.2\n\n* Fixed issue with help missing from the open-*connection cmdlets.\n* removed unnecessary files from the Functions subfolder.\n\n### 1.3.1\n* Fixed minor issues with SQLBulkCopy: -notify is not required and if SQLBulkCopy errors, Identity Insert will be turned off.\n\n### 1.3.0\n\n* Added support for Azure AD auth for Azure SQL Dbs\n* Fix issue in PostGre when using the -stream parameter and querying scalar data without a table, select \"1, 2, 3\"\n\n### 1.2.0\n\n* Updated providers\n\n### 1.1.1\n\n* Removed a debugging message from the base Provider.BulkLoad method (only showed up in sqlite)\n* Added functionality to retrieve the underlying provider connection object via Get-SqlConnection (gsc)\n* Updated information in the about files.\n\n### 1.1.0\n* Added support for non standard column names (ie those that might include spaces, etc) in Invoke-SqlBulkCopy.\n* Changed Open-MySqlConnection to no longer require setting the database, defaults to \"mysql\""
  },
  {
    "path": "default.build.ps1",
    "content": "param([version]$Version, [switch]$CommitRevision, [ValidateSet(\"Major\", \"Minor\", \"Build\")][string]$Increment)\nNew-Alias -Name HV -Value (Resolve-Path HandleVerbose.ps1) -Force\n\nif(-not $version) {\n  $Script:Version = [Version](Import-PowerShellDataFile -Path \"ModuleManifest\\SimplySql.psd1\")[\"ModuleVersion\"]\n  switch ($Increment) {\n    \"Major\" {\n      $Script:Version = [version]::new($version.Major + 1, 0, 0, $version.Revision + 1)\n    }\n    \"Minor\" {\n      $Script:Version = [version]::new($version.Major, $version.Minor + 1, 0, $version.Revision + 1)\n    }\n    \"Build\" {\n      $Script:Version = [version]::new($version.Major, $version.Minor, $version.Build + 1, $version.Revision + 1)\n    }\n    default {\n      $Script:Version = [version]::new($version.Major, $version.Minor, $version.Build, $version.Revision + 1)\n    }\n  }  \n}\n\ntask Clean { remove \"output\" }\ntask Build { Invoke-Build -File \"source\\source.build.ps1\" -Version $Version}\n\ntask ComposeModule {\n  if(-not (Test-Path \"output\\SimplySql\" -PathType Container)) {\n    New-Item \"Output\\SimplySql\" -ItemType Directory | Out-Null\n  }\n}, copyManifest, copyBinaries, updateManifest, GenerateDocs\n\ntask GenerateDocs {\n  Start-Job -ScriptBlock {\n        Set-Location $using:BuildRoot\n        Import-Module \".\\output\\SimplySql\" -Verbose:$false\n        \n        if(-not (Test-Path \"docs\")) {\n          New-MarkdownHelp -Module SimplySql -OutputFolder Docs -AlphabeticParamsOrder -WithModulePage\n          New-MarkdownAboutHelp -OutputFolder Docs -AboutName \"SimplySql\"\n        }\n        else { Update-MarkdownHelpModule -Path \"Docs\" -AlphabeticParamsOrder -Force -RefreshModulePage -UpdateInputOutput }\n        New-ExternalHelp -Path \"Docs\" -OutputPath \".\\output\\SimplySql\\en-US\" -Force\n      } |\n    Receive-Job -Wait -AutoRemoveJob |\n    ForEach-Object { \"  $($_.Name)\" } |\n    HV \"Generating Module Documentation\" \".\"\n}\n\ntask copyManifest {\n  #Base Module Files  \n  Copy-Item \"ModuleManifest\\SimplySql.psd1\" -Destination \"output\\SimplySql\" -Force\n}\n\ntask copyBinaries {\n  #Copy files for engine\n  Copy-Item \"source\\output\\*.dll\" -Destination \"output\\SimplySql\" -Force\n  Copy-Item \"source\\output\\bin\" -Destination \"output\\SimplySql\" -Filter \"*.dll\" -Recurse -Force  \n}\n\ntask updateManifest {\n  Import-Module PowerShellGet -Verbose:$false\n  $cmdlets = Start-Job -ScriptBlock {\n      Set-Location $using:BuildRoot  \n      Import-Module \".\\Output\\SimplySql\\SimplySql.Cmdlets.dll\"    \n      Get-Command -Module SimplySql.Cmdlets\n    } |\n    Receive-Job -AutoRemoveJob -wait |\n    Sort-Object name |\n    ForEach-Object name\n\n  Update-ModuleManifest -Path \"Output\\SimplySql\\SimplySql.psd1\" -ModuleVersion $version -CmdletsToExport $cmdlets\n  Copy-Item -Path \"Output\\SimplySql\\SimplySql.psd1\" -Destination \"ModuleManifest\\SimplySql.psd1\"\n}\n\ntask revisionCommit {\n  exec { git commit \"ModuleManifest/SimplySql.psd1\" -m \"Updating version To $version\" } | HV \"Incrementing Version ($version) and Git Commit\"\n} -If $CommitRevision\n\n\ntask . Clean, Build, ComposeModule, revisionCommit"
  },
  {
    "path": "developmentideas.txt",
    "content": "Eventually make the wiki Project in github reference the /docs subfolder\nhttps://stackoverflow.com/a/76144369\n    EXAMPLE cmds:\n    git clone https://github.com/youName/ProjectName.wiki docs\n    git submodule add https://github.com/youName/ProjectName.wiki docs\n    git submodule update --init\n\nORACLE\n    InfoMessage\n    https://stackoverflow.com/questions/193107/print-text-in-oracle-sql-developer-sql-worksheet-window \n\nAlways roll version (minor) forward by 1 when updating provider nuget packages.\n\n---------\nTODO:\n+ PSObjectDataReader in .NET\n    - update sqlBulkcopy to take objects directly / andor to take datareader directly?\n    - or create full fleged provider for objects? (maybe using datatable as backend?)\n+ Allow invoke-SqlQuery/SqlUpdate to take objects as input (translate to parameters) -- single or multiple objects? (probably single only)\n\n\n---- Better Information : https://devblogs.microsoft.com/powershell/resolving-powershell-module-assembly-dependency-conflicts/#quick-fixes-and-their-limitations ----\n"
  },
  {
    "path": "runTests.ps1",
    "content": "param(\n    [ValidateSet(\"pwsh\",\"powershell\")][string]$env = \"pwsh\"\n    , [ValidateSet(\"mssql\",\"mysql\",\"postgre\",\"oracle\",\"sqlite\")][string[]]$Tests = @(\"mssql\",\"mysql\",\"postgre\",\"oracle\",\"sqlite\")\n    , [switch]$Interactive\n)\n\n$arglist = @()\n$arglist += \"-NoProfile\", \"-NoLogo\"\nif($Interactive){ $arglist += \"-NoExit\" }\n\n\n$arglist += \"-Command function prompt {'TESTING> '}; Import-Module .\\Output\\SimplySql; 'SimplySql Version: {0}' -f (Get-Module SimplySql | Select-Object -ExpandProperty Version)\"\nif($tests.count -gt 0) {\n    $arglist += \"; Invoke-Pester @({0}) -output detailed\" -f ($Tests.ForEach({\"'.\\Tests\\$_.tests.ps1'\"}) -join \", \")\n}\n\nStart-Process -FilePath $env -ArgumentList $arglist -NoNewWindow -Wait -WorkingDirectory $PSScriptRoot\n\n"
  },
  {
    "path": "source/ConstructModule.ps1",
    "content": "Invoke-Build -DebugOnly\n\n$PSModuleAutoLoadingPreference = \"none\"\nImport-Module .\\Output\\SimplySql.Cmdlets.dll -Verbose\nImport-Module microsoft.powershell.security\n\nWrite-Host \" call 'RunTests' to execute pester tests...\"\nfunction RunTests([ValidateSet(\"mssql\",\"mysql\",\"postgre\",\"oracle\",\"sqlite\")][string[]]$Tests = @(\"mssql\",\"mysql\",\"postgre\",\"oracle\",\"sqlite\")) {\n    Import-Module Pester\n    $testsToRun = ($Tests.ForEach({\"..\\Tests\\$_.tests.ps1\"}) -join \", \")\n    Invoke-Pester @($testsToRun) -output detailed\n}"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/ClearSqlMessage.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Clear, \"SqlMessage\", SupportsShouldProcess:=True)>\nPublic Class ClearSqlMessage\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName) Then\n                Try\n                    Engine.Logic.GetConnection(ConnectionName).ClearMessages()\n                    WriteVerbose($\"SQL Messages cleared from '{ConnectionName}'.\")\n                Catch nse As NotSupportedException\n                    WriteWarning(nse.Message)\n                Catch ex As Exception\n                    WriteWarning($\"[{ConnectionName}] {ex.Message}\")\n                End Try\n            End If\n        End If\n    End Sub\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/CloseSqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Close, \"SqlConnection\", SupportsShouldProcess:=True)>\n<[Alias](\"csc\")>\nPublic Class CloseSqlConnection\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName) Then\n                Try\n                    Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n                    WriteVerbose($\"SQL Connection '{ConnectionName}' closed.\")\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName, ErrorCategory.CloseError)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/CompleteSqlTransaction.vb",
    "content": "﻿<Cmdlet(VerbsLifecycle.Complete, \"SqlTransaction\", SupportsShouldProcess:=True)>\nPublic Class CompleteSqlTransaction\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Commit a Sql Transaction\") Then\n                Dim conn = Engine.Logic.GetConnection(ConnectionName)\n                Try\n                    conn.CommitTransaction()\n                Catch ex As Exception\n                    If conn.Connection.State = Data.ConnectionState.Closed Then conn.Connection.Open()\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/GetSqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Get, \"SqlConnection\", SupportsShouldProcess:=True)>\nPublic Class GetSqlConnection\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Get Sql Connection\") Then\n                Try\n                    WriteObject(Engine.Logic.GetConnection(ConnectionName).Connection)\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/GetSqlMessage.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Get, \"SqlMessage\", SupportsShouldProcess:=True)>\nPublic Class GetSqlMessage\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Get Sql Messages\") Then\n                Dim conn = Engine.Logic.GetConnection(ConnectionName)\n                Try\n                    Do While conn.HasMessages\n                        WriteObject(conn.GetMessage)\n                    Loop\n                Catch nse As NotSupportedException\n                    WriteWarning(nse.Message)\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/GetSqlTransaction.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Get, \"SqlTransaction\", SupportsShouldProcess:=True)>\nPublic Class GetSqlTransaction\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Get Sql Transaction\") Then\n                Try\n                    WriteObject(Engine.Logic.GetConnection(ConnectionName).Transaction)\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/InvokeSqlBulkCopy.vb",
    "content": "﻿<Cmdlet(VerbsLifecycle.Invoke, \"SqlBulkCopy\", SupportsShouldProcess:=True, DefaultParameterSetName:=\"table\")>\nPublic Class InvokeSqlBulkCopy\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <ValidateNotNullOrEmpty()> <[Alias](\"SrcCN\")> <PSDefaultValue(Value:=\"default\")>\n    Public Property SourceConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <ValidateNotNullOrEmpty()> <[Alias](\"DstCN\")> <PSDefaultValue(Value:=\"default\")>\n    Public Property DestinationConnectionName As String = \"default\"\n\n    <Parameter(ParameterSetName:=\"table\", ValueFromPipelineByPropertyName:=True)>\n    <Parameter(ParameterSetName:=\"query\", Mandatory:=True, ValueFromPipelineByPropertyName:=True)>\n    <ValidateNotNullOrEmpty()>\n    Public Property DestinationTable As String\n\n    <Parameter(ParameterSetName:=\"table\", Mandatory:=True, ValueFromPipelineByPropertyName:=True)>\n    <ValidateNotNullOrEmpty()>\n    Public Property SourceTable As String\n\n    <Parameter(ParameterSetName:=\"query\", Mandatory:=True, ValueFromPipelineByPropertyName:=True)>\n    <ValidateNotNullOrEmpty()>\n    Public Property SourceQuery As String()\n\n    <Parameter(ParameterSetName:=\"query\", ValueFromPipelineByPropertyName:=True)>\n    Public Property SourceParameters As Hashtable\n\n    <Parameter()>\n    Public Property ColumnMap As Hashtable\n\n    <Parameter()>\n    <ValidateRange(1, 50000)> <PSDefaultValue(Value:=500)>\n    Public Property BatchSize As Integer = 500\n\n    <Parameter()>\n    <PSDefaultValue(Value:=\"-1 (No Timeout)>\")>\n    Public Property BatchTimeout As Integer = -1\n\n    <Parameter()>\n    Public Property Notify As SwitchParameter\n    <Parameter()>\n    Public Property NotifyAction As Action(Of Long)\n#End Region\n\n    Protected Overrides Sub EndProcessing()\n        If SourceConnectionName.Equals(DestinationConnectionName, StringComparison.OrdinalIgnoreCase) Then\n            Dim ex As New ArgumentException($\"You cannot use the same connection for both the source and destination ({SourceConnectionName}).\", NameOf(DestinationConnectionName))\n            WriteError(New ErrorRecord(ex, MyInvocation.MyCommand.Name, ErrorCategory.InvalidArgument, DestinationConnectionName))\n        Else\n            If ValidateConnection(SourceConnectionName) And ValidateConnection(DestinationConnectionName) Then\n                If Me.ShouldProcess(DestinationConnectionName, $\"Execute bulkloading into '{DestinationTable}'\") Then\n                    Dim singleQuery As String, columnDict As New Dictionary(Of String, String)(StringComparer.OrdinalIgnoreCase)\n                    If ColumnMap IsNot Nothing Then\n                        For Each de As DictionaryEntry In ColumnMap\n                            columnDict.Add(de.Key.ToString, de.Value.ToString)\n                        Next\n                    Else\n                        columnDict = Nothing\n                    End If\n\n                    If ParameterSetName = \"table\" Then\n                        Dim queryColumns As String = \"*\"\n                        If columnDict IsNot Nothing Then\n                            queryColumns = String.Join(\", \", columnDict.Keys.ToArray)\n                        End If\n                        singleQuery = $\"SELECT {queryColumns} FROM {SourceTable}\"\n\n                        If String.IsNullOrWhiteSpace(DestinationTable) Then DestinationTable = SourceTable\n                    Else\n                        singleQuery = String.Join(Environment.NewLine, SourceQuery)\n                    End If\n\n                    Try\n                        Dim srcReader = Engine.GetConnection(SourceConnectionName).GetDataReader(singleQuery, SourceParameters)\n\n                        If NotifyAction Is Nothing AndAlso Notify.IsPresent Then\n                            NotifyAction = Sub(x) WriteProgress(New ProgressRecord(0, \"SimplySql BulkCopy\", DestinationTable) With {.CurrentOperation = $\"Insert {x} rows.\"})\n                        End If\n                        WriteObject(Engine.GetConnection(DestinationConnectionName).BulkLoad(srcReader, DestinationTable, columnDict, BatchSize, BatchTimeout, NotifyAction))\n                    Catch ex As Exception\n                        ErrorOperationFailed(ex, DestinationConnectionName)\n                    Finally\n                        If Notify Then WriteProgress(New ProgressRecord(0, \"SimplySql BulkCopy\", DestinationTable) With {.RecordType = ProgressRecordType.Completed})\n                    End Try\n                End If\n            End If\n        End If\n    End Sub\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/InvokeSqlQuery.vb",
    "content": "﻿<Cmdlet(VerbsLifecycle.Invoke, \"SqlQuery\", SupportsShouldProcess:=True, DefaultParameterSetName:=\"object\")>\n<[Alias](\"isq\")>\nPublic Class InvokeSqlQuery\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Mandatory:=True, Position:=0)>\n    <ValidateNotNullOrEmpty>\n    Public Property Query As String()\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"hashtable\", Position:=1)>\n    Public Property Parameters As Hashtable\n\n    <Parameter()>\n    <PSDefaultValue(Value:=\"-1 (No Timeout)>\")>\n    Public Property CommandTimeout As Integer = -1\n\n    <Parameter(ParameterSetName:=\"object\", Position:=1, ValueFromPipeline:=True)>\n    Public Property ParamObject As PSObject\n\n    <Parameter(ParameterSetName:=\"hashtable\")>\n    <Parameter(ParameterSetName:=\"object\")>\n    Public Property Stream As SwitchParameter\n\n    <Parameter()>\n    Public Property AsDataTable As SwitchParameter\n\n    <Parameter()>\n    <[Alias](\"ProviderTypes\")>\n    Public Property UseTypesFromProvider As SwitchParameter\n#End Region\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            Dim singleQuery As String = String.Join(Environment.NewLine, Query)\n\n            If Me.ShouldProcess(ConnectionName, $\"Execute '{singleQuery}'\") Then\n                If ParameterSetName.Equals(\"object\", StringComparison.OrdinalIgnoreCase) AndAlso ParamObject IsNot Nothing Then\n                    Parameters = ParamObject.ConvertToHashtable\n                End If\n                Try\n                    If Stream.IsPresent Then\n                        Using dr = Engine.Logic.GetConnection(ConnectionName).GetDataReader(singleQuery, Parameters, CommandTimeout)\n                            WriteObject(dr.ConvertToPSObject, True)\n                        End Using\n                    Else\n                        Using ds = Engine.Logic.GetConnection(ConnectionName).GetDataSet(singleQuery, CommandTimeout, Parameters, UseTypesFromProvider.IsPresent)\n                            If ds.Tables.Count = 0 Then\n                                WriteWarning(\"Query returned no resultset.  This occurs when the query has no select statement or invokes a stored procedure that does not return a resultset.  Use 'Invoke-SqlUpdate' to avoid this warning.\")\n                            ElseIf ds.Tables.Count > 1 OrElse AsDataTable.IsPresent Then\n                                WriteObject(ds.Tables, True)\n                            Else\n                                WriteObject(ds.Tables(0).Rows, True)\n                            End If\n                        End Using\n                    End If\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/InvokeSqlScalar.vb",
    "content": "﻿<Cmdlet(VerbsLifecycle.Invoke, \"SqlScalar\", SupportsShouldProcess:=True, DefaultParameterSetName:=\"object\")>\n<[Alias](\"iss\")>\nPublic Class InvokeSqlScalar\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Mandatory:=True, Position:=0)>\n    <ValidateNotNullOrEmpty>\n    Public Property Query As String()\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"hashtable\", Position:=1)>\n    Public Property Parameters As Hashtable\n\n    <Parameter()>\n    <PSDefaultValue(Value:=\"-1 (No Timeout)>\")>\n    Public Property CommandTimeout As Integer = -1\n\n    <Parameter(ParameterSetName:=\"object\", Position:=1, ValueFromPipeline:=True)>\n    Public Property ParamObject As PSObject\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            Dim singleQuery As String = String.Join(Environment.NewLine, Query)\n\n            If Me.ShouldProcess(ConnectionName, $\"Execute '{singleQuery}'\") Then\n                If ParameterSetName.Equals(\"object\", StringComparison.OrdinalIgnoreCase) AndAlso ParamObject IsNot Nothing Then\n                    Parameters = ParamObject.ConvertToHashtable\n                End If\n                Try\n                    WriteObject(Engine.Logic.GetConnection(ConnectionName).GetScalar(singleQuery, CommandTimeout, Parameters))\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/InvokeSqlUpdate.vb",
    "content": "﻿Imports System.Data\n\n<Cmdlet(VerbsLifecycle.Invoke, \"SqlUpdate\", SupportsShouldProcess:=True, DefaultParameterSetName:=\"object\")>\n<[Alias](\"isu\")>\nPublic Class InvokeSqlUpdate\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Mandatory:=True, Position:=0)>\n    <ValidateNotNullOrEmpty>\n    Public Property Query As String()\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"hashtable\", Position:=1)>\n    Public Property Parameters As Hashtable\n\n    <Parameter()>\n    <PSDefaultValue(Value:=\"-1 (No Timeout)>\")>\n    Public Property CommandTimeout As Integer = -1\n\n    <Parameter(ParameterSetName:=\"object\", Position:=1, ValueFromPipeline:=True)>\n    Public Property ParamObject As PSObject\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"cmd\")>\n    Public Property Command As IDbCommand\n\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            Dim conn = Engine.Logic.GetConnection(ConnectionName)\n            If ParameterSetName = \"cmd\" AndAlso Me.ShouldProcess(ConnectionName, $\"Execute '{Command.CommandText}'\") Then\n                Try\n                    WriteObject(conn.Update(Command))\n                    WriteVerbose($\"Executed command on '{ConnectionName}'.\")\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            Else\n                Dim singleQuery As String = String.Join(Environment.NewLine, Query)\n                If ParameterSetName.Equals(\"object\", StringComparison.OrdinalIgnoreCase) AndAlso ParamObject IsNot Nothing Then\n                    Parameters = ParamObject.ConvertToHashtable\n                End If\n\n                If Me.ShouldProcess(ConnectionName, $\"Execute '{singleQuery}'\") Then\n                    Try\n                        WriteObject(conn.Update(singleQuery, CommandTimeout, Parameters))\n                        WriteVerbose($\"Executed query on '{ConnectionName}'.\")\n                    Catch ex As Exception\n                        ErrorOperationFailed(ex, ConnectionName)\n                    End Try\n                End If\n            End If\n        End If\n    End Sub\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/SetSqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Set, \"SqlConnection\", SupportsShouldProcess:=True)>\nPublic Class SetSqlConnection\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Position:=0, ValueFromPipelineByPropertyName:=True)>\n    Public Property Database As String\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    Public Property CommandTimeout As Integer = -1\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If CommandTimeout > 0 AndAlso Me.ShouldProcess(ConnectionName, $\"Change CommandTimeout to '{CommandTimeout}'\") Then\n                Engine.Logic.GetConnection(ConnectionName).CommandTimeout = CommandTimeout\n            End If\n\n            If Not String.IsNullOrEmpty(Database) AndAlso Me.ShouldProcess(ConnectionName, $\"Change Database to '{Database}'\") Then\n                Try\n                    Engine.Logic.GetConnection(ConnectionName).ChangeDatabase(Database)\n                Catch nse As NotSupportedException\n                    WriteWarning(nse.Message)\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/ShowSqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Show, \"SqlConnection\", DefaultParameterSetName:=\"single\")>\n<[Alias](\"ssc\")>\nPublic Class ShowSqlConnection\n    Inherits PSCmdlet\n\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, ParameterSetName:=\"single\", Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"all\")>\n    Public Property All As SwitchParameter\n#End Region\n\n    Protected Overrides Sub EndProcessing()\n        If All.IsPresent Then\n            WriteObject(Engine.Logic.Connections.Keys, True)\n        Else\n            If Engine.Logic.ConnectionExists(ConnectionName, False) = Engine.ValidateConnectionResult.Found Then\n                Dim connInfo As New PSObject()\n                For Each de As DictionaryEntry In Engine.Logic.GetConnection(ConnectionName).ConnectionInfo\n                    connInfo.Properties.Add(New PSNoteProperty(de.Key, de.Value))\n                Next\n                WriteObject(connInfo)\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/StartSqlTransaction.vb",
    "content": "﻿<Cmdlet(VerbsLifecycle.Start, \"SqlTransaction\", SupportsShouldProcess:=True)>\nPublic Class StartSqlTransaction\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Begin a Sql Transaction\") Then\n                Try\n                    Engine.Logic.GetConnection(ConnectionName).BeginTransaction()\n                Catch ex As Exception\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/TestSqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsDiagnostic.Test, \"SqlConnection\", DefaultParameterSetName:=\"single\")>\n<[Alias](\"tsc\")>\nPublic Class TestSqlConnection\n    Inherits PSCmdlet\n\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, ParameterSetName:=\"single\", Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"all\")>\n    Public Property All As SwitchParameter\n\n    <Parameter(ParameterSetName:=\"single\")>\n    Public Property Detailed As SwitchParameter\n#End Region\n\n    Protected Overrides Sub EndProcessing()\n        If All.IsPresent Then\n            WriteObject(Engine.Logic.Connections.Count > 0)\n        Else\n            If Detailed Then\n                WriteObject(Engine.Logic.ConnectionExists(ConnectionName))\n            Else\n                WriteObject(Engine.Logic.ConnectionExists(ConnectionName, False) = Engine.ValidateConnectionResult.Found)\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Cmdlets/UndoSqlTransaction.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Undo, \"SqlTransaction\", SupportsShouldProcess:=True)>\nPublic Class UndoSqlTransaction\n    Inherits PSCmdlet\n#Region \"Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True, ValueFromPipeline:=True, Position:=0)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        If ValidateConnection(ConnectionName) Then\n            If Me.ShouldProcess(ConnectionName, \"Rollback a Sql Transaction\") Then\n                Dim conn = Engine.Logic.GetConnection(ConnectionName)\n                Try\n                    conn.RollbackTransaction()\n                Catch ex As Exception\n                    If conn.Connection.State = Data.ConnectionState.Closed Then conn.Connection.Open()\n                    ErrorOperationFailed(ex, ConnectionName)\n                End Try\n            End If\n        End If\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/ContextHandling.vb",
    "content": "Imports System.Reflection\nImports System.IO\nImports System.Runtime.InteropServices\nPublic Class ContextHandling\n    Implements IModuleAssemblyInitializer, IModuleAssemblyCleanup\n\n    Shared Sub New()\n        AppPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)\n        BinPath = Path.Combine(AppPath, \"bin\")\n        AssemblyList = Directory.EnumerateFiles(BinPath, \"*.dll\").Select(Function(file) IO.Path.GetFileNameWithoutExtension(file).ToLower).ToList\n        FrameworkList = Directory.EnumerateFiles(Path.Combine(BinPath, \"PS5\"), \"*.dll\").Select(Function(file) IO.Path.GetFileNameWithoutExtension(file).ToLower).ToList\n        CoreList = Directory.EnumerateFiles(Path.Combine(BinPath, \"PS7\"), \"*.dll\").Select(Function(file) IO.Path.GetFileNameWithoutExtension(file).ToLower).ToList\n    End Sub\n\n    Public Sub OnImport() Implements IModuleAssemblyInitializer.OnImport\n        AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf HandleResolveEvent\n    End Sub\n\n    Public Sub OnRemove(psModuleInfo As PSModuleInfo) Implements IModuleAssemblyCleanup.OnRemove\n        RemoveHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf HandleResolveEvent\n    End Sub\n\n    Private Shared ReadOnly AppPath As String\n    Private Shared ReadOnly BinPath As String\n    Private Shared ReadOnly AssemblyList As IReadOnlyList(Of String)\n    Private Shared ReadOnly FrameworkList As IReadOnlyList(Of String)\n    Private Shared ReadOnly CoreList As IReadOnlyList(Of String)\n    Private Shared ReadOnly PlatformAssemblyList As IReadOnlyList(Of String)\n    Private Shared IsEngineLoaded As Boolean = False\n\n    Private Shared Function HandleResolveEvent(ByVal sender As Object, ByVal args As ResolveEventArgs) As Assembly\n        Dim asmName = New AssemblyName(args.Name)\n\n        '#If DEBUG Then\n        'Console.WriteLine($\"{Environment.NewLine}ASSEMBLY LOAD: '{asmName}' BECAUSE '{args.RequestingAssembly}'{Environment.NewLine}\")\n        '#End If\n\n        If asmName.Name.Equals(\"SimplySql.Engine\", StringComparison.OrdinalIgnoreCase) Then\n            Dim asmPath = FindFile(asmName.Name)\n            If asmPath IsNot Nothing Then\n                IsEngineLoaded = True\n                Return Assembly.LoadFile(asmPath)\n            Else\n                Throw New FileLoadException(\"Cannot find 'SimplySql.Engine'\", asmPath)\n            End If\n        End If\n\n        If IsEngineLoaded Then\n            Dim asmPath = FindFile(asmName.Name)\n            If asmPath IsNot Nothing Then Return Assembly.LoadFile(asmPath)\n        End If\n\n        Return Nothing\n    End Function\n\n    Private Shared Function FindFile(asmName As String) As String\n        If AssemblyList.Contains(asmName.ToLower) Then\n            Return Path.Combine(BinPath, $\"{asmName}.dll\")\n        Else\n            If Environment.Version.Major = 4 Then 'PS 5.1\n                If FrameworkList.Contains(asmName.ToLower) Then\n                    Return Path.Combine(BinPath, \"PS5\", $\"{asmName}.dll\")\n                Else\n                    If Environment.Is64BitProcess Then\n                        Dim filePath = Path.Combine(BinPath, \"PS5\", \"win-x64\", $\"{asmName}.dll\")\n                        If IO.File.Exists(filePath) Then Return filePath\n                    Else\n                        Dim filePath = Path.Combine(BinPath, \"PS5\", \"win-x86\", $\"{asmName}.dll\")\n                        If IO.File.Exists(filePath) Then Return filePath\n                    End If\n                End If\n            Else 'PS 6+\n                If CoreList.Contains(asmName.ToLower) Then\n                    Return Path.Combine(BinPath, \"PS7\", $\"{asmName}.dll\")\n                Else\n                    If RuntimeInformation.IsOSPlatform(OSPlatform.Linux) Then\n                        Dim filePath = Path.Combine(BinPath, \"PS7\", \"linux-x64\", $\"{asmName}.dll\")\n                        If IO.File.Exists(filePath) Then Return filePath\n                    ElseIf RuntimeInformation.IsOSPlatform(OSPlatform.OSX) Then\n                        Dim arch As String = RuntimeInformation.OSArchitecture.ToString().ToLower()\n                        Dim filePath = Path.Combine(BinPath, \"PS7\", $\"osx-{arch}\", $\"{asmName}.dll\")\n                        If IO.File.Exists(filePath) Then Return filePath\n                    Else\n                        Dim filePath = Path.Combine(BinPath, \"PS7\", \"win-x64\", $\"{asmName}.dll\")\n                        If IO.File.Exists(filePath) Then Return filePath\n                    End If\n                End If\n            End If\n        End If\n        Return Nothing\n    End Function\nEnd Class"
  },
  {
    "path": "source/SimplySql.Cmdlets/DataReaderToPSObject.vb",
    "content": "﻿Imports System.Data\nImports System.Data.Common\nImports System.Linq.Expressions\n\nPublic Class DataReaderToPSObject\n    Shared Iterator Function Convert(theDataReader As IDataReader) As IEnumerable(Of PSObject)\n        Do\n            Dim columns = map.CreateMappings(theDataReader)\n            While theDataReader.Read\n                Dim pso As New PSObject\n                Dim nameList As New Dictionary(Of String, Integer)\n                For Each col In columns\n\n\n\n\n                    If theDataReader.IsDBNull(col.Ordinal) Then\n                        pso.Properties.Add(New PSNoteProperty(col.Name, Nothing), True)\n                    Else\n                        Select Case col.Type\n                            Case \"System.Boolean\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetBoolean(col.Ordinal)), True)\n                            Case \"System.Byte\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetByte(col.Ordinal)), True)\n                            Case \"System.Char\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetChar(col.Ordinal)), True)\n                            Case \"System.DateTime\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetDateTime(col.Ordinal)), True)\n                            Case \"System.Decimal\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetDecimal(col.Ordinal)), True)\n                            Case \"System.Double\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetDouble(col.Ordinal)), True)\n                            Case \"System.Single\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetFloat(col.Ordinal)), True)\n                            Case \"System.Guid\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetGuid(col.Ordinal)), True)\n                            Case \"System.Int16\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetInt16(col.Ordinal)), True)\n                            Case \"System.Int32\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetInt32(col.Ordinal)), True)\n                            Case \"System.Int64\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetInt64(col.Ordinal)), True)\n                            Case \"System.String\"\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetString(col.Ordinal)), True)\n                            Case Else\n                                pso.Properties.Add(New PSNoteProperty(col.Name, theDataReader.GetValue(col.Ordinal)))\n                        End Select\n                    End If\n                Next\n                Yield pso\n            End While\n        Loop While theDataReader.NextResult\n    End Function\n\n    Shared Iterator Function ConvertUsingExpressionTree(theDataReader As IDataReader) As IEnumerable(Of PSObject)\n        Do\n            Dim convertFunction = map.CreateFunction(theDataReader)\n            While theDataReader.Read\n                Yield convertFunction(theDataReader)\n            End While\n        Loop While theDataReader.NextResult\n    End Function\n\n    Friend Class map\n        Public Ordinal As Integer = 0\n        Public Name As String\n        Public Type As String\n        Shared Function CreateMappings(dr As IDataReader) As Generic.List(Of map)\n            Dim nameList As New Dictionary(Of String, Integer)\n            Return Linq.Enumerable.Range(0, dr.FieldCount).Select(Function(ord)\n                                                                      Dim n As String = dr.GetName(ord)\n                                                                      Dim ni As Integer\n                                                                      If nameList.TryGetValue(n, ni) Then\n                                                                          nameList(n) += 1\n                                                                          n += ni.ToString\n                                                                      Else\n                                                                          nameList.Add(n, 1)\n                                                                      End If\n                                                                      Return New map With {.Ordinal = ord, .Name = n, .Type = dr.GetFieldType(ord).ToString}\n                                                                  End Function).ToList\n        End Function\n\n        Shared Function CreateFunction(dr As IDataReader) As Func(Of IDataRecord, PSObject)\n            Dim expList = New List(Of Expression)\n            Dim columns = map.CreateMappings(dr)\n\n            Dim paramDR = Expression.Parameter(GetType(IDataRecord), \"dr\")\n            Dim varPso = Expression.Variable(GetType(PSObject), \"pso\")\n            expList.Add(Expression.Assign(varPso, Expression.[New](GetType(PSObject)))) 'Dim pso = New PSObject\n\n            Dim psoProperties = Expression.Property(varPso, GetType(PSObject).GetProperty(\"Properties\"))\n            Dim methodPsoPropertiesAdd = GetType(PSMemberInfoCollection(Of PSPropertyInfo)).GetMethod(\"Add\", {GetType(PSNoteProperty)})\n\n            For Each col In columns\n                Dim psnName = Expression.Constant(col.Name, GetType(String))\n                Dim psnValue = Expression.Call(paramDR, GetType(IDataRecord).GetMethod(\"GetValue\"), {Expression.Constant(col.Ordinal)})\n\n                Dim noteProperty = Expression.[New](GetType(PSNoteProperty).GetConstructor({GetType(String), GetType(Object)}), {psnName, psnValue})\n                expList.Add(Expression.Call(psoProperties, methodPsoPropertiesAdd, {noteProperty})) ' pso.Members.Add(New PSNoteProperty(col.Name, dr.GetValue(col.Ordinal))\n            Next\n\n            expList.Add(varPso) ' return pso\n            Return Expression.Lambda(Of Func(Of IDataRecord, PSObject))(Expression.Block({varPso}, expList), paramDR).Compile\n        End Function\n    End Class\n\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/Dry.vb",
    "content": "﻿Imports System.Globalization\nImports System.Runtime.CompilerServices\nImports System.Runtime.Serialization\n\nModule Dry\n    <Extension>\n    Function ValidateConnection(this As PSCmdlet, connectionName As String, Optional validateIsOpen As Boolean = True) As Boolean\n        Dim result = Engine.ConnectionExists(connectionName, validateIsOpen)\n        Select Case result\n            Case Engine.ValidateConnectionResult.NotFound\n                this.WriteError(New ErrorRecord(New ConnectionNotFound(connectionName), this.MyInvocation.MyCommand.Name, ErrorCategory.ObjectNotFound, connectionName))\n                Return False\n            Case Engine.ValidateConnectionResult.NotOpen\n                this.WriteError(New ErrorRecord(New ConnectionNotOpen(connectionName), this.MyInvocation.MyCommand.Name, ErrorCategory.ResourceUnavailable, connectionName))\n                Return False\n            Case Engine.ValidateConnectionResult.Found, Engine.ValidateConnectionResult.Open\n                Return True\n            Case Else\n                Throw New NotImplementedException($\"ValidateConnectionResult '{result}' is not implemented!\")\n        End Select\n    End Function\n\n    <Extension>\n    Sub ErrorOperationFailed(this As PSCmdlet, ex As Exception, connectionName As String, Optional errCategory As ErrorCategory = ErrorCategory.InvalidOperation)\n        this.WriteError(New ErrorRecord(ex, this.MyInvocation.MyCommand.Name, errCategory, connectionName))\n    End Sub\n\n    <Extension>\n    Function ConvertToHashtable(this As PSObject, Optional ignoreNull As Boolean = True) As Hashtable\n        Dim ht As New Hashtable\n        Dim propQuery = this.Properties.Where(Function(prop) prop.MemberType = PSMemberTypes.Property Or prop.MemberType = PSMemberTypes.AliasProperty Or prop.MemberType = PSMemberTypes.NoteProperty).AsQueryable\n        If ignoreNull Then propQuery = propQuery.Where(Function(prop) prop.Value IsNot Nothing)\n\n        Dim nValue As Object\n        For Each prop In propQuery\n            nValue = prop.Value\n            If TypeOf nValue Is PSObject Then nValue = DirectCast(nValue, PSObject).BaseObject\n            If Type.GetTypeCode(nValue.GetType()) = TypeCode.Object Then\n                If TypeOf nValue Is Xml.XmlNode Then\n                    nValue = DirectCast(nValue, Xml.XmlNode).OuterXml\n                Else\n                    nValue = nValue.ToString()\n                End If\n            End If\n            ht.Add(prop.Name, nValue)\n        Next\n        Return ht\n    End Function\n\n    <Extension>\n    Function ConvertToPSObject(this As Data.IDataReader) As IEnumerable(Of PSObject)\n        Return DataReaderToPSObject.Convert(this)\n    End Function\nEnd Module\n\n#Region \"Exceptions\"\nPublic Class ConnectionNotFound\n    Inherits Exception\n    Public ReadOnly Property ConnectionName As String\n    Sub New(connectionName As String)\n        MyBase.New($\"Connection '{connectionName}' does not exist.\")\n        Me.ConnectionName = connectionName\n    End Sub\n    Public Sub New(connectionName As String, innerException As Exception)\n        MyBase.New($\"Connection '{connectionName}' does not exist.\", innerException)\n        Me.ConnectionName = connectionName\n    End Sub\nEnd Class\n\nPublic Class ConnectionNotOpen\n    Inherits Exception\n    Public ReadOnly Property ConnectionName As String\n    Sub New(connectionName As String)\n        MyBase.New($\"Connection '{connectionName}' is not open.\")\n        Me.ConnectionName = connectionName\n    End Sub\n    Public Sub New(connectionName As String, innerException As Exception)\n        MyBase.New($\"Connection '{connectionName}' is not open.\", innerException)\n        Me.ConnectionName = connectionName\n    End Sub\nEnd Class\n#End Region"
  },
  {
    "path": "source/SimplySql.Cmdlets/My Project/Application.myapp",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<MyApplicationData xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n  <MySubMain>true</MySubMain>\n  <MainForm>Form1</MainForm>\n  <SingleInstance>false</SingleInstance>\n  <ShutdownMode>0</ShutdownMode>\n  <EnableVisualStyles>true</EnableVisualStyles>\n  <AuthenticationMode>0</AuthenticationMode>\n  <SaveMySettingsOnExit>true</SaveMySettingsOnExit>\n</MyApplicationData>"
  },
  {
    "path": "source/SimplySql.Cmdlets/My Project/launchSettings.json",
    "content": "{\n  \"profiles\": {\n    \"PWSH\": {\n      \"commandName\": \"Executable\",\n      \"executablePath\": \"pwsh\",\n      \"commandLineArgs\": \"-noexit -nologo -noprofile -file \\\"ConstructModule.ps1\\\"\",\n      \"workingDirectory\": \"..\\\\\"\n    },\n    \"Powershell\": {\n      \"commandName\": \"Executable\",\n      \"executablePath\": \"powershell\",\n      \"commandLineArgs\": \"-noexit -nologo -noprofile -file \\\"ConstructModule.ps1\\\"\",\n      \"workingDirectory\": \"..\\\\\"\n    },\n    \"WSL\": {\n      \"commandName\": \"Executable\",\n      \"executablePath\": \"wsl\",\n      \"commandLineArgs\": \"pwsh\",\n      \"workingDirectory\": \"..\\\\\",\n    }\n  }\n}"
  },
  {
    "path": "source/SimplySql.Cmdlets/ProviderCmdlets/OpenMySqlConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Open, \"MySqlConnection\", DefaultParameterSetName:=\"default\")>\nPublic Class OpenMySqlConnection\n    Inherits PSCmdlet\n\n#Region \"Cmdlet Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=30)>\n    Public Property CommandTimeout As Integer = 30\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <[Alias](\"Host\")>\n    <PSDefaultValue(Value:=\"localhost\")>\n    Public Property Server As String = \"localhost\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    <[Alias](\"InitialCatalog\")>\n    <PSDefaultValue(Value:=\"mysql\")>\n    Public Property Database As String = \"mysql\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=3306)>\n    Public Property Port As Integer = 3306\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=\"Preferred\")>\n    <ValidateSet(\"None\", \"Preferred\", \"Required\", \"VerifyCA\", \"VerifyFull\")>\n    Public Property SSLMode As String = \"Preferred\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=2)>\n    <Parameter(ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Credential As PSCredential\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Additional As Hashtable\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property ConnectionString As String\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        Try\n            If Engine.Logic.ConnectionExists(ConnectionName) Then\n                Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n            End If\n\n            Dim connDetail As New Engine.ConnectionMySql(ConnectionName, CommandTimeout)\n            If Credential IsNot Nothing Then connDetail.SetAuthCredential(Credential)\n\n            If Me.ParameterSetName = \"conn\" Then\n                connDetail.ConnectionString = ConnectionString\n            Else\n                With connDetail\n                    .Server = Server\n                    .Database = Database\n                    .Port = Port\n                    .SslMode = SSLMode\n                    .Additional = Additional\n                End With\n            End If\n\n            Engine.Logic.OpenAndAddConnection(connDetail)\n            WriteVerbose($\"{ConnectionName} (MySqlConnection) opened.\")\n        Catch ex As Exception\n            WriteError(New ErrorRecord(ex, \"OpenMySQLConnection.Error\", ErrorCategory.OpenError, ConnectionName))\n        End Try\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/ProviderCmdlets/OpenOracleConnection.vb",
    "content": "﻿Imports System.DirectoryServices.ActiveDirectory\nImports System.Runtime.InteropServices.ComTypes\n\n<Cmdlet(VerbsCommon.Open, \"OracleConnection\", DefaultParameterSetName:=\"default\")>\nPublic Class OpenOracleConnection\n    Inherits PSCmdlet\n\n#Region \"Cmdlet Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=30)>\n    Public Property CommandTimeout As Integer = 30\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <[Alias](\"Host\", \"DataSource\")>\n    <PSDefaultValue(Value:=\"localhost\")>\n    Public Property Server As String = \"localhost\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    Public Property ServiceName As String\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=1521)>\n    Public Property Port As Integer = 1521\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"tns\", ValueFromPipelineByPropertyName:=True)>\n    Public Property TnsName As String\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <ValidateSet(\"None\", \"SYSASM\", \"SYSDBA\", \"SYSOPER\")>\n    Public Property Privilege As String = \"None\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=2)>\n    <Parameter(ParameterSetName:=\"tns\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Credential As PSCredential\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <Parameter(ParameterSetName:=\"tns\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Additional As Hashtable\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property ConnectionString As String\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        Try\n            If Engine.Logic.ConnectionExists(ConnectionName) Then\n                Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n            End If\n\n            Dim connDetail As New Engine.ConnectionOracle(ConnectionName, CommandTimeout)\n            If Credential IsNot Nothing Then connDetail.SetAuthCredential(Credential)\n\n            Select Case ParameterSetName\n                Case \"conn\"\n                    connDetail.ConnectionString = ConnectionString\n                Case \"tns\"\n                    connDetail.TnsName = TnsName\n                    connDetail.Additional = Additional\n                Case Else\n                    With connDetail\n                        .Host = Server\n                        .ServiceName = ServiceName\n                        .Port = Port\n                        .Privilege = Privilege\n                        .Additional = Additional\n                    End With\n            End Select\n\n            Engine.Logic.OpenAndAddConnection(connDetail)\n            WriteVerbose($\"{ConnectionName} (OracleConnection) opened.\")\n        Catch ex As Exception\n            WriteError(New ErrorRecord(ex, \"OpenOracleConnection.Error\", ErrorCategory.OpenError, ConnectionName))\n        End Try\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/ProviderCmdlets/OpenPostGreConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Open, \"PostGreConnection\", DefaultParameterSetName:=\"default\")>\nPublic Class OpenPostGreConnection\n    Inherits PSCmdlet\n\n#Region \"Cmdlet Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=30)>\n    Public Property CommandTimeout As Integer = 30\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <[Alias](\"Host\")>\n    <PSDefaultValue(Value:=\"localhost\")>\n    Public Property Server As String = \"localhost\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    <[Alias](\"InitialCatalog\")>\n    <PSDefaultValue(Value:=\"postgres\")>\n    Public Property Database As String = \"postgres\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=5432)>\n    Public Property Port As Integer = 5432\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=25)>\n    Public Property MaxAutoPrepare As Integer = 25\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=\"Preferred\")>\n    <ValidateSet(\"Disable\", \"Prefer\", \"Require\", \"VerifyCA\", \"VerifyFull\")>\n    Public Property SSLMode As String = \"Prefer\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=2)>\n    <Parameter(ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Credential As PSCredential\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Additional As Hashtable\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property ConnectionString As String\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        Try\n            If Engine.Logic.ConnectionExists(ConnectionName) Then\n                Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n            End If\n\n            Dim connDetail As New Engine.ConnectionPostGre(ConnectionName, CommandTimeout) With {.Additional = Additional}\n            If Credential IsNot Nothing Then connDetail.SetAuthCredential(Credential)\n\n            If Me.ParameterSetName = \"conn\" Then\n                connDetail.ConnectionString = ConnectionString\n            Else\n                With connDetail\n                    .Host = Server\n                    .Database = Database\n                    .Port = Port\n                    .MaxAutoPrepare = MaxAutoPrepare\n                    .SslMode = SSLMode\n                    .Additional = Additional\n                End With\n            End If\n\n            Engine.Logic.OpenAndAddConnection(connDetail)\n            WriteVerbose($\"{ConnectionName} (PostGreConnection) opened.\")\n        Catch ex As Exception\n            WriteError(New ErrorRecord(ex, \"OpenPostGreConnection.Error\", ErrorCategory.OpenError, ConnectionName))\n        End Try\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/ProviderCmdlets/OpenSQLiteConnection.vb",
    "content": "﻿<Cmdlet(VerbsCommon.Open, \"SQLiteConnection\", DefaultParameterSetName:=\"default\")>\nPublic Class OpenSQLiteConnection\n    Inherits PSCmdlet\n\n#Region \"Cmdlet Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=30)>\n    Public Property CommandTimeout As Integer = 30\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <[Alias](\"FilePath\")>\n    <PSDefaultValue(Value:=\":memory:\")>\n    Public Property DataSource As String = \":memory:\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    Public Property Password As String\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Additional As Hashtable\n\n    <Parameter(ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property ConnectionString As String\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        Try\n            If Engine.Logic.ConnectionExists(ConnectionName) Then\n                Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n            End If\n\n            Dim connDetail As New Engine.ConnectionSQLite(ConnectionName, CommandTimeout)\n            If Me.ParameterSetName = \"conn\" Then\n                connDetail.ConnectionString = ConnectionString\n            Else\n                If Not DataSource.Equals(\":memory:\", StringComparison.OrdinalIgnoreCase) Then\n                    DataSource = Me.GetUnresolvedProviderPathFromPSPath(DataSource) 'handle powershell paths using psdrives\n                End If\n                connDetail.Database = DataSource\n                If Not String.IsNullOrWhiteSpace(Password) Then connDetail.Credential = New Net.NetworkCredential(Nothing, Password)\n                connDetail.Additional = Additional\n            End If\n\n            Engine.Logic.OpenAndAddConnection(connDetail)\n            WriteVerbose($\"{ConnectionName} (SQLiteConnection) opened.\")\n        Catch ex As Exception\n            WriteError(New ErrorRecord(ex, \"OpenSQLiteConnection.Error\", ErrorCategory.OpenError, ConnectionName))\n        End Try\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/ProviderCmdlets/OpenSqlConnection.vb",
    "content": "﻿\n\n<Cmdlet(VerbsCommon.Open, \"SQLConnection\", DefaultParameterSetName:=\"default\")>\nPublic Class OpenSqlConnection\n    Inherits PSCmdlet\n\n#Region \"Cmdlet Parameters\"\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <[Alias](\"cn\")>\n    <ValidateNotNullOrEmpty()>\n    <PSDefaultValue(Value:=\"default\")>\n    Public Property ConnectionName As String = \"default\"\n\n    <Parameter(ValueFromPipelineByPropertyName:=True)>\n    <PSDefaultValue(Value:=30)>\n    Public Property CommandTimeout As Integer = 30\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <Parameter(ParameterSetName:=\"credential\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <Parameter(ParameterSetName:=\"token\", ValueFromPipelineByPropertyName:=True, Position:=0)>\n    <[Alias](\"SqlInstance\", \"SqlServer\", \"DataSource\")>\n    <PSDefaultValue(Value:=\"localhost\")>\n    Public Property Server As String = \"localhost\"\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    <Parameter(ParameterSetName:=\"credential\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    <Parameter(ParameterSetName:=\"token\", ValueFromPipelineByPropertyName:=True, Position:=1)>\n    <[Alias](\"SqlDatabase\", \"InitialCatalog\")>\n    <PSDefaultValue(Value:=\"master\")>\n    Public Property Database As String = \"master\"\n\n    <Parameter(ParameterSetName:=\"credential\", ValueFromPipelineByPropertyName:=True, Position:=2)>\n    <Parameter(ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Credential As PSCredential\n\n    <Parameter(ParameterSetName:=\"credential\", ValueFromPipelineByPropertyName:=True)>\n    Public Property AzureAD As SwitchParameter\n\n    <Parameter(ParameterSetName:=\"token\", ValueFromPipelineByPropertyName:=True)>\n    <Parameter(ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property AzureToken As String\n\n    <Parameter(ParameterSetName:=\"default\", ValueFromPipelineByPropertyName:=True)>\n    <Parameter(ParameterSetName:=\"token\", ValueFromPipelineByPropertyName:=True)>\n    <Parameter(ParameterSetName:=\"credential\", ValueFromPipelineByPropertyName:=True)>\n    Public Property Additional As Hashtable\n\n    <Parameter(Mandatory:=True, ParameterSetName:=\"conn\", ValueFromPipelineByPropertyName:=True)>\n    Public Property ConnectionString As String\n#End Region\n\n    Protected Overrides Sub ProcessRecord()\n        Try\n            If Engine.Logic.ConnectionExists(ConnectionName) Then\n                Engine.Logic.CloseAndRemoveConnection(ConnectionName)\n            End If\n\n            Dim connDetail As New Engine.ConnectionMSSQL(ConnectionName, CommandTimeout)\n            Select Case Me.ParameterSetName\n                Case \"credential\"\n                    connDetail.SetAuthCredential(Credential, AzureAD.IsPresent)\n                Case \"token\"\n                    connDetail.SetAuthToken(AzureToken)\n            End Select\n\n            If Me.ParameterSetName = \"conn\" Then\n                connDetail.ConnectionString = ConnectionString\n                If Credential IsNot Nothing Then connDetail.SetAuthCredential(Credential)\n            Else\n                With connDetail\n                    .Server = Server\n                    .Database = Database\n                    .Additional = Additional\n                End With\n            End If\n\n            Engine.Logic.OpenAndAddConnection(connDetail)\n            WriteVerbose($\"{ConnectionName} (SQLConnection) opened.\")\n        Catch ex As Exception\n            WriteError(New ErrorRecord(ex, \"OpenSQLConnection.Error\", ErrorCategory.OpenError, ConnectionName))\n        End Try\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Cmdlets/SimplySql.Cmdlets.vbproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <RootNamespace>SimplySql.Cmdlets</RootNamespace>\n    <TargetFramework>netstandard2.0</TargetFramework>\n    <Version>2.0.0</Version>\n    <RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>\n    <AnalysisLevel>latest-minimum</AnalysisLevel>\n    <OutputType>Library</OutputType>\n  </PropertyGroup>\n\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|AnyCPU'\">\n    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>\n  </PropertyGroup>\n\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|AnyCPU'\">\n    <NoWarn>41999,42016,42017,42018,42019,42020,42021,42022,42032,42036</NoWarn>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"PowerShellStandard.Library\" Version=\"5.1.1\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\SimplySql.Engine\\SimplySql.Engine.vbproj\" />\n  </ItemGroup>\n\n  <ItemGroup>\n    <Import Include=\"System.Management.Automation\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "source/SimplySql.Engine/Dry.vb",
    "content": "﻿Imports System.Data\nImports System.Data.Common\nImports System.Runtime.CompilerServices\nModule Dry\n    <Extension>\n    Sub AddHashtable(this As DbConnectionStringBuilder, ht As Hashtable)\n        If ht IsNot Nothing Then\n            For Each key In ht.Keys\n                this.Add(key, ht(key))\n            Next\n        End If\n    End Sub\n\n    <Extension>\n    Sub AddQueryDetails(this As Exception, query As String, ht As Hashtable)\n        this.Data.Add(\"Query\", query)\n        Try\n            this.Data.Add(\"Parameters\", ht)\n        Catch ex As Exception\n            this.Data.Add(\"ParameterExceptionMessage\", ex.Message)\n        End Try\n    End Sub\n\n    <Extension>\n    Sub AddQueryDetails(this As Exception, query As String, sqlParams As IDataParameterCollection)\n        this.Data.Add(\"Query\", query)\n        Try\n            this.Data.Add(\"Parameters\", sqlParams)\n        Catch ex As Exception\n            this.Data.Add(\"ParameterExceptionMessage\", ex.Message)\n        End Try\n    End Sub\nEnd Module\n"
  },
  {
    "path": "source/SimplySql.Engine/ISimplySqlProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nPublic Interface ISimplySqlProvider\n    ReadOnly Property ConnectionName As String\n    ReadOnly Property Connection As IDbConnection\n    ReadOnly Property ProviderName As String\n    Property CommandTimeout As Integer\n    Function ConnectionInfo() As OrderedDictionary\n    Sub ChangeDatabase(databaseName As String)\n\n#Region \"DataAccess\"\n    Function GetScalar(query As String, cmdTimeout As Integer, parameters As Hashtable) As Object\n    Function GetCommand(query As String, cmdTimeout As Integer, parameters As Hashtable) As IDbCommand\n    Function GetDataSet(query As String, cmdTimeout As Integer, parameters As Hashtable, useProviderTypes As Boolean) As DataSet\n    Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Int64)) As Int64\n    Function GetDataReader(query As String, parameters As Hashtable, Optional cmdTimeout As Integer = -1) As IDataReader\n    Function Update(cmd As IDbCommand) As Int64\n    Function Update(query As String, cmdTimeout As Integer, parameters As Hashtable) As Int64\n#End Region\n\n#Region \"Messages\"\n    ReadOnly Property Messages As Queue(Of SqlMessage)\n    ReadOnly Property HasMessages As Boolean\n    Function GetMessage() As SqlMessage\n    Sub ClearMessages()\n#End Region\n\n#Region \"Transaction\"\n    Property Transaction As IDbTransaction\n    ReadOnly Property HasTransaction As Boolean\n    Sub BeginTransaction()\n    Sub CommitTransaction()\n    Sub RollbackTransaction()\n#End Region\nEnd Interface\n"
  },
  {
    "path": "source/SimplySql.Engine/Logic.vb",
    "content": "﻿Imports System.Management.Automation\n\nPublic Module Logic\n    ReadOnly Property Connections As New Dictionary(Of String, ISimplySqlProvider)\n\n    Function ConnectionExists(connectionName As String, Optional checkIsOpen As Boolean = True) As ValidateConnectionResult\n        If Not Connections.Keys.Any(Function(key) key.Equals(connectionName, StringComparison.OrdinalIgnoreCase)) Then\n            Return ValidateConnectionResult.NotFound\n        Else\n            If Not checkIsOpen Then\n                Return ValidateConnectionResult.Found\n            Else\n                If Not GetConnection(connectionName).Connection.State = Data.ConnectionState.Open Then\n                    Return ValidateConnectionResult.NotOpen\n                Else\n                    Return ValidateConnectionResult.Open\n                End If\n            End If\n        End If\n    End Function\n    Function GetConnection(connectionName As String) As ISimplySqlProvider\n        Try\n            Return Connections.First(Function(item) item.Key.Equals(connectionName, StringComparison.OrdinalIgnoreCase)).Value\n        Catch ioex As InvalidOperationException\n            Throw New KeyNotFoundException($\"No connection named '{connectionName}' exists.\")\n        End Try\n    End Function\n\n    Sub OpenAndAddConnection(connDetail As baseConnectionDetail)\n        Dim provider As ISimplySqlProvider\n        Select Case connDetail.ConnectionType\n            Case ProviderTypes.MSSQL\n                provider = CreateProviderMSSQL(connDetail)\n            Case ProviderTypes.MySql\n                provider = CreateProviderMySQL(connDetail)\n            Case ProviderTypes.Oracle\n                provider = CreateProviderOracle(connDetail)\n            Case ProviderTypes.PostGre\n                provider = CreateProviderPostGre(connDetail)\n            Case ProviderTypes.SQLite\n                provider = CreateProviderSQLite(connDetail)\n            Case Else\n                Throw New ArgumentOutOfRangeException(NameOf(connDetail), connDetail.ConnectionType, $\"'{connDetail.ConnectionType}' is not a supported provider.\")\n        End Select\n        provider.Connection.Open()\n        Connections.Add(connDetail.ConnectionName, provider)\n    End Sub\n\n    Sub OpenAndAddConnection(newProvider As ISimplySqlProvider)\n        ' ideally, this should take the type and the base Connection details (abstraction) and handle provider creation and returning it.\n        newProvider.Connection.Open()\n        Connections.Add(newProvider.ConnectionName, newProvider)\n    End Sub\n\n    Sub CloseAndRemoveConnection(connectionName As String)\n        Try\n            Dim conn = Connections.First(Function(item) item.Key.Equals(connectionName, StringComparison.OrdinalIgnoreCase)).Value\n            If conn.HasTransaction Then conn.RollbackTransaction()\n            Try\n                conn.Connection.Close()\n            Finally\n                conn.Connection.Dispose()\n                Connections.Remove(conn.ConnectionName)\n            End Try\n        Catch ioex As InvalidOperationException\n            Throw New KeyNotFoundException($\"No connection named '{connectionName}' exists.\")\n        End Try\n    End Sub\n\n#Region \"Provider Create Functions\"\n    Private Function CreateProviderMSSQL(connDetail As baseConnectionDetail) As ISimplySqlProvider\n        Return MSSQLProvider.Create(connDetail)\n    End Function\n    Private Function CreateProviderMySql(connDetail As baseConnectionDetail) As ISimplySqlProvider\n        Return MySqlProvider.Create(connDetail)\n    End Function\n    Private Function CreateProviderOracle(connDetail As baseConnectionDetail) As ISimplySqlProvider\n        Return OracleProvider.Create(connDetail)\n    End Function\n    Private Function CreateProviderPostGre(connDetail As baseConnectionDetail) As ISimplySqlProvider\n        Return PostGreProvider.Create(connDetail)\n    End Function\n    Private Function CreateProviderSQLite(connDetail As baseConnectionDetail) As ISimplySqlProvider\n        Return SQLiteProvider.Create(connDetail)\n    End Function\n#End Region\nEnd Module"
  },
  {
    "path": "source/SimplySql.Engine/MSSQL/ConnectionMSSQL.vb",
    "content": "﻿Imports System.Net\n\nPublic Class ConnectionMSSQL\n    Inherits baseConnectionDetail\n    Public ReadOnly Property AuthType As AuthMSSQLType = AuthMSSQLType.Credential\n    Public ReadOnly Property Token As String\n        Get\n            If AuthType = AuthMSSQLType.Token Then\n                Return Credential.Password\n            Else\n                Throw New InvalidOperationException($\"Cannot return {NameOf(Token)} when {NameOf(AuthType)} is not 'Token'.\")\n            End If\n        End Get\n    End Property\n\n    Public Property Server As String\n    Public Property Database As String\n\n    Sub New(connName As String, cmdTimeout As Integer)\n        MyBase.New(connName, ProviderTypes.MSSQL, cmdTimeout)\n        SetAuthWindows()\n    End Sub\n\n    Sub SetAuthWindows()\n        _AuthType = AuthMSSQLType.Windows\n        Me.UseIntegratedSecurity = True\n    End Sub\n    Sub SetAuthToken(tkn As String)\n        _AuthType = AuthMSSQLType.Token\n        If tkn.StartsWith(\"bearer \") Then tkn = tkn.Substring(7)\n        Credential = New NetworkCredential(Nothing, tkn)\n        Me.UseIntegratedSecurity = False\n    End Sub\n    Sub SetAuthCredential(cred As NetworkCredential, Optional isAzure As Boolean = False)\n        _AuthType = If(isAzure, AuthMSSQLType.AzureCredential, AuthMSSQLType.Credential)\n        Credential = cred\n        Me.UseIntegratedSecurity = False\n    End Sub\n\n    Public Enum AuthMSSQLType\n        Windows\n        Credential\n        AzureCredential\n        Token\n    End Enum\nEnd Class"
  },
  {
    "path": "source/SimplySql.Engine/MSSQL/MSSQLProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nImports System.Data.Common\nImports Microsoft.Data.SqlClient\n\nPublic Class MSSQLProvider\n    Inherits ProviderBase\n\n    Public Overloads ReadOnly Property Connection As SqlConnection\n        Get\n            Return DirectCast(MyBase.Connection, SqlConnection)\n        End Get\n    End Property\n\n    Private Sub New(connectionName As String, commandTimeout As Integer, connection As SqlConnection)\n        MyBase.New(connectionName, ProviderTypes.MSSQL, connection, commandTimeout)\n\n        AddHandler Me.Connection.InfoMessage, AddressOf HandleInfoMessage\n    End Sub\n\n    Public Overrides Function ConnectionInfo() As OrderedDictionary\n        Dim od = MyBase.ConnectionInfo\n        With od\n            .Add(\"ServerVersion\", Connection.ServerVersion)\n            .Add(\"Server\", Connection.DataSource)\n            .Add(\"Database\", Connection.Database)\n        End With\n        Return od\n    End Function\n\n    Public Overrides Sub ChangeDatabase(databaseName As String)\n        Connection.ChangeDatabase(databaseName)\n    End Sub\n\n    Public Overrides Function GetDataset(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As DataSet\n        If Not useProviderTypes Then\n            Return MyBase.GetDataset(query, cmdTimeout, params, False)\n        Else\n            Using cmd As SqlCommand = GetCommand(query, cmdTimeout, params)\n                Using da As New SqlDataAdapter(cmd)\n                    Dim ds As New Data.DataSet\n                    da.ReturnProviderSpecificTypes = True\n                    Try\n                        da.Fill(ds)\n                        Return ds\n                    Catch ex As Exception\n                        ex.AddQueryDetails(query, params)\n                        Throw\n                    End Try\n                End Using\n            End Using\n        End If\n    End Function\n\n    Public Overrides Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        If batchTimeout < 0 Then batchTimeout = CommandTimeout\n        Dim bcpOption = SqlBulkCopyOptions.KeepIdentity + SqlBulkCopyOptions.CheckConstraints + SqlBulkCopyOptions.FireTriggers\n        Using dataReader\n            Using bcp As New SqlBulkCopy(Connection, bcpOption, Transaction) With {.BulkCopyTimeout = batchTimeout, .BatchSize = batchSize, .DestinationTableName = destinationTable, .EnableStreaming = True}\n                GenerateSchemaMap(dataReader, columnMap).ForEach(Sub(x) bcp.ColumnMappings.Add(x.SourceName, x.DestinationName))\n\n                If notify IsNot Nothing Then\n                    bcp.NotifyAfter = batchSize\n                    AddHandler bcp.SqlRowsCopied, Sub(sender As Object, e As SqlRowsCopiedEventArgs) notify.Invoke(e.RowsCopied)\n                End If\n\n                bcp.WriteToServer(dataReader)\n\n                If notify IsNot Nothing Then notify.Invoke(bcp.RowsCopied)\n                Return bcp.RowsCopied\n            End Using\n        End Using\n    End Function\n\n    Private Sub HandleInfoMessage(sender As Object, e As SqlInfoMessageEventArgs)\n        Me.Messages.Enqueue(New SqlMessage(e.Message))\n    End Sub\n\n#Region \"Shared Functions\"\n    Public Shared Function Create(connDetail As ConnectionMSSQL) As MSSQLProvider\n        Dim connString As String\n        If connDetail.HasConnectionString Then\n            connString = connDetail.ConnectionString\n        Else\n            Dim sb As New SqlConnectionStringBuilder With {.ApplicationName = connDetail.ApplicationName, .DataSource = connDetail.Server, .InitialCatalog = connDetail.Database}\n            Select Case connDetail.AuthType\n                Case ConnectionMSSQL.AuthMSSQLType.Windows\n                    sb.Encrypt = SqlConnectionEncryptOption.Optional\n                    sb.IntegratedSecurity = True\n                Case ConnectionMSSQL.AuthMSSQLType.Credential\n                    sb.Encrypt = SqlConnectionEncryptOption.Optional\n                Case ConnectionMSSQL.AuthMSSQLType.AzureCredential\n                    sb.Authentication = SqlAuthenticationMethod.ActiveDirectoryPassword\n            End Select\n\n            'Process additional parameters through the hashtable\n            sb.AddHashtable(connDetail.Additional)\n            connString = sb.ToString\n        End If\n\n        Dim conn As New SqlConnection(connString)\n        Select Case connDetail.AuthType\n            Case ConnectionMSSQL.AuthMSSQLType.Token\n                conn.AccessToken = connDetail.Token\n            Case ConnectionMSSQL.AuthMSSQLType.AzureCredential, ConnectionMSSQL.AuthMSSQLType.Credential\n                Dim p = connDetail.SecurePassword\n                p.MakeReadOnly()\n                conn.Credential = New SqlCredential(connDetail.UserName, p)\n        End Select\n\n        Return New MSSQLProvider(connDetail.ConnectionName, connDetail.CommandTimeout, conn)\n    End Function\n#End Region\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/My Project/Application.myapp",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<MyApplicationData xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n  <MySubMain>true</MySubMain>\n  <MainForm>Form1</MainForm>\n  <SingleInstance>false</SingleInstance>\n  <ShutdownMode>0</ShutdownMode>\n  <EnableVisualStyles>true</EnableVisualStyles>\n  <AuthenticationMode>0</AuthenticationMode>\n  <SaveMySettingsOnExit>true</SaveMySettingsOnExit>\n</MyApplicationData>"
  },
  {
    "path": "source/SimplySql.Engine/MySQL/ConnectionMySql.vb",
    "content": "﻿Imports System.Net\n\nPublic Class ConnectionMySql\n    Inherits baseConnectionDetail\n    Public Property Server As String\n    Public Property Database As String\n    Public Property Port As Integer\n    Public Property SslMode As String = \"\"\n\n    Sub New(connName As String, cmdTimeout As Integer)\n        MyBase.New(connName, ProviderTypes.MySql, cmdTimeout)\n        Me.UseIntegratedSecurity = False\n    End Sub\n\n    Sub SetAuthCredential(cred As NetworkCredential)\n        Me.UseIntegratedSecurity = False\n        Me.Credential = cred\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/MySQL/MySqlProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nImports MySqlConnector\n\nPublic Class MySqlProvider\n    Inherits ProviderBase\n    Public Overloads ReadOnly Property Connection As MySqlConnection\n        Get\n            Return DirectCast(MyBase.Connection, MySqlConnection)\n        End Get\n    End Property\n\n    Private Sub New(connectionName As String, commandTimeout As Integer, connection As MySqlConnection)\n        MyBase.New(connectionName, ProviderTypes.MySql, connection, commandTimeout)\n\n        AddHandler connection.InfoMessage, AddressOf HandleInfoMessage\n    End Sub\n\n    Public Overrides Function ConnectionInfo() As OrderedDictionary\n        Dim od = MyBase.ConnectionInfo\n        With od\n            .Add(\"ServerVersion\", Connection.ServerVersion)\n            .Add(\"Server\", Connection.DataSource)\n            .Add(\"Database\", Connection.Database)\n        End With\n        Return od\n    End Function\n\n    Public Overrides Function GetDataSet(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As Data.DataSet\n        If Not useProviderTypes Then\n            Return MyBase.GetDataset(query, cmdTimeout, params, False)\n        Else\n            Using cmd As MySqlCommand = GetCommand(query, cmdTimeout, params)\n                Using da As New MySqlDataAdapter(cmd)\n                    Dim ds As New Data.DataSet\n                    da.ReturnProviderSpecificTypes = True\n                    Try\n                        da.Fill(ds)\n                        Return ds\n                    Catch ex As Exception\n                        ex.AddQueryDetails(query, params)\n                        Throw\n                    End Try\n                End Using\n            End Using\n        End If\n    End Function\n\n    Public Overrides Sub ChangeDatabase(databaseName As String)\n        Connection.ChangeDatabase(databaseName)\n    End Sub\n\n    Public Overrides Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        If batchTimeout < 0 Then batchTimeout = CommandTimeout\n        Using dataReader\n            Dim bcp As New MySqlBulkCopy(Connection, Transaction) With {.BulkCopyTimeout = batchTimeout, .DestinationTableName = destinationTable}\n            GenerateSchemaMap(dataReader, columnMap).ForEach(Sub(x) bcp.ColumnMappings.Add(New MySqlBulkCopyColumnMapping(x.Ordinal, x.DestinationName)))\n\n            If notify IsNot Nothing Then\n                bcp.NotifyAfter = batchSize\n                AddHandler bcp.MySqlRowsCopied, Sub(sender As Object, e As MySqlRowsCopiedEventArgs) notify.Invoke(e.RowsCopied)\n            End If\n\n            Dim result = bcp.WriteToServer(dataReader)\n            result.Warnings.ToList.ForEach(Sub(w) Messages.Enqueue(New SqlMessage(w.Message)))\n\n            If notify IsNot Nothing Then notify.Invoke(result.RowsInserted)\n            Return result.RowsInserted\n        End Using\n    End Function\n\n    Private Sub HandleInfoMessage(sender As Object, e As MySqlInfoMessageEventArgs)\n        For Each m In e.Errors\n            Messages.Enqueue(New SqlMessage(m.Message))\n        Next\n    End Sub\n\n#Region \"Shared Functions\"\n    Public Shared Function Create(connDetail As ConnectionMySql) As MySqlProvider\n        Dim sb As MySqlConnectionStringBuilder\n        If connDetail.HasConnectionString Then\n            sb = New MySqlConnectionStringBuilder(connDetail.ConnectionString)\n        Else\n            sb = New MySqlConnectionStringBuilder With {\n                    .ApplicationName = connDetail.ApplicationName,\n                    .Server = connDetail.Server,\n                    .Port = connDetail.Port,\n                    .Database = connDetail.Database,\n                    .SslMode = MapSslMode(connDetail.SslMode),\n                    .AllowLoadLocalInfile = True,\n                    .UseAffectedRows = True,\n                    .AllowUserVariables = True\n                }\n\n            'Process additional parameters through the hashtable\n            sb.AddHashtable(connDetail.Additional)\n        End If\n\n        If connDetail.Credential IsNot Nothing Then\n            sb.UserID = connDetail.UserName\n            sb.Password = connDetail.Password\n        End If\n\n        Return New MySqlProvider(connDetail.ConnectionName, connDetail.CommandTimeout, New MySqlConnection(sb.ToString))\n    End Function\n    Private Shared Function MapSslMode(ssl As String) As MySqlSslMode\n        Return [Enum].Parse(GetType(MySqlSslMode), ssl)\n    End Function\n#End Region\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/Oracle/ConnectionOracle.vb",
    "content": "﻿Imports System.Net\n\nPublic Class ConnectionOracle\n    Inherits baseConnectionDetail\n\n    Public ReadOnly Property HasTnsName As Boolean\n        Get\n            Return Not String.IsNullOrWhiteSpace(TNSName)\n        End Get\n    End Property\n\n    Public Property TnsName As String\n    Public Property Host As String\n    Public Property ServiceName As String\n    Public Property Port As Integer\n    Public Property Privilege As String = \"None\"\n\n    Sub New(connName As String, cmdTimeout As Integer)\n        MyBase.New(connName, ProviderTypes.Oracle, cmdTimeout)\n    End Sub\n\n    Sub SetAuthCredential(cred As NetworkCredential)\n        Me.UseIntegratedSecurity = False\n        Me.Credential = cred\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/Oracle/OracleProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nImports Oracle.ManagedDataAccess.Client\n\nPublic Class OracleProvider\n    Inherits ProviderBase\n\n    Private Privilege As String\n    Public Overloads ReadOnly Property Connection As OracleConnection\n        Get\n            Return DirectCast(MyBase.Connection, OracleConnection)\n        End Get\n    End Property\n\n    Private Sub New(connName As String, timeout As Integer, conn As OracleConnection, priv As String)\n        MyBase.New(connName, ProviderTypes.Oracle, conn, timeout)\n        Privilege = priv\n        AddHandler Me.Connection.InfoMessage, AddressOf HandleInfoMessage\n    End Sub\n\n    Public Overrides Function ConnectionInfo() As OrderedDictionary\n        Dim od = MyBase.ConnectionInfo\n        With od\n            .Add(\"ServerVersion\", Connection.ServerVersion)\n            .Add(\"HostName\", Connection.HostName)\n            .Add(\"ServiceName\", Connection.ServiceName)\n            .Add(\"Privilege\", Privilege)\n        End With\n        Return od\n    End Function\n\n    Public Overrides Sub ChangeDatabase(databaseName As String)\n        Connection.ChangeDatabase(databaseName)\n    End Sub\n\n    Public Overrides Function GetDataset(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As DataSet\n        If Not useProviderTypes Then\n            Return MyBase.GetDataset(query, cmdTimeout, params, False)\n        Else\n            Using cmd As OracleCommand = GetCommand(query, cmdTimeout, params)\n                Using da As New OracleDataAdapter(cmd)\n                    Dim ds As New Data.DataSet\n                    da.ReturnProviderSpecificTypes = True\n                    Try\n                        da.Fill(ds)\n                        Return ds\n                    Catch ex As Exception\n                        ex.AddQueryDetails(query, params)\n                        Throw\n                    End Try\n                End Using\n            End Using\n        End If\n    End Function\n\n    Public Overrides Function HandleParamValue(x As Object) As Object\n        If x.GetType().IsEnum Then x = DirectCast(x, Integer)\n        Return MyBase.HandleParamValue(x)\n    End Function\n\n    Public Overrides Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        If batchTimeout < 0 Then batchTimeout = CommandTimeout\n        If Me.HasTransaction Then\n            Return OracleArrayParam(dataReader, destinationTable, columnMap, batchSize, batchTimeout, notify)\n        Else\n            Return OracleBulkCopy(dataReader, destinationTable, columnMap, batchSize, batchTimeout, notify)\n        End If\n    End Function\n\n    Private Function OracleBulkCopy(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        Using dataReader\n            Using bcp As New OracleBulkCopy(Me.Connection) With {.BatchSize = batchSize, .BulkCopyTimeout = batchTimeout, .DestinationTableName = destinationTable}\n                GenerateSchemaMap(dataReader, columnMap).ForEach(Sub(x) bcp.ColumnMappings.Add(x.SourceName, x.DestinationName))\n\n                bcp.NotifyAfter = 1\n                Dim rowsCopied As Long = 0\n                AddHandler bcp.OracleRowsCopied, Sub(sender As Object, e As OracleRowsCopiedEventArgs)\n                                                     rowsCopied += 1\n                                                     If rowsCopied Mod batchSize = 0 AndAlso notify IsNot Nothing Then\n                                                         notify.Invoke(rowsCopied)\n                                                     End If\n                                                 End Sub\n                bcp.WriteToServer(dataReader)\n                Return rowsCopied\n            End Using\n        End Using\n    End Function\n    Private Function OracleArrayParam(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        Dim batchIteration As Long = 0\n        Dim schemaMap = GenerateSchemaMap(dataReader, columnMap)\n        Dim destColNames = \"\"\"\" + String.Join(\"\"\", \"\"\", schemaMap.Select(Function(x) x.DestinationName)) + \"\"\"\"\n        Dim paramNames = \":Param\" + String.Join(\", :Param\", schemaMap.Select(Function(x) x.Ordinal.ToString))\n\n        Using dataReader\n            Using bulkcmd As OracleCommand = GetCommand($\"INSERT INTO {destinationTable} ({destColNames}) VALUES ({paramNames})\")\n                'adding parameters\n                For Each sm In schemaMap\n                    Dim p As New OracleParameter($\"Param{sm.Ordinal}\", MapOracleType(sm.DataType)) With {.Value = Array.CreateInstance(Type.GetType(sm.DataType), batchSize)}\n                    bulkcmd.Parameters.Add(p)\n                Next\n\n                bulkcmd.ArrayBindCount = batchSize\n                Dim index As Integer = 0\n                While dataReader.Read\n                    batchIteration += 1\n                    For Each sm In schemaMap\n                        index = (batchIteration - 1) Mod batchSize\n                        DirectCast(bulkcmd.Parameters(sm.Ordinal).Value, Array).SetValue(dataReader.GetValue(sm.Ordinal), index)\n                    Next\n\n                    If batchIteration Mod batchSize = 0 Then\n                        bulkcmd.ExecuteNonQuery()\n                        If notify IsNot Nothing Then notify.Invoke(batchIteration)\n                        'schemaMap.ForEach(Sub(sm) bulkcmd.Parameters(sm.Ordinal).Value = Array.CreateInstance(Type.GetType(sm.DataType), batchSize))\n                        schemaMap.ForEach(Sub(sm) DirectCast(bulkcmd.Parameters(sm.Ordinal).Value, Array).Initialize())\n                    End If\n                End While\n\n                Dim remaining = batchIteration Mod batchSize\n                If remaining > 0 Then\n                    bulkcmd.ArrayBindCount = remaining\n                    bulkcmd.ExecuteNonQuery()\n                    If notify IsNot Nothing Then notify.Invoke(batchIteration)\n                End If\n                Return batchIteration\n            End Using\n        End Using\n    End Function\n\n    Private Sub HandleInfoMessage(sender As Object, e As OracleInfoMessageEventArgs)\n        Me.Messages.Enqueue(New SqlMessage(e.Message))\n    End Sub\n#Region \"Shared\"\n    Private Shared Function MapOracleType(netType As String) As OracleDbType\n        'FROM: https://docs.oracle.com/en/database/oracle///oracle-database/23/odpnt/featOraCommand.html#GUID-BBEF52D9-E4E3-4A9C-93F5-3E408A83FC04\n        Select Case netType.ToLower\n            Case \"system.boolean\"\n                Return OracleDbType.Boolean\n            Case \"system.byte\"\n                Return OracleDbType.Byte\n            Case \"system.byte[]\"\n                Return OracleDbType.Raw\n            Case \"system.datetime\"\n                Return OracleDbType.TimeStamp\n            Case \"system.datetimeoffset\"\n                Return OracleDbType.TimeStampTZ\n            Case \"system.decimal\"\n                Return OracleDbType.Decimal\n            Case \"system.double\"\n                Return OracleDbType.Double\n            Case \"system.float\", \"system.single\"\n                Return OracleDbType.Single\n            Case \"system.guid\"\n                Return OracleDbType.Blob\n            Case \"system.int16\"\n                Return OracleDbType.Int16\n            Case \"system.int32\"\n                Return OracleDbType.Int32\n            Case \"system.int64\"\n                Return OracleDbType.Int64\n            Case \"system.timespan\"\n                Return OracleDbType.IntervalDS\n            Case Else\n                Return OracleDbType.Varchar2\n        End Select\n    End Function\n    Shared Sub New()\n        OracleConfiguration.BindByName = True 'otherwise oracle commands will bind parameters by position\n    End Sub\n    Public Shared Function Create(connDetail As ConnectionOracle) As OracleProvider\n        Dim sb As OracleConnectionStringBuilder\n        Dim conn As OracleConnection\n        If connDetail.HasConnectionString Then\n            sb = New OracleConnectionStringBuilder(connDetail.ConnectionString)\n        Else\n            sb = New OracleConnectionStringBuilder()\n            If connDetail.HasTnsName Then\n                sb.DataSource = connDetail.TnsName\n            Else\n                sb.DataSource = $\"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST={connDetail.Host})(PORT={connDetail.Port}))(CONNECT_DATA=(SERVICE_NAME={connDetail.ServiceName})))\"\n            End If\n\n            'Process additional parameters through the hashtable\n            sb.AddHashtable(connDetail.Additional)\n        End If\n\n        If connDetail.Credential IsNot Nothing Then\n            Dim sp = connDetail.SecurePassword\n            sp.MakeReadOnly()\n            conn = New OracleConnection(sb.ConnectionString, New OracleCredential(connDetail.UserName, sp, ConvertToOracleDBAPrivilege(connDetail.Privilege)))\n        Else\n            If (sb.UserID = \"/\" Or String.IsNullOrWhiteSpace(sb.UserID)) Then\n                sb.UserID = \"/\"\n                If Not connDetail.Privilege.Equals(\"None\", StringComparison.OrdinalIgnoreCase) Then sb.DBAPrivilege = connDetail.Privilege\n            End If\n            conn = New OracleConnection(sb.ConnectionString)\n        End If\n\n        Return New OracleProvider(connDetail.ConnectionName, connDetail.CommandTimeout, conn, connDetail.Privilege)\n    End Function\n    Private Shared Function ConvertToOracleDBAPrivilege(priv As String) As OracleDBAPrivilege\n        Return [Enum].Parse(GetType(OracleDBAPrivilege), priv)\n    End Function\n#End Region\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/PostGre/ConnectionPostGre.vb",
    "content": "﻿Imports System.Net\n\nPublic Class ConnectionPostGre\n    Inherits baseConnectionDetail\n    Public Property Host As String\n    Public Property Port As Integer\n    Public Property Database As String\n    Public Property SslMode As String = \"\"\n    Public Property MaxAutoPrepare As Integer\n\n    Sub New(connName As String, cmdTimeout As Integer)\n        MyBase.New(connName, ProviderTypes.PostGre, cmdTimeout)\n        SetAuthIntegrated()\n    End Sub\n\n    Sub SetAuthCredential(cred As NetworkCredential)\n        Me.UseIntegratedSecurity = False\n        Me.Credential = cred\n    End Sub\n    Sub SetAuthIntegrated()\n        Me.UseIntegratedSecurity = True\n    End Sub\nEnd Class"
  },
  {
    "path": "source/SimplySql.Engine/PostGre/PostGreProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nImports System.Data.Common\nImports System.Runtime.CompilerServices\nImports System.Security.Cryptography\nImports NetTopologySuite.Geometries\nImports Npgsql\n\nPublic Class PostGreProvider\n    Inherits ProviderBase\n\n    Public Overloads ReadOnly Property Connection As NpgsqlConnection\n        Get\n            Return DirectCast(MyBase.Connection, NpgsqlConnection)\n        End Get\n    End Property\n\n    Private Sub New(connectionName As String, commandTimeout As Integer, connection As NpgsqlConnection)\n        MyBase.New(connectionName, ProviderTypes.PostGre, connection, commandTimeout)\n\n        AddHandler Me.Connection.Notice, AddressOf HandleNoticeMessage\n    End Sub\n\n    Public Overrides Function ConnectionInfo() As OrderedDictionary\n        Dim od = MyBase.ConnectionInfo\n        With od\n            .Add(\"ServerVersion\", Connection.ServerVersion)\n            .Add(\"Host\", Connection.Host)\n            .Add(\"Port\", Connection.Port)\n            .Add(\"Database\", Connection.Database)\n            .Add(\"User\", Connection.UserName)\n        End With\n        Return od\n    End Function\n\n    Public Overrides Sub ChangeDatabase(databaseName As String)\n        Connection.ChangeDatabase(databaseName)\n    End Sub\n\n    Public Overrides Function GetDataset(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As DataSet\n        If Not useProviderTypes Then\n            Return MyBase.GetDataset(query, cmdTimeout, params, False)\n        Else\n            Using cmd As NpgsqlCommand = GetCommand(query, cmdTimeout, params)\n                Using da As New NpgsqlDataAdapter(cmd)\n                    Dim ds As New Data.DataSet\n                    da.ReturnProviderSpecificTypes = True\n                    Try\n                        da.Fill(ds)\n                        Return ds\n                    Catch ex As Exception\n                        ex.AddQueryDetails(query, params)\n                        Throw\n                    End Try\n                End Using\n            End Using\n        End If\n    End Function\n\n    Public Overrides Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Long)) As Long\n        Dim iteration As Long = 0\n        Using dataReader\n            Dim schemaMap = GenerateSchemaMap(dataReader, columnMap)\n\n            Dim copyFromSql As String = $\"COPY {destinationTable} ({String.Join(\", \", schemaMap.Select(Function(x) x.DestinationName))}) FROM STDIN (FORMAT BINARY)\"\n            Using bulk = Connection.BeginBinaryImport(copyFromSql)\n                While dataReader.Read()\n                    iteration += 1\n                    bulk.StartRow()\n                    For Each field In schemaMap\n                        If dataReader.IsDBNull(field.Ordinal) Then\n                            bulk.WriteNull()\n                        Else\n                            bulk.Write(dataReader.GetValue(field.Ordinal))\n                        End If\n                    Next\n\n                    If iteration Mod batchSize = 0 AndAlso notify IsNot Nothing Then\n                        notify.Invoke(iteration)\n                    End If\n                End While\n                If notify IsNot Nothing Then notify.Invoke(iteration)\n                Return bulk.Complete()\n            End Using\n        End Using\n    End Function\n\n    Public Overrides Function HandleParamValue(x As Object) As Object\n        If x.GetType().IsEnum Then x = DirectCast(x, Integer)\n        Return MyBase.HandleParamValue(x)\n    End Function\n\n    Private Sub HandleNoticeMessage(sender As Object, e As NpgsqlNoticeEventArgs)\n        Me.Messages.Enqueue(New SqlMessage(e.Notice.MessageText))\n    End Sub\n\n#Region \"Shared Functions\"\n    Public Shared Function Create(connDetail As ConnectionPostGre) As PostGreProvider\n        Dim sb As NpgsqlConnectionStringBuilder\n        If connDetail.HasConnectionString Then\n            sb = New NpgsqlConnectionStringBuilder(connDetail.ConnectionString)\n        Else\n            sb = New NpgsqlConnectionStringBuilder() With {\n                    .ApplicationName = connDetail.ApplicationName,\n                    .Host = connDetail.Host,\n                    .Port = connDetail.Port,\n                    .Database = connDetail.Database,\n                    .MaxAutoPrepare = connDetail.MaxAutoPrepare,\n                    .SslMode = MapSslMode(connDetail.SslMode)\n                }\n\n            'Process additional parameters through the hashtable\n            sb.AddHashtable(connDetail.Additional)\n        End If\n\n        If connDetail.Credential IsNot Nothing Then\n            sb.Username = connDetail.UserName\n            sb.Password = connDetail.Password\n        End If\n\n        Dim dsBuilder As New NpgsqlDataSourceBuilder(sb.ToString)\n        dsBuilder.UseNetTopologySuite()\n\n        Return New PostGreProvider(connDetail.ConnectionName, connDetail.CommandTimeout, dsBuilder.Build.CreateConnection())\n    End Function\n    Private Shared Function MapSslMode(ssl As String) As SslMode\n        Return [Enum].Parse(GetType(SslMode), ssl)\n    End Function\n#End Region\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/ProviderBase.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data\nImports System.Data.Common\nImports System.Threading\n\nPublic MustInherit Class ProviderBase\n    Implements ISimplySqlProvider\n    Public ReadOnly Property ConnectionName As String Implements ISimplySqlProvider.ConnectionName\n\n    Private _providerType As Engine.ProviderTypes\n    Public ReadOnly Property ProviderType As String Implements ISimplySqlProvider.ProviderName\n        Get\n            Return _providerType.ToString()\n        End Get\n    End Property\n\n    Public ReadOnly Property Connection As IDbConnection Implements ISimplySqlProvider.Connection\n    Public Property CommandTimeout As Integer = 30 Implements ISimplySqlProvider.CommandTimeout\n    Public Sub New(connName As String, providerType As Engine.ProviderTypes, conn As IDbConnection, timeout As Integer)\n        ConnectionName = connName\n        _providerType = providerType\n        Connection = conn\n        CommandTimeout = timeout\n        'conn.Open()\n    End Sub\n\n#Region \"Overrides\"\n    Public Overridable Function ConnectionInfo() As OrderedDictionary Implements ISimplySqlProvider.ConnectionInfo\n        Dim od As New OrderedDictionary\n        With od\n            .Add(\"ConnectionName\", ConnectionName)\n            .Add(\"ProviderType\", ProviderType)\n            .Add(\"ConnectionState\", Connection.State)\n            .Add(\"ConnectionString\", Connection.ConnectionString)\n            .Add(\"CommandTimeout\", CommandTimeout)\n            .Add(\"HasTransaction\", HasTransaction)\n        End With\n        Return od\n    End Function\n    Public MustOverride Sub ChangeDatabase(databaseName As String) Implements ISimplySqlProvider.ChangeDatabase\n\n    Public Overridable Function HandleParamValue(x As Object) As Object\n        If TypeOf x Is System.Management.Automation.PSObject Then x = DirectCast(x, System.Management.Automation.PSObject).BaseObject\n        Return If(x, DBNull.Value)\n    End Function\n#End Region\n\n#Region \"Concrete\"\n    Public Sub AttachCommand(cmd As IDbCommand)\n        cmd.Connection = Me.Connection\n        If Me.HasTransaction Then cmd.Transaction = Me.Transaction\n    End Sub\n\n#Region \"GetCommand\"\n    Public Overridable Function GetCommand(query As String, timeout As Integer, params As Hashtable) As IDbCommand Implements ISimplySqlProvider.GetCommand\n        Dim cmd As IDbCommand = Me.Connection.CreateCommand()\n        cmd.CommandText = query\n        cmd.CommandTimeout = If(timeout < 0, Me.CommandTimeout, timeout)\n        If Me.HasTransaction Then cmd.Transaction = Me.Transaction\n\n        If params IsNot Nothing Then\n            For Each de As DictionaryEntry In params\n                Dim param As IDbDataParameter = cmd.CreateParameter()\n                param.ParameterName = de.Key\n                param.Value = HandleParamValue(de.Value)\n                cmd.Parameters.Add(param)\n            Next\n        End If\n\n        Return cmd\n    End Function\n    Public Function GetCommand(query As String, Optional params As Hashtable = Nothing) As IDbCommand\n        Return Me.GetCommand(query, Me.CommandTimeout, params)\n    End Function\n#End Region\n\n#Region \"GetScalar\"\n    Public Overridable Function GetScalar(query As String, timeout As Integer, params As Hashtable) As Object Implements ISimplySqlProvider.GetScalar\n        Using cmd As IDbCommand = GetCommand(query, timeout, params)\n            Try\n                Return cmd.ExecuteScalar()\n            Catch ex As Exception\n                ex.AddQueryDetails(query, params)\n                Throw\n            End Try\n        End Using\n    End Function\n    Public Function GetScalar(query As String, timeout As Integer) As Object\n        Return Me.GetScalar(query, timeout, Nothing)\n    End Function\n#End Region\n\n#Region \"GetDataSet\"\n    Public Overridable Function GetDataset(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As DataSet Implements ISimplySqlProvider.GetDataSet\n        If useProviderTypes Then Throw New NotSupportedException($\"{ProviderType} does not support -UseTypesFromProvider.\")\n        Using cmd As IDbCommand = GetCommand(query, cmdTimeout, params)\n            Try\n                Dim ds As New DataSet\n                Using dr As IDataReader = cmd.ExecuteReader\n                    Do\n                        Dim dt As New DataTable\n                        Dim nameList As New Dictionary(Of String, Integer)\n                        For i As Integer = 0 To dr.FieldCount - 1\n                            Dim n As String = dr.GetName(i)\n                            Dim ni As Integer = 0\n                            If nameList.TryGetValue(n, ni) Then\n                                nameList(n) += 1\n                                n += ni.ToString\n                            Else\n                                nameList.Add(n, 1)\n                            End If\n                            dt.Columns.Add(n, dr.GetFieldType(i))\n                        Next\n\n                        ' Read data and add rows\n                        While dr.Read()\n                            Dim row As DataRow = dt.NewRow()\n                            For i As Integer = 0 To dr.FieldCount - 1\n                                row(i) = dr(i)\n                            Next\n                            dt.Rows.Add(row)\n                        End While\n                        If dt.Rows.Count > 0 Then ds.Tables.Add(dt)\n                    Loop While Not dr.IsClosed AndAlso dr.NextResult()\n                End Using\n                Return ds\n            Catch ex As Exception\n                ex.AddQueryDetails(query, params)\n                Throw\n            End Try\n        End Using\n    End Function\n#End Region\n\n#Region \"GetReader\"\n    Public Overridable Function GetReader(query As String, params As Hashtable, Optional timeout As Integer = -1) As IDataReader Implements ISimplySqlProvider.GetDataReader\n        Using cmd As IDbCommand = Me.GetCommand(query, timeout, params)\n            Try\n                Return cmd.ExecuteReader()\n            Catch ex As Exception\n                ex.AddQueryDetails(query, params)\n                Throw\n            End Try\n        End Using\n    End Function\n#End Region\n\n#Region \"Update\"\n    Public Overridable Function Update(cmd As IDbCommand) As Int64 Implements ISimplySqlProvider.Update\n        If cmd.Transaction Is Nothing AndAlso HasTransaction Then cmd.Transaction = Transaction\n        Try\n            Return cmd.ExecuteNonQuery()\n        Catch ex As Exception\n            ex.AddQueryDetails(cmd.CommandText, cmd.Parameters)\n            Throw\n        End Try\n    End Function\n    Public Overridable Function Update(query As String, timeout As Integer, params As Hashtable) As Int64 Implements ISimplySqlProvider.Update\n        Using cmd As IDbCommand = Me.GetCommand(query, timeout, params)\n            Return Update(cmd)\n        End Using\n    End Function\n#End Region\n\n#Region \"BulkLoad\"\n    Public Overridable Function BulkLoad(dataReader As IDataReader, destinationTable As String, columnMap As Dictionary(Of String, String), batchSize As Integer, batchTimeout As Integer, notify As Action(Of Int64)) As Int64 Implements ISimplySqlProvider.BulkLoad\n        If batchTimeout < 0 Then batchTimeout = CommandTimeout\n        Dim batchIteration As Int64 = 0\n        Dim ord As Integer = 0\n        Dim hasPrepared As Boolean = False\n\n        Dim schemaMap = GenerateSchemaMap(dataReader, columnMap)\n        Dim insertSql As String = String.Format(\"INSERT INTO {0} ([{1}]) VALUES (@Param{2})\", destinationTable,\n                                                String.Join(\"], [\", schemaMap.Select(Function(x) x.DestinationName)),\n                                                String.Join(\", @Param\", schemaMap.Select(Function(x) x.Ordinal))\n                                                )\n        Dim sw = Stopwatch.StartNew()\n        Using bulkCmd = Me.GetCommand(insertSql)\n            Using dataReader\n                bulkCmd.Transaction = Me.Connection.BeginTransaction\n                Try\n                    While dataReader.Read()\n                        If Not hasPrepared Then\n                            schemaMap.ForEach(Sub(x)\n                                                  Dim param = bulkCmd.CreateParameter()\n                                                  param.ParameterName = String.Format(\"Param{0}\", x.Ordinal)\n                                                  param.Value = dataReader.GetValue(x.Ordinal)\n                                                  bulkCmd.Parameters.Add(param)\n                                              End Sub)\n                            bulkCmd.Prepare()\n                            hasPrepared = True\n                        Else\n                            schemaMap.ForEach(Sub(x) DirectCast(bulkCmd.Parameters(x.Ordinal), IDataParameter).Value = dataReader.GetValue(x.Ordinal))\n                        End If\n                        batchIteration += 1\n                        bulkCmd.ExecuteNonQuery()\n\n                        If sw.Elapsed.TotalSeconds > batchTimeout Then\n                            Dim ex As New TimeoutException(String.Format(\"Batch took longer than {0} seconds to complete.\", batchTimeout))\n                            ex.AddQueryDetails(insertSql, bulkCmd.Parameters)\n                            Throw ex\n                        End If\n\n                        If batchIteration Mod batchSize = 0 Then\n                            bulkCmd.Transaction.Commit()\n                            bulkCmd.Transaction.Dispose()\n                            If notify IsNot Nothing Then notify.Invoke(batchIteration)\n                            bulkCmd.Transaction = Me.Connection.BeginTransaction()\n                            sw.Restart()\n                        End If\n                    End While\n\n                    bulkCmd.Transaction.Commit()\n                Catch ex As Exception\n                    ex.AddQueryDetails(insertSql, bulkCmd.Parameters)\n                    Throw\n                Finally\n                    If bulkCmd.Transaction IsNot Nothing Then bulkCmd.Transaction.Dispose()\n                End Try\n            End Using\n        End Using\n        If notify IsNot Nothing Then notify.Invoke(batchIteration)\n        Return batchIteration\n    End Function\n\n    Friend Shared Function GenerateSchemaMap(dr As IDataReader, columnMap As Dictionary(Of String, String)) As List(Of SchemaMapItem)\n        Dim schemaMap As New List(Of SchemaMapItem)\n        Dim ord As Integer = 0\n        For Each row In dr.GetSchemaTable().Select().OrderBy(Function(x) x(\"ColumnOrdinal\"))\n            Dim smi = New SchemaMapItem With {.Ordinal = ord}\n            smi.SourceName = row(\"ColumnName\")\n            smi.DestinationName = row(\"ColumnName\")\n            smi.DataType = row(\"DataType\").ToString\n\n            schemaMap.Add(smi)\n            ord += 1\n        Next\n\n        If columnMap Is Nothing OrElse columnMap.Count = 0 Then\n            Return schemaMap\n        Else\n            Return schemaMap.Where(Function(x) columnMap.ContainsKey(x.SourceName)).Select(Function(x) New SchemaMapItem With {.Ordinal = x.Ordinal, .SourceName = x.SourceName, .DestinationName = columnMap.Item(x.SourceName)}).ToList\n        End If\n    End Function\n#End Region\n\n#Region \"Messages\"\n    Public ReadOnly Property Messages As New Queue(Of SqlMessage) Implements ISimplySqlProvider.Messages\n    Public Overridable Function GetMessage() As SqlMessage Implements ISimplySqlProvider.GetMessage\n        Return Me.Messages.Dequeue()\n    End Function\n\n    Public Overridable Sub ClearMessages() Implements ISimplySqlProvider.ClearMessages\n        Me.Messages.Clear()\n    End Sub\n\n    Public Overridable ReadOnly Property HasMessages() As Boolean Implements ISimplySqlProvider.HasMessages\n        Get\n            Return Me.Messages.Count > 0\n        End Get\n    End Property\n#End Region\n\n#Region \"Transactions\"\n    Public Property Transaction As IDbTransaction Implements ISimplySqlProvider.Transaction\n    Public ReadOnly Property HasTransaction As Boolean Implements ISimplySqlProvider.HasTransaction\n        Get\n            Return Me.Transaction IsNot Nothing\n        End Get\n    End Property\n    Sub BeginTransaction() Implements ISimplySqlProvider.BeginTransaction\n        If Me.HasTransaction Then Throw New InvalidOperationException(\"Cannot BEGIN a transaction when one is already in progress.\")\n        Me.Transaction = Me.Connection.BeginTransaction()\n    End Sub\n    Sub RollbackTransaction() Implements ISimplySqlProvider.RollbackTransaction\n        If Me.HasTransaction Then\n            Try\n                Me.Transaction.Rollback()\n            Finally\n                Me.Transaction.Dispose()\n                Me.Transaction = Nothing\n            End Try\n        Else\n            Throw New InvalidOperationException(\"Cannot ROLLBACK when there is no transaction in progress.\")\n        End If\n    End Sub\n\n    Sub CommitTransaction() Implements ISimplySqlProvider.CommitTransaction\n        If Me.HasTransaction Then\n            Try\n                Me.Transaction.Commit()\n            Finally\n                Me.Transaction.Dispose()\n                Me.Transaction = Nothing\n            End Try\n        Else\n            Throw New InvalidOperationException(\"Cannot COMMIT when there is no transaction in progress.\")\n        End If\n    End Sub\n#End Region\n#End Region\n\n    Friend Structure SchemaMapItem\n        Public Ordinal As Integer\n        Public SourceName As String\n        Public DestinationName As String\n        Public DataType As String\n    End Structure\nEnd Class\n\nPublic Enum ProviderTypes\n    PostGre\n    Oracle\n    MySql\n    MSSQL\n    SQLite\nEnd Enum"
  },
  {
    "path": "source/SimplySql.Engine/SQLite/ConnectionSQLite.vb",
    "content": "﻿Public Class ConnectionSQLite\n    Inherits baseConnectionDetail\n    Public Property Database As String\n\n    Sub New(connName As String, cmdTimeout As Integer)\n        MyBase.New(connName, ProviderTypes.SQLite, cmdTimeout)\n        Me.UseIntegratedSecurity = False\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/SQLite/SQLiteProvider.vb",
    "content": "﻿Imports System.Collections.Specialized\nImports System.Data.SQLite\n\nPublic Class SQLiteProvider\n    Inherits ProviderBase\n    Public Overloads ReadOnly Property Connection As SQLiteConnection\n        Get\n            Return DirectCast(MyBase.Connection, SQLiteConnection)\n        End Get\n    End Property\n\n    Private Sub New(connectionName As String, commandTimeout As Integer, connection As SQLiteConnection)\n        MyBase.New(connectionName, ProviderTypes.SQLite, connection, commandTimeout)\n    End Sub\n\n    Public Overrides Function ConnectionInfo() As OrderedDictionary\n        Dim od = MyBase.ConnectionInfo\n        od.Add(\"ServerVersion\", Connection.ServerVersion)\n        od.Add(\"DataSource\", Connection.DataSource)\n        Return od\n    End Function\n\n    Public Overrides Function GetDataSet(query As String, cmdTimeout As Integer, params As Hashtable, useProviderTypes As Boolean) As Data.DataSet\n        If Not useProviderTypes Then\n            Return MyBase.GetDataset(query, cmdTimeout, params, False)\n        Else\n            Using cmd As SQLiteCommand = GetCommand(query, cmdTimeout, params)\n                Using da As New SQLiteDataAdapter(cmd)\n                    Dim ds As New Data.DataSet\n                    da.ReturnProviderSpecificTypes = True\n                    Try\n                        da.Fill(ds)\n                        Return ds\n                    Catch ex As Exception\n                        ex.AddQueryDetails(query, params)\n                        Throw\n                    End Try\n                End Using\n            End Using\n        End If\n    End Function\n\n#Region \"Not Supported\"\n    Public Overrides Sub ChangeDatabase(databaseName As String)\n        Throw New NotSupportedException($\"{NameOf(SQLiteProvider)} does not support databases, cannot change to {databaseName}.\")\n    End Sub\n\n    Public Overrides Function GetMessage() As SqlMessage\n        Throw New NotSupportedException($\"{NameOf(SQLiteProvider)} does not support SqlMessages.\")\n    End Function\n\n    Public Overrides Sub ClearMessages()\n        Throw New NotSupportedException($\"{NameOf(SQLiteProvider)} does not support SqlMessages.\")\n    End Sub\n    Public Overrides ReadOnly Property HasMessages As Boolean\n        Get\n            Throw New NotSupportedException($\"{NameOf(SQLiteProvider)} does not support SqlMessages.\")\n        End Get\n    End Property\n#End Region\n\n#Region \"Shared Functions\"\n    Public Shared Function Create(connDetail As ConnectionSQLite) As SQLiteProvider\n        Dim connString As String\n        If connDetail.HasConnectionString Then\n            connString = connDetail.ConnectionString\n        Else\n            Dim sb As New SQLiteConnectionStringBuilder\n            If Not connDetail.Database.Equals(\":memory:\", StringComparison.OrdinalIgnoreCase) Then\n                Dim filepath = New IO.FileInfo(connDetail.Database)\n                If Not filepath.Directory.Exists Then filepath.Directory.Create()\n            End If\n\n            sb.DataSource = connDetail.Database\n\n            If Not String.IsNullOrWhiteSpace(connDetail.Password) Then sb.Password = connDetail.Password\n\n            'Process additional parameters through the hashtable\n            sb.AddHashtable(connDetail.Additional)\n            connString = sb.ToString\n        End If\n\n        Return New SQLiteProvider(connDetail.ConnectionName, connDetail.CommandTimeout, New SQLiteConnection(connString))\n    End Function\n#End Region\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/SimplySql.Engine.vbproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n\n  <PropertyGroup>\n    <RootNamespace>SimplySql.Engine</RootNamespace>\n    <TargetFrameworks>netstandard2.0;net47;net6.0</TargetFrameworks>\n    <Version>2.0.0</Version>\n    <RunAnalyzersDuringLiveAnalysis>False</RunAnalyzersDuringLiveAnalysis>\n    <EnableNETAnalyzers>True</EnableNETAnalyzers>\n    <AnalysisLevel>latest-minimum</AnalysisLevel>\n    <ImportedNamespaces>Microsoft.VisualBasic=True,System=True,System.Collections=True,System.Collections.Generic=True,System.Diagnostics=True,System.Linq=True,System.Xml.Linq=True,System.Threading.Tasks=True,SimplySql.Engine=True</ImportedNamespaces>\n  </PropertyGroup>\n\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Release|AnyCPU'\">\n    <DefineDebug>False</DefineDebug>\n  </PropertyGroup>\n\n  <PropertyGroup Condition=\"'$(Configuration)|$(Platform)'=='Debug|AnyCPU'\">\n    <DefineDebug>True</DefineDebug>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <PackageReference Include=\"Azure.Identity\" Version=\"1.13.1\" />\n    <PackageReference Include=\"Microsoft.Data.SqlClient\" Version=\"5.2.2\" />\n    <PackageReference Include=\"MySqlConnector\" Version=\"2.4.0\" />\n    <PackageReference Include=\"Npgsql\" Version=\"8.0.6\" />\n    <PackageReference Include=\"Npgsql.NetTopologySuite\" Version=\"8.0.6\" />\n    <PackageReference Include=\"Oracle.ManagedDataAccess.Core\" Version=\"2.19.250\" />\n    <PackageReference Include=\"PowerShellStandard.Library\" Version=\"5.1.1\" />\n    <PackageReference Include=\"System.Data.DataSetExtensions\" Version=\"4.5.0\" />\n    <PackageReference Include=\"System.Data.SQLite.Core\" Version=\"1.0.119\" />\n    <PackageReference Include=\"System.Formats.Asn1\" Version=\"8.0.1\" />\n    <PackageReference Include=\"System.Text.Json\" Version=\"8.0.5\" />\n  </ItemGroup>\n\n</Project>\n"
  },
  {
    "path": "source/SimplySql.Engine/SqlMessage.vb",
    "content": "Public Class SqlMessage\n    Public ReadOnly Property Received As DateTime\n    Public ReadOnly Property Message As String\n\n    Public Sub New(_message As String, Optional _received As DateTime? = Nothing)\n        If _received Is Nothing Then _received = DateTime.Now\n        Received = _received\n        Message = _message\n    End Sub\nEnd Class\n"
  },
  {
    "path": "source/SimplySql.Engine/ValidateConnectionResult.vb",
    "content": "﻿Public Enum ValidateConnectionResult\n\tNotFound\n\tFound\n\tNotOpen\n\tOpen\nEnd Enum\n"
  },
  {
    "path": "source/SimplySql.Engine/baseConnectionDetail.vb",
    "content": "﻿Imports System.Net\nImports System.Security\nImports System.Security.Cryptography\n\nPublic Class baseConnectionDetail\n    Public ReadOnly Property ConnectionName As String\n    Public ReadOnly Property ConnectionType As ProviderTypes\n    Public ReadOnly Property UserName As String\n        Get\n            Return Credential?.UserName\n        End Get\n    End Property\n    Public ReadOnly Property Password As String\n        Get\n            Return Credential?.Password\n        End Get\n    End Property\n    Public ReadOnly Property SecurePassword As SecureString\n        Get\n            Return Credential?.SecurePassword\n        End Get\n    End Property\n    Public ReadOnly Property HasConnectionString As Boolean\n        Get\n            Return Not String.IsNullOrWhiteSpace(ConnectionString)\n        End Get\n    End Property\n\n    Public Property Credential As NetworkCredential\n    Public Property UseIntegratedSecurity As Boolean\n    Public Property ConnectionString As String\n    Public ReadOnly Property CommandTimeout As Integer\n    Public Property Additional As Hashtable\n\n    Sub New(connName As String, conntype As ProviderTypes, cmdTimeout As Integer)\n        Me.ConnectionName = connName\n        Me.ConnectionType = conntype\n        Me.CommandTimeout = cmdTimeout\n    End Sub\n\n    Public Function ApplicationName() As String\n        Return $\"PowerShell (SimplySql: {ConnectionName})\"\n    End Function\nEnd Class"
  },
  {
    "path": "source/source.build.ps1",
    "content": "param([version]$Version = \"2.0.0\", [switch]$DebugOnly, [switch]$SkipDedup)\n\nif(-not [bool](Get-ChildItem alias:\\).where({$_.name -eq \"hv\"})) {\n    New-Alias -Name HV -Value (Resolve-Path ..\\HandleVerbose.ps1)\n}\n#$Script:envList = @($env)\n$Script:envList = @(\n    [PSCustomObject]@{framework=\"net47\"; env=\"win-x86\"; output=\"output\\bin\\PS5\\win-x86\"}\n    [PSCustomObject]@{framework=\"net47\"; env=\"win-x64\"; output=\"output\\bin\\PS5\\win-x64\"}\n    [PSCustomObject]@{framework=\"net6.0\"; env=\"win-x64\"; output=\"output\\bin\\PS7\\win-x64\"}\n    [PSCustomObject]@{framework=\"net6.0\"; env=\"linux-x64\"; output=\"output\\bin\\PS7\\linux-x64\"}\n    [PSCustomObject]@{framework=\"net6.0\"; env=\"osx-x64\"; output=\"output\\bin\\PS7\\osx-x64\"}\n    [PSCustomObject]@{framework=\"net6.0\"; env=\"osx-arm64\";   output=\"output\\bin\\PS7\\osx-arm64\"}\n)\nif($DebugOnly){\n    $Script:envList = $Script:envList | Where-Object env -eq \"win-x64\"\n    if($PSEdition -eq \"core\") {\n        if($DebugOnly) { $Script:envList = $Script:envList | Where-Object framework -eq \"net6.0\" }\n        else { $Script:envList = $Script:envList | Where-Object framework -eq \"net47\" }\n    }\n}\n\n\nfunction dedup([string]$Path) {\n    Write-Host \"  DeDuplicate: $Path\"\n    [string[]]$list = Get-ChildItem -Path $Path -Name -Directory |\n        ForEach-Object { Join-Path $Path $_ }\n    if($list.Count -eq 1) {\n        Move-Item -Path (Join-Path $list[0] -ChildPath \"*\") -Destination $path\n        Remove-Item $list[0]\n    } elseif($list.count -gt 1) {\n        $safeFiles = @{}\n        $first = $list[0]\n        Write-Host \"  --$($first | Split-Path -Leaf)\" -NoNewline\n        Get-ChildItem -Path $first -File |\n            Where-Object Name -ne \"System.Data.SQLite.dll\" | #always exclude this SQLite dll because of native interop binding\n            Where-Object Name -ne \"SQLite.Interop.dll\" | #always exclude this SQLite dll because of native interop binding\n            Get-FileHash |\n            ForEach-Object {\n                $name = $_.Path | Split-Path -Leaf\n                $safeFiles[$name] = $_.Hash\n                Write-Host \".\" -NoNewline\n            }\n        Write-Host \"!\"\n        \n        #run Dedup\n        foreach($second in $list | Select-Object -Skip 1) {\n            Write-Host \"  --$($second | Split-Path -Leaf)\" -NoNewline\n            $retain = $safeFiles.Keys |\n                Where-Object { Test-Path (Join-Path $second $_) } |\n                Where-Object { $safeFiles[$_] -eq (Get-FileHash (Join-Path $second $_)).Hash }\n            \n            $toRemove = $safeFiles.Keys | Where-Object {$_ -notin $retain}\n            $toRemove | ForEach-Object {\n                $safeFiles.remove($_)\n                Write-Host \".\" -NoNewline\n            }\n            Write-Host \"!\"        \n        }\n\n        #cleanup\n        foreach($file in $safeFiles.Keys) {\n            Move-Item \"$first\\$file\" \"$path\"\n            foreach($second in $list | Select-Object -Skip 1) {\n                $f = Join-Path $second $file\n                if(Test-Path $f) { Remove-Item $f }\n            }\n        }\n        \n        $list |\n            Where-Object { @(Get-ChildItem $_).Count -eq 0 } |\n            Remove-Item # remove empty folders\n    }\n}\n\ntask Clean { remove output }\n\ntask Build {\n    $configuration = \"Release\"\n    if($DebugOnly) { $configuration = \"debug\"}\n    \n    exec { dotnet publish \"SimplySql.Cmdlets\" -c $configuration -o \"output\\bin\" -p:Version=$Version -p:AssemblyVersion=$version} | HV \"Building SimplySql.Cmdlets ($version)\" \".\"\n    \n    Move-Item \"output\\bin\\SimplySql.Cmdlets.*\" -Destination \"output\"\n    Remove-Item \"output\\bin\\*\" -Recurse #-Exclude \"SimplySql.*\" -Recurse\n    if($DebugOnly) {\n        #create folders...\n        New-Item -ItemType Directory -Name \".\\output\\bin\\PS5\\\" | Out-Null\n        New-Item -ItemType Directory -Name \".\\output\\bin\\PS7\\\" | Out-Null\n    }\n\n    foreach($env in $Script:envList) {\n        #exec { dotnet publish \"SimplySql.Cmdlets\" -c $Configuration -r $env -o \"output\\bin\\$env\"} | HV \"Building PlatformSpecific Dependencies $env\" \".\"\n        exec {\n            dotnet publish \"SimplySql.Engine\" -c $configuration -r $env.env -f $env.framework -o $env.output\n        } | HV \"Building PlatformSpecific Dependencies $($env.env) ($($env.framework))\" \".\"\n \n        Get-ChildItem -Path $env.output -Directory | Remove-Item -Recurse\n        #exec { dotnet publish \"SimplySql.Cmdlets\" -c $Configuration -r $env } | HV \"Building PlatformSpecific Dependencies $env\" \".\"\n        #Remove-Item \"output\\bin\\$env\" -Include \"SimplySql.*\" -Recurse\n    }\n    \n    #remove PDB/json\n    Get-ChildItem -Path .\\output\\* -Include \"*.pdb\", \"*.json\" -Recurse | Remove-Item\n\n    #get SQLite Interops...\n    if(-not $DebugOnly -or $PSEdition -eq \"desktop\") {\n        exec { dotnet build \"SimplySql.Engine\" -c $configuration } | HV \"SQLite Interop (PS5)\" \".\"\n        if (Test-Path \".\\output\\bin\\PS5\\win-x86\\\" -PathType Container) {\n            Copy-Item \".\\SimplySql.Engine\\bin\\$configuration\\net47\\x86\\SQLite.Interop.dll\" -Destination \".\\output\\bin\\PS5\\win-x86\"\n        }\n        if (Test-Path \".\\output\\bin\\PS5\\win-x64\\\" -PathType Container) {\n            Copy-Item \".\\SimplySql.Engine\\bin\\$configuration\\net47\\x64\\SQLite.Interop.dll\" -Destination \".\\output\\bin\\PS5\\win-x64\"\n        }\n        Get-ChildItem -Path \".\\SimplySql.Engine\\bin\" -Directory | Remove-Item -Recurse\n    }\n}\n\nTask DeDup {\n    if(-not $DebugOnly) {\n        dedup \".\\output\\bin\\PS5\"\n        dedup \".\\output\\bin\\PS7\"\n        dedup \".\\output\\bin\"\n    }\n}\n\ntask . Clean, Build, DeDup"
  },
  {
    "path": "source/source.sln",
    "content": "﻿\nMicrosoft Visual Studio Solution File, Format Version 12.00\n# Visual Studio Version 17\nVisualStudioVersion = 17.2.32616.157\nMinimumVisualStudioVersion = 10.0.40219.1\nProject(\"{778DAE3C-4631-46EA-AA77-85C1314464D9}\") = \"SimplySql.Cmdlets\", \"SimplySql.Cmdlets\\SimplySql.Cmdlets.vbproj\", \"{3B996E33-6A34-4C80-8200-355F3B039EC3}\"\nEndProject\nProject(\"{778DAE3C-4631-46EA-AA77-85C1314464D9}\") = \"SimplySql.Engine\", \"SimplySql.Engine\\SimplySql.Engine.vbproj\", \"{98B5F33B-7FC0-4F47-9218-728FF177E5E6}\"\nEndProject\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{6FF4B42A-008C-45FE-8117-9860F7CE54E8}\"\n\tProjectSection(SolutionItems) = preProject\n\t\tConstructModule.ps1 = ConstructModule.ps1\n\t\tthoughts.txt = thoughts.txt\n\t\twsl.ps1 = wsl.ps1\n\tEndProjectSection\nEndProject\nGlobal\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\n\t\tDebug|Any CPU = Debug|Any CPU\n\t\tRelease|Any CPU = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\n\t\t{3B996E33-6A34-4C80-8200-355F3B039EC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{3B996E33-6A34-4C80-8200-355F3B039EC3}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{3B996E33-6A34-4C80-8200-355F3B039EC3}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{3B996E33-6A34-4C80-8200-355F3B039EC3}.Release|Any CPU.Build.0 = Release|Any CPU\n\t\t{98B5F33B-7FC0-4F47-9218-728FF177E5E6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\n\t\t{98B5F33B-7FC0-4F47-9218-728FF177E5E6}.Debug|Any CPU.Build.0 = Debug|Any CPU\n\t\t{98B5F33B-7FC0-4F47-9218-728FF177E5E6}.Release|Any CPU.ActiveCfg = Release|Any CPU\n\t\t{98B5F33B-7FC0-4F47-9218-728FF177E5E6}.Release|Any CPU.Build.0 = Release|Any CPU\n\tEndGlobalSection\n\tGlobalSection(SolutionProperties) = preSolution\n\t\tHideSolutionNode = FALSE\n\tEndGlobalSection\n\tGlobalSection(ExtensibilityGlobals) = postSolution\n\t\tSolutionGuid = {540D6EC3-FEA3-4998-B1B2-7619D33571A2}\n\tEndGlobalSection\nEndGlobal\n"
  },
  {
    "path": "source/thoughts.txt",
    "content": "automapper v10 (supports .net standard 2) -- use this for datareader to psobject?\n\nEnumerableToDataReader -- for getting input objects to datareader to be used by bulkCopy\n\n\nTasks\n-Add argumentcompleter to all ConnectionName parameters\n\n\n\nHandling dataReader to PSObject: https://expressiontree-tutorial.net/knowledge-base/19841120/generic-dbdatareader-to-list-t--mapping\n\n\n- https://tyrrrz.me/blog/expression-trees\n- https://www.programmerall.com/article/6642195713/\n- https://expressiontree-tutorial.net/knowledge-base/19841120/generic-dbdatareader-to-list-t--mapping\n"
  },
  {
    "path": "source/wsl.ps1",
    "content": "Invoke-Build -SkipDedup\n\nwsl pwsh"
  }
]