public void Test3Columns() { const string myFileName = "3columns.bcp"; BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Try with the wrong number of columns // Death //writer.AddColumn(new SQLInt()); List <object> rows = new List <object>(); rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); try { BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); writer.WriteRows(stream, rows); stream.Close(); } catch (InvalidCastException) { } }
public void TestPerformance() { BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Death writer.AddColumn(new SQLInt()); const int nbRows = 100000; List <object> rows = new List <object>(); for (int i = 0; i < nbRows; i++) { rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); } //string myFileName = "perf.bcp"; //BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); //writer.WriteRows(stream, rows); //stream.Close(); //BCPTests.CheckFile(myFileName); }
public void Test3Columns() { const string myFileName = "3columns.bcp"; BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Try with the wrong number of columns // Death //writer.AddColumn(new SQLInt()); List<object> rows = new List<object>(); rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); try { BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); writer.WriteRows(stream, rows); stream.Close(); } catch (InvalidCastException) { } }
public void Test4Columns() { const string myFileName = "4columns.bcp"; BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Death writer.AddColumn(new SQLInt()); List <object> rows = new List <object>(); rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); writer.WriteRows(stream, rows); stream.Close(); BCPTests.CheckFile(myFileName); }
public void Test4Columns() { const string myFileName = "4columns.bcp"; BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Death writer.AddColumn(new SQLInt()); List<object> rows = new List<object>(); rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); writer.WriteRows(stream, rows); stream.Close(); BCPTests.CheckFile(myFileName); }
public void TestPerformance() { BCPWriter writer = new BCPWriter { Mode = BCPWriter.BackendMode.Debug }; // FirstName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // LastName writer.AddColumn(new SQLNVarChar(SQLNVarChar.MAX)); // Birth writer.AddColumn(new SQLInt()); // Death writer.AddColumn(new SQLInt()); const int nbRows = 100000; List<object> rows = new List<object>(); for (int i = 0; i < nbRows; i++) { rows.Add("Frédéric François"); rows.Add("Chopin"); rows.Add(1810); rows.Add(1849); rows.Add("Franz"); rows.Add("Liszt"); rows.Add(1811); rows.Add(1886); rows.Add("George"); rows.Add("Sand"); rows.Add(1804); rows.Add(1876); } //string myFileName = "perf.bcp"; //BinaryWriter stream = BCPTests.CreateBinaryFile(myFileName); //writer.WriteRows(stream, rows); //stream.Close(); //BCPTests.CheckFile(myFileName); }