示例#1
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="tables"></param>
        /// <param name="conn"></param>
        private static void CreateImportFiles(
			DataTable tables,
			NpgsqlConnection conn)
        {
            if (tables.Rows.Count == 0) return;

            _log.Info("");
            _log.Write('I', Constants.LogTsType, "Generating import files:");
            long totalRecCount = 0;

            foreach (DataRow row in tables.Rows)
            {
                var schema = row["schema_name"].ToString();
                var table = row["table_name"].ToString();

                using (var sw = new StreamWriter(
                    ImportFile(schema, table),
                    false,
                    Encoding.Default)) { totalRecCount += sw.CreateImportFile(schema, table, conn); }
            }

            _log.Info("");
            _log.Write(
                'I',
                Constants.LogTsType,
                string.Format(
                    CultureInfo.InvariantCulture,
                    "Total records processed: {0,13:n0}",
                    totalRecCount));
        }