// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Data; using ByteFX.Data.MySqlClient; class MainClass { public const int N = 100000; public static void Main(string[] args) { test("HEAP"); test("MyISAM"); test("InnoDB"); } private static void test(string tbltyp) { MySqlConnection con = new MySqlConnection("Database=Test;Data Source=localhost;User Id=;Password="); con.Open(); MySqlCommand cre = new MySqlCommand("CREATE TABLE m (id INTEGER PRIMARY KEY, val VARCHAR(50)) TYPE=" + tbltyp, con); cre.ExecuteNonQuery(); long t1 = DateTime.Now.Ticks; for(int i = 0; i < N; i++) { MySqlCommand ins = new MySqlCommand("INSERT INTO m VALUES(" + i + ",'Dette er en test')", con); ins.ExecuteNonQuery(); } long t2 = DateTime.Now.Ticks; MySqlCommand drp = new MySqlCommand("DROP TABLE m", con); drp.ExecuteNonQuery(); con.Close(); Console.WriteLine(tbltyp + ": INSERT " + N + " record in " + (t2-t1)/10000 + " milliseconds"); } }