Skip to content

Commit

Permalink
Quote table name in MySqlBulkCopy. Fixes #792
Browse files Browse the repository at this point in the history
  • Loading branch information
bgrainger committed Apr 4, 2020
1 parent 7caf5eb commit af0c30e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/content/api/mysql-bulk-copy.md
Expand Up @@ -55,7 +55,7 @@ The number of seconds for the operation to complete before it times out, or `0`

`public string DestinationTableName { get; set; }`

Name of the destination table on the server.
Name of the destination table on the server. (This name shouldn't be quoted or escaped.)

`public int NotifyAfter { get; set; }`

Expand Down
6 changes: 5 additions & 1 deletion src/MySqlConnector/MySql.Data.MySqlClient/MySqlBulkCopy.cs
Expand Up @@ -24,6 +24,10 @@ public MySqlBulkCopy(MySqlConnection connection, MySqlTransaction? transaction =

public int BulkCopyTimeout { get; set; }

/// <summary>
/// The name of the table to insert rows into.
/// </summary>
/// <remarks>The table name shouldn't be quoted or escaped.</remarks>
public string? DestinationTableName { get; set; }

/// <summary>
Expand Down Expand Up @@ -119,7 +123,7 @@ private async ValueTask WriteToServerAsync(IOBehavior ioBehavior, CancellationTo
Local = true,
NumberOfLinesToSkip = 0,
Source = this,
TableName = tableName,
TableName = QuoteIdentifier(tableName),
Timeout = BulkCopyTimeout,
};

Expand Down

0 comments on commit af0c30e

Please sign in to comment.