Skip to content

Commit

Permalink
Version 2.1 (mysqlfix + updated providers) (#170)
Browse files Browse the repository at this point in the history
* Enhanced Invoke-SqlBulkCopy to support custom Notifications
* Updated Oracle and MySql for Invoke-SqlBulkCopy change
* Updated Documentation
* Enhanced module to load architecture and environment specific DLLs for each provider
  • Loading branch information
mithrandyr authored Dec 12, 2024
1 parent cbe0f53 commit ca7c715
Show file tree
Hide file tree
Showing 38 changed files with 675 additions and 381 deletions.
4 changes: 2 additions & 2 deletions Docs/Clear-SqlMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Clear-SqlMessage removes all informational messages generated by Invoke-SqlScala

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Clear-SqlMessage
```

{{ Add example description here }}
Clear the message queue for the connection

## PARAMETERS

Expand Down
4 changes: 2 additions & 2 deletions Docs/Close-SqlConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Closes the connection and disposes of the underlying object. This will also rol

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Close-SqlConnection
```

{{ Add example description here }}
Closes the sql connection.

## PARAMETERS

Expand Down
8 changes: 4 additions & 4 deletions Docs/Complete-SqlTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Complete a SQL transaction.
## SYNTAX

```
Complete-SqlTransaction [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Complete-SqlTransaction [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -23,10 +23,10 @@ Complete (COMMIT) a SQL transaction.

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Complete-SqlTransaction
```

{{ Add example description here }}
Commits the SQL transaction

## PARAMETERS

Expand All @@ -39,7 +39,7 @@ Parameter Sets: (All)
Aliases: cn

Required: False
Position: Named
Position: 0
Default value: default
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Expand Down
4 changes: 2 additions & 2 deletions Docs/Get-SqlConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Gets the underlying provider connection object for the current connection or for

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Get-SqlConnection
```

{{ Add example description here }}
Returns the provider-specific Connection object.

## PARAMETERS

Expand Down
4 changes: 2 additions & 2 deletions Docs/Get-SqlMessage.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ SQL Server, if you use Print or Raiserror without the "NoWait", then messages wi

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Get-SqlMessage
```

{{ Add example description here }}
Returns all the messages in the queue.

## PARAMETERS

Expand Down
4 changes: 2 additions & 2 deletions Docs/Get-SqlTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ Gets the underlying provider transaction object for the current connection or fo

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Get-SqlTransaction
```

{{ Add example description here }}
Returns the provider specific transaction object.

## PARAMETERS

Expand Down
38 changes: 21 additions & 17 deletions Docs/Invoke-SqlBulkCopy.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,20 @@ Executes a bulk copy between two connections.

## SYNTAX

### hashtable (Default)
```
Invoke-SqlBulkCopy [-SourceConnectionName <String>] [-DestinationConnectionName <String>]
[-ColumnMap <Hashtable>] [-BatchSize <Int32>] [-BatchTimeout <Int32>] [-Notify] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### table
### table (Default)
```
Invoke-SqlBulkCopy [-SourceConnectionName <String>] [-DestinationConnectionName <String>]
[-DestinationTable <String>] -SourceTable <String> [-ColumnMap <Hashtable>] [-BatchSize <Int32>]
[-BatchTimeout <Int32>] [-Notify] [-WhatIf] [-Confirm] [<CommonParameters>]
[-BatchTimeout <Int32>] [-Notify] [-NotifyAction <System.Action`1[System.Int64]>] [-WhatIf] [-Confirm]
[<CommonParameters>]
```

### query
```
Invoke-SqlBulkCopy [-SourceConnectionName <String>] [-DestinationConnectionName <String>]
-DestinationTable <String> -SourceQuery <String[]> [-SourceParameters <Hashtable>] [-ColumnMap <Hashtable>]
[-BatchSize <Int32>] [-BatchTimeout <Int32>] [-Notify] [-WhatIf] [-Confirm] [<CommonParameters>]
[-BatchSize <Int32>] [-BatchTimeout <Int32>] [-Notify] [-NotifyAction <System.Action`1[System.Int64]>]
[-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
Expand All @@ -47,13 +42,6 @@ Returns number of rows copied.

## EXAMPLES

### Example 1
```powershell
PS C:\> {{ Add example code here }}
```

{{ Add example description here }}

## PARAMETERS

### -BatchSize
Expand Down Expand Up @@ -158,6 +146,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -NotifyAction
Provide a scriptblock to be executed after every BatchSize number of rows are inserted.
Scriptblock will be called with the number of rows inserted so far.
```yaml
Type: System.Action`1[System.Int64]
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -SourceConnectionName
User defined name for connection where data will be queried from.
Expand Down
8 changes: 8 additions & 0 deletions Docs/Invoke-SqlQuery.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ PS C:\> Invoke-SqlQuery -Query "SELECT * FROM TABLE WHERE col1=@id' AND colb > @

Runs a simple query with parameters

### Example 3
```powershell
PS C:\> $obj = [PSCustomObject]@{id = 1; sd = (Get-date)}
PS C:\> $obj | Invoke-SqlQuery -Query "SELECT * FROM TABLE WHERE col1=@id' AND colb > @someDate"
```

Runs a simple query, passing in parameters via object

## PARAMETERS

### -AsDataTable
Expand Down
17 changes: 16 additions & 1 deletion Docs/Invoke-SqlScalar.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,22 @@ Executes a Scalar query against the targeted connection. If the sql statement g
PS C:\> Invoke-SqlScalar -Query "SELECT Count(1) FROM TABLE"
```

{{ Add example description here }}
Simple Scalar query

### Example 2
```powershell
PS C:\> Invoke-SqlQuery -Query "SELECT Count(1) FROM TABLE WHERE colb > @someDate" -Parameters @{someDate = (Get-Date)}
```

Simple Scalar query with parameters

### Example 3
```powershell
PS C:\> $obj = [PSCustomObject]@{sd = (Get-date)}
PS C:\> $obj | Invoke-SqlScalar -Query "SELECT Count(1) FROM TABLE WHERE colb> @sd"
```

Simple Scalar query with parameters populated by object

## PARAMETERS

Expand Down
8 changes: 8 additions & 0 deletions Docs/Invoke-SqlUpdate.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ PS C:\> Invoke-SqlUpdate -Query "UPDATE employees SET salary = @val WHERE manage

Updates the employee table setting the salary to 999999 for all rows with managerid of 549

### Example 2
```powershell
PS C:\> $obj = [PSCustomObject]@{id = 549; val = 999999}
PS C:\> $obj | Invoke-SqlUpdate -Query "UPDATE employees SET salary = @val WHERE manager = @id"
```

Updates the employee table setting the salary to 999999 for all rows with managerid of 549 using an object

## PARAMETERS

### -Command
Expand Down
7 changes: 3 additions & 4 deletions Docs/Open-MySqlConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ MySqlConnector: High Performance .NET MySQL Driver @ https://mysqlconnector.net/

### Example 1
```powershell
PS C:\> {{ Add example code here }}
PS C:\> Open-MySqlConnection -server 'localhost' -database 'DBname' -Credential (Get-Credential)
```

{{ Add example description here }}
Opens a connection to localhost using a credential retrieved from the user.

## PARAMETERS

Expand Down Expand Up @@ -174,7 +174,7 @@ VerifyFull: Always use SSL. Validates CA and hostname.
Type: String
Parameter Sets: default
Aliases:
Accepted values: Disabled, Preferred, Required, VerifyCA, VerifyFull
Accepted values: None, Preferred, Required, VerifyCA, VerifyFull

Required: False
Position: Named
Expand All @@ -190,7 +190,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### System.String
### System.Int32
### SimplySql.Common.SslMode
### System.Management.Automation.PSCredential
### System.Collections.Hashtable
## OUTPUTS
Expand Down
3 changes: 1 addition & 2 deletions Docs/Open-OracleConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ Determines the elevated privileges the connection has: SYSDBA, SYSOPER, SYSASM.
Type: String
Parameter Sets: (All)
Aliases:
Accepted values: None, SYSDBA, SYSOPER, SYSASM
Accepted values: None, SYSASM, SYSDBA, SYSOPER

Required: False
Position: Named
Expand Down Expand Up @@ -206,7 +206,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### System.String
### System.Int32
### SimplySql.Common.ConnectionOracle+OraclePrivilege
### System.Management.Automation.PSCredential
### System.Collections.Hashtable
## OUTPUTS
Expand Down
4 changes: 1 addition & 3 deletions Docs/Open-PostGreConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ VerifyFull: Always use SSL. Validates CA and hostname.
Type: String
Parameter Sets: default
Aliases:
Accepted values: Disabled, Preferred, Required, VerifyCA, VerifyFull
Accepted values: Disable, Prefer, Require, VerifyCA, VerifyFull

Required: False
Position: Named
Expand All @@ -208,8 +208,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
### System.String
### System.Int32
### SimplySql.Common.SslMode
### System.Management.Automation.SwitchParameter
### System.Management.Automation.PSCredential
### System.Collections.Hashtable
## OUTPUTS
Expand Down
6 changes: 3 additions & 3 deletions Docs/Set-SqlConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Set-SqlConnection

## SYNOPSIS
{{ Fill in the Synopsis }}
Set options on the SqlConnection.

## SYNTAX

Expand All @@ -18,7 +18,7 @@ Set-SqlConnection [-ConnectionName <String>] [[-Database] <String>] [-CommandTim
```

## DESCRIPTION
{{ Fill in the Description }}
Set Database and/or Command Timeout for the SqlConnection. Changing the database may not be valid for all providers.

## EXAMPLES

Expand Down Expand Up @@ -62,7 +62,7 @@ Accept wildcard characters: False
```
### -Database
{{ Fill Database Description }}
The database to connect to.
```yaml
Type: String
Expand Down
6 changes: 3 additions & 3 deletions Docs/Show-SqlConnection.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Show-SqlConnection

## SYNOPSIS
{{ Fill in the Synopsis }}
Lists the current SqlConnection.

## SYNTAX

Expand All @@ -23,7 +23,7 @@ Show-SqlConnection [-All] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
Lists the current SqlConnection information or outputs a list of all SqlConnections currently active.

## EXAMPLES

Expand All @@ -37,7 +37,7 @@ PS C:\> {{ Add example code here }}
## PARAMETERS

### -All
{{ Fill All Description }}
If present, will return list of all connection names.

```yaml
Type: SwitchParameter
Expand Down
8 changes: 4 additions & 4 deletions Docs/SimplySql.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ Open a connection to a SQL Server.
Open a connection to a SQLite database file.

### [Set-SqlConnection](Set-SqlConnection.md)
{{ Fill in the Synopsis }}
Set options on the SqlConnection.

### [Show-SqlConnection](Show-SqlConnection.md)
{{ Fill in the Synopsis }}
Lists the current SqlConnection.

### [Start-SqlTransaction](Start-SqlTransaction.md)
{{ Fill in the Synopsis }}
Start a sql transaction.

### [Test-SqlConnection](Test-SqlConnection.md)
{{ Fill in the Synopsis }}
Tests to see if there is a connection.

### [Undo-SqlTransaction](Undo-SqlTransaction.md)
Undo a SQL transaction.
Expand Down
8 changes: 4 additions & 4 deletions Docs/Start-SqlTransaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@ schema: 2.0.0
# Start-SqlTransaction

## SYNOPSIS
{{ Fill in the Synopsis }}
Start a sql transaction.

## SYNTAX

```
Start-SqlTransaction [-ConnectionName <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
Start-SqlTransaction [[-ConnectionName] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
```

## DESCRIPTION
{{ Fill in the Description }}
Start (BEGIN) a sql transaction.

## EXAMPLES

Expand All @@ -39,7 +39,7 @@ Parameter Sets: (All)
Aliases: cn

Required: False
Position: Named
Position: 0
Default value: default
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
Expand Down
Loading

0 comments on commit ca7c715

Please sign in to comment.