/// <summary> /// Initializes a new instance of the <see cref="MySqlDataLoadException"/>. /// </summary> /// <param name="operationType">The type of operation performed by the related <see cref="MySqlDataTable"/>.</param> /// <param name="innerException">The exception that is the cause of the current exception, or a null reference if no inner exception is specified.</param> public MySqlDataLoadException(MySqlDataTable.DataOperationType operationType, Exception innerException) : this(string.Format(Resources.TableDataAdditionErrorTitle, operationType.IsForExport() ? "exporting" : "appending"), innerException) { }
/// <summary> /// Creates the import my SQL table. /// </summary> /// <param name="wbConnection">The wb connection.</param> /// <param name="operationType">The <see cref="MySqlDataTable.DataOperationType"/> intended for the new <see cref="MySqlDataTable"/>.</param> /// <param name="tableOrViewName">The name of the MySQL table or view to import data from..</param> /// <param name="importColumnNames">Flag indicating if column names will be imported as the first row of imported data.</param> /// <param name="selectQuery">A SELECT query against a database object to fill the [MySqlDataTable] return object with.</param> /// <param name="procedureResultSetIndex">The index of the result set of a stored procedure this table contains data for.</param> /// <returns>MySql Table created from the selectQuery.</returns> public static MySqlDataTable CreateImportMySqlTable(this MySqlWorkbenchConnection wbConnection, MySqlDataTable.DataOperationType operationType, string tableOrViewName, bool importColumnNames, string selectQuery, int procedureResultSetIndex = 0) { DataTable dt = GetDataFromSelectQuery(wbConnection, selectQuery); if (dt == null) { MySqlSourceTrace.WriteToLog(string.Format(Resources.SelectQueryReturnedNothing, selectQuery)); return(null); } var importMySqlDataTable = new MySqlDataTable(wbConnection, tableOrViewName, dt, operationType, selectQuery) { ImportColumnNames = importColumnNames, ProcedureResultSetIndex = procedureResultSetIndex }; return(importMySqlDataTable); }
/// <summary> /// Checks if the given data operation type is for exporting data. /// </summary> /// <param name="operationType">A <see cref="MySqlDataTable.DataOperationType"/> enumeration value.</param> /// <returns><c>true</c> if the given data operation type is for exporting data, <c>false</c> otherwise.</returns> public static bool IsForExport(this MySqlDataTable.DataOperationType operationType) { return(operationType == MySqlDataTable.DataOperationType.Export); }
/// <summary> /// Checks if the given data operation type is for importing data. /// </summary> /// <param name="operationType">A <see cref="MySqlDataTable.DataOperationType"/> enumeration value.</param> /// <returns><c>true</c> if the given data operation type is for importing data, <c>false</c> otherwise.</returns> public static bool IsForImport(this MySqlDataTable.DataOperationType operationType) { return(operationType == MySqlDataTable.DataOperationType.ImportTableOrView || operationType == MySqlDataTable.DataOperationType.ImportProcedure); }
/// <summary> /// Checks if the given data operation type is for appending data. /// </summary> /// <param name="operationType">A <see cref="MySqlDataTable.DataOperationType"/> enumeration value.</param> /// <returns><c>true</c> if the given data operation type is for appending data, <c>false</c> otherwise.</returns> public static bool IsForAppend(this MySqlDataTable.DataOperationType operationType) { return(operationType == MySqlDataTable.DataOperationType.Append); }