/// <summary> /// This function unloads the data from the database. /// </summary> /// <remarks> /// If the data set contains relative dates, the data must be unloaded on the same day that it has been loaded. /// </remarks> /// <param name="connectionString">Connection string of the database to load the data into.</param> /// <param name="filePath">Full path of the ".dataload" file to be loaded.</param> public void Unload(string connectionString, string filePath) { var fileContent = File.ReadAllText(filePath); var query = _dataloadReader.GetDeleteQuery(fileContent); try { executeDeleteOrInsertQueryDeferConstraints(connectionString, query); } catch (Exception e1) { try { executeDeleteOrInsertQuery(connectionString, query); //If loading fails, do the conventional unload that will fail too, but give more precise error info. } catch (Exception e2) { throw new DatabaseLoaderException(e2.Message, e1); } } }
/// <summary> /// This function unloads the data from the database. /// </summary> /// <remarks> /// If the data set contains relative dates, the data must be unloaded on the same day that it has been loaded. /// </remarks> /// <param name="connectionString">Connection string of the database to load the data into.</param> /// <param name="filePath">Full path of the ".dataload" file to be loaded.</param> public void Unload(string connectionString, string filePath) { var fileContent = File.ReadAllText(filePath); executeQuery(connectionString, _dataloadReader.GetDeleteQuery(fileContent)); }