public static void TestFetch() { using (myConnection) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT name,object_id,create_date \n" + "FROM sys.tables"; //var query = "SELECT mpg,cyl,wt \n" + // "FROM T_MTCARS "; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); Assert.Equal(helper.ResultSet.Keys.Count, 3); string[] cols = new string[] { "name", "object_id", "create_date" }; foreach (string key in helper.ResultSet.Keys) { Assert.Contains(key, cols); } } Assert.Equal(helper.ResultSet["name"].Length, helper.Fetched); Assert.Equal(helper.ResultSet.Keys.Count, helper.Cnames.Length); }
static void Main(string[] args) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT * " + "FROM TABLE_BUG"; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); helper.GetReaderProperty("Fetched"); Console.ReadLine(); }
public static void TestFetch_BIG_DATE_TABLE() { using (myConnection) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT * " + "FROM T_DATE"; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); Assert.Equal(result, 100000); } }
public static void TestFetch_BIG_DATE_TABLE() { using (SqlConnection myConnection = new SqlConnection(myConnectionString)) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT * FROM CS_DATE"; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(5); Assert.Equal(5, result); myConnection.Close(); } }
public static void TestFetch() { using (myConnection) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT name,object_id,create_date \n" + "FROM sys.tables"; //var query = "SELECT mpg,cyl,wt \n" + // "FROM T_MTCARS "; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); Assert.Equal(helper.ResultSet.Keys.Count, 3); string[] cols = new string[] { "name", "object_id", "create_date" }; foreach (string key in helper.ResultSet.Keys) Assert.Contains(key, cols); } Assert.Equal(helper.ResultSet["name"].Length, helper.Fetched); Assert.Equal(helper.ResultSet.Keys.Count, helper.Cnames.Length); }
public static void TestFetch() { using (SqlConnection myConnection = new SqlConnection(myConnectionString)) { myConnection.Open(); SqlDataReader myReader = null; var query = "SELECT mpg, cyl, wt FROM CS_MTCARS"; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); Assert.Equal(20, result); Assert.Equal(helper.ResultSet.Keys.Count, 3); string[] cols = new string[] { "mpg", "cyl", "wt" }; foreach (string key in helper.ResultSet.Keys) { Assert.Contains(key, cols); } myConnection.Close(); } Assert.Equal(helper.ResultSet["mpg"].Length, helper.Fetched); Assert.Equal(helper.ResultSet.Keys.Count, helper.Cnames.Length); }
static void Main(string[] args) { myConnection.Open(); SqlDataReader myReader = null; var helper = new SqlDataHelper(); var state = helper.GetConnectionProperty(myConnection, "State"); var query = "SELECT * " + "FROM TABLE_BUG"; SqlCommand myCommand = new SqlCommand(query, myConnection); myReader = myCommand.ExecuteReader(); helper = new SqlDataHelper(myReader); var result = helper.Fetch(20); helper.GetReaderProperty("Fetched"); Console.ReadLine(); }