DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Protected Member Functions | List of all members
Deveel.Data.PerformanceTest Class Reference
Inheritance diagram for Deveel.Data.PerformanceTest:

Public Member Functions

void Insert1000RowsAndCount_NonCommit ()
 
void Insert1000RowsAndCount_Commit ()
 

Protected Member Functions

override void OnSetUp ()
 
override void OnTearDown ()
 

Detailed Description

Definition at line 9 of file PerformanceTest.cs.

Member Function Documentation

void Deveel.Data.PerformanceTest.Insert1000RowsAndCount_Commit ( )
inline

Definition at line 65 of file PerformanceTest.cs.

65  {
66  // we deisable the AUTO_COMMIT flag for such this operation
67  DeveelDbTransaction transaction = Connection.BeginTransaction();
68 
69  DeveelDbCommand command = Connection.CreateCommand();;
70 
71  DateTime start = DateTime.Now;
72 
73  for (int i = 0; i < 1000; i++) {
74  command.CommandText = "INSERT INTO TestTable (inc, var_name) VALUES (?, ?)";
75  command.Parameters.Add(i);
76  command.Parameters.Add("var_" + i);
77  command.ExecuteNonQuery();
78  }
79 
80  DateTime end = DateTime.Now;
81  Console.Out.WriteLine("Inserted 1000 rows in {0}.", (end - start));
82 
83  start = DateTime.Now;
84 
85  transaction.Commit();
86 
87  end = DateTime.Now;
88 
89  Console.Out.WriteLine("Committed in {0}.", (end - start));
90 
91  command = Connection.CreateCommand("SELECT COUNT(*) FROM TestTable");
92  BigNumber count = (BigNumber)command.ExecuteScalar();
93 
94  Console.Out.WriteLine("Numer of rows inserted into TestTable : {0}", count);
95  }
new DeveelDbParameterCollection Parameters
void Deveel.Data.PerformanceTest.Insert1000RowsAndCount_NonCommit ( )
inline

Definition at line 26 of file PerformanceTest.cs.

26  {
27  // we deisable the AUTO_COMMIT flag for such this operation
28  DeveelDbTransaction transaction = Connection.BeginTransaction();
29 
30  DeveelDbCommand command;
31 
32  DateTime start = DateTime.Now;
33 
34  for (int i = 0; i < 1000; i++) {
35  command = Connection.CreateCommand();
36  command.CommandText = "INSERT INTO TestTable (inc, var_name) VALUES (?, ?)";
37  command.Parameters.Add(i);
38  command.Parameters.Add("var_" + i);
39  command.ExecuteNonQuery();
40  }
41 
42  DateTime end = DateTime.Now;
43  Console.Out.WriteLine("Inserted 1000 rows in {0}.", (end - start));
44 
45  command = Connection.CreateCommand("SELECT COUNT(*) FROM TestTable");
46  BigNumber count = (BigNumber) command.ExecuteScalar();
47 
48  Assert.AreEqual(1000, count.ToInt32(), "Not all the rows were inserted");
49 
50  start = DateTime.Now;
51 
52  transaction.Rollback();
53 
54  end = DateTime.Now;
55 
56  Console.Out.WriteLine("Rolled-back in {0}", (end - start));
57 
58  command = Connection.CreateCommand("SELECT COUNT(*) FROM TestTable");
59  count = (BigNumber)command.ExecuteScalar();
60 
61  Assert.AreEqual(0, count, "After rollback there shouldn't be any rows in the table.");
62  }
new DeveelDbParameterCollection Parameters
override void Deveel.Data.PerformanceTest.OnSetUp ( )
inlineprotected

Definition at line 10 of file PerformanceTest.cs.

10  {
11  DeveelDbCommand command = Connection.CreateCommand();
12  command.CommandText = "CREATE TABLE IF NOT EXISTS TestTable (" +
13  " id IDENTITY," +
14  " inc INTEGER," +
15  " var_name VARCHAR(200)" +
16  ")";
17  command.ExecuteNonQuery();
18  }
override void Deveel.Data.PerformanceTest.OnTearDown ( )
inlineprotected

Definition at line 20 of file PerformanceTest.cs.

20  {
21  DeveelDbCommand command = Connection.CreateCommand("DROP TABLE TestTable");
22  command.ExecuteNonQuery();
23  }

The documentation for this class was generated from the following file: