Class MySqlBulkLoader
Allows importing large amounts of data into a database with bulk loading.
Namespace: MySql.Data.MySqlClient
Assembly: MySql.Data.dll
Version: 9.0.0
Syntax
public class MySqlBulkLoader
Constructors
MySqlBulkLoader(MySqlConnection)
Initializes a new instance of the MySqlBulkLoader class using the specified instance of MySqlConnection.
Declaration
public MySqlBulkLoader(MySqlConnection connection)
Parameters
Type | Name | Description |
---|---|---|
MySqlConnection | connection | The MySqlConnection that will be used to perform the bulk operation. |
Properties
CharacterSet
Gets or sets the character set.
Declaration
public string CharacterSet { get; set; }
Property Value
Type | Description |
---|---|
String | The character set. |
Columns
Gets the columns.
Declaration
public List<string> Columns { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<String> | The columns. |
ConflictOption
Gets or sets the conflict option.
Declaration
public MySqlBulkLoaderConflictOption ConflictOption { get; set; }
Property Value
Type | Description |
---|---|
MySqlBulkLoaderConflictOption | The conflict option. |
Connection
Gets or sets the connection.
Declaration
public MySqlConnection Connection { get; set; }
Property Value
Type | Description |
---|---|
MySqlConnection | The connection. |
EscapeCharacter
Gets or sets the escape character.
Declaration
public char EscapeCharacter { get; set; }
Property Value
Type | Description |
---|---|
Char | The escape character. |
Expressions
Gets the expressions.
Declaration
public List<string> Expressions { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.List<String> | The expressions. |
FieldQuotationCharacter
Gets or sets the field quotation character.
Declaration
public char FieldQuotationCharacter { get; set; }
Property Value
Type | Description |
---|---|
Char | The field quotation character. |
FieldQuotationOptional
Gets or sets a value indicating whether [field quotation optional].
Declaration
public bool FieldQuotationOptional { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
|
FieldTerminator
Gets or sets the field terminator.
Declaration
public string FieldTerminator { get; set; }
Property Value
Type | Description |
---|---|
String | The field terminator. |
FileName
Gets or sets the name of the file.
Declaration
public string FileName { get; set; }
Property Value
Type | Description |
---|---|
String | The name of the file. |
LinePrefix
Gets or sets the line prefix.
Declaration
public string LinePrefix { get; set; }
Property Value
Type | Description |
---|---|
String | The line prefix. |
LineTerminator
Gets or sets the line terminator.
Declaration
public string LineTerminator { get; set; }
Property Value
Type | Description |
---|---|
String | The line terminator. |
Local
Gets or sets a value indicating whether the file name that is to be loaded is local to the client or not. The default value is false.
Declaration
public bool Local { get; set; }
Property Value
Type | Description |
---|---|
Boolean |
|
NumberOfLinesToSkip
Gets or sets the number of lines to skip.
Declaration
public int NumberOfLinesToSkip { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The number of lines to skip. |
Priority
Gets or sets the priority.
Declaration
public MySqlBulkLoaderPriority Priority { get; set; }
Property Value
Type | Description |
---|---|
MySqlBulkLoaderPriority | The priority. |
TableName
Gets or sets the name of the table.
Declaration
public string TableName { get; set; }
Property Value
Type | Description |
---|---|
String | The name of the table. |
Timeout
Gets or sets the timeout.
Declaration
public int Timeout { get; set; }
Property Value
Type | Description |
---|---|
Int32 | The timeout. |
Methods
Load()
Executes the load operation.
Declaration
public int Load()
Returns
Type | Description |
---|---|
Int32 | The number of rows inserted. |
Load(Stream)
Executes the load operation.
Declaration
public int Load(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | A Stream object containing the data to be loaded. |
Returns
Type | Description |
---|---|
Int32 | The number of rows inserted. |
LoadAsync()
Asynchronous version of the load operation.
Declaration
public Task<int> LoadAsync()
Returns
Type | Description |
---|---|
Task<Int32> | The number of rows inserted. |
LoadAsync(Stream)
Asynchronous version of the load operation that accepts a data stream.
Declaration
public Task<int> LoadAsync(Stream stream)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | A Stream containing the data to be loaded. |
Returns
Type | Description |
---|---|
Task<Int32> | The number of rows inserted. |
LoadAsync(Stream, CancellationToken)
Executes the load operation asynchronously while the cancellation isn't requested.
Declaration
public Task<int> LoadAsync(Stream stream, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
Stream | stream | A Stream containing the data to be loaded. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
Task<Int32> | The number of rows inserted. |