public void TestTextReaderInputParameter() { Random rnd = RandomInstance; int dataSize = 100000; string data = new string('a', dataSize); using (DataStressConnection conn = Factory.CreateConnection(rnd)) { if (!OpenConnection(conn)) { return; } SqlCommand cmd = (SqlCommand)conn.CreateCommand(); cmd.CommandText = "SELECT @blob"; SqlParameter param = cmd.Parameters.Add("@blob", SqlDbType.VarChar, dataSize); param.Direction = ParameterDirection.Input; param.Value = new StringReader(data); CommandExecute(rnd, cmd, true); } }
public void TestStreamInputParameter() { Random rnd = RandomInstance; int dataSize = 100000; byte[] data = new byte[dataSize]; rnd.NextBytes(data); using (DataStressConnection conn = Factory.CreateConnection(rnd)) { if (!OpenConnection(conn)) { return; } SqlCommand cmd = (SqlCommand)conn.CreateCommand(); cmd.CommandText = "SELECT @blob"; SqlParameter param = cmd.Parameters.Add("@blob", SqlDbType.VarBinary, dataSize); param.Direction = ParameterDirection.Input; param.Value = new MemoryStream(data); CommandExecute(rnd, cmd, true); } }