public override void Read() { // System.Data.Odbc.OdbcConnection // See: https://docs.microsoft.com/en-us/dotnet/api/system.data.odbc.odbccommand Console.WriteLine("### START: System.Data.Odbc.OdbcConnection (read, Northwind) ###"); // See the class constructor for details on databases string strConnection = string.Empty; foreach (MSAccessDbType dbType in Enum.GetValues(typeof(MSAccessDbType))) { m_cfgDatabase.dbType = dbType; Console.WriteLine(" Testing: {0}", HelperGetAccessName(true)); if (SetConnectionString(ref strConnection)) { foreach (DatabaseAccess dbAccess in Enum.GetValues(typeof(DatabaseAccess))) { foreach (DatabaseReadTechnology dbReadTech in Enum.GetValues(typeof(DatabaseReadTechnology))) { m_dbAccess = dbAccess; m_eDbReadTechnology = dbReadTech; Connect_Read(strConnection); } } } } Console.WriteLine("### END: System.Data.Odbc.OdbcConnection (read) ###\n"); }
public override void Read() { // DAO (Data Access Objects) Console.WriteLine("### START: Simple ODBC (read, SimpleTest.mdb) ###"); // See the class constructor for details on databases string strConnection = string.Empty; foreach (MSAccessDbType dbType in Enum.GetValues(typeof(MSAccessDbType))) { m_cfgDatabase.dbType = dbType; Console.WriteLine(" Testing: {0}", HelperGetAccessName(true)); if (SetConnectionString(ref strConnection)) { foreach (DatabaseAccess dbAccess in Enum.GetValues(typeof(DatabaseAccess))) { foreach (DatabaseReadTechnology dbReadTech in Enum.GetValues(typeof(DatabaseReadTechnology))) { m_dbAccess = dbAccess; m_eDbReadTechnology = dbReadTech; Connect_Read(strConnection); } } } } Console.WriteLine("### END: Simple DAO (read) ###\n"); }
public string GetReadTechnologyAsString(DatabaseReadTechnology eReadTechnology) { // Return a header for the console which describes the performance test string header = string.Empty; if (eReadTechnology == DatabaseReadTechnology.eRbRead_DataReader) { header += "IDataReader"; } else if (eReadTechnology == DatabaseReadTechnology.eRbRead_DataAdapter) { header += "IDbDataAdapter"; } return(header); }
public override void PerformanceTest(int nLoops) { // System.Data.Odbc.OdbcConnection Console.WriteLine("### START: ODBC - Performance tests (Northwind) ###"); string strConnection = string.Empty; foreach (MSAccessDbType dbType in Enum.GetValues(typeof(MSAccessDbType))) { m_cfgDatabase.dbType = dbType; Console.WriteLine(" Testing: {0}", HelperGetAccessName(true)); if (SetConnectionString(ref strConnection)) { foreach (DatabaseReadTechnology dbReadTech in Enum.GetValues(typeof(DatabaseReadTechnology))) { m_eDbReadTechnology = dbReadTech; Console.Write(" ({0}) ", m_utilsDbConnection.GetReadTechnologyAsString(m_eDbReadTechnology)); int totalRecordsRead = 0; int startTicks = Environment.TickCount; for (int loop = 0; loop < nLoops; loop++) { totalRecordsRead += Connect_PerformanceTest(strConnection); } int elapsedTicks = (Environment.TickCount - startTicks); Console.WriteLine("({0} cycles: Took {1}ms at an avg of {2:0.00}ms to read an avg of {3:0.0} records)", nLoops, elapsedTicks, (float)elapsedTicks / (float)nLoops, (float)totalRecordsRead / (float)nLoops); } } } Console.WriteLine("### END: ODBC - Performance tests ###\n"); }