Palmer, 2E0EOL committed 766e313

Move around some mis-placed and/or duplicated comments. Clarify.

Comments (0)

Files changed (4)

 bool DB::query(const std::string &Query)
+	// Print the query.  TODO: This should be redirected to a log.
 	std::cout << this->name() << ": " << Query << std::endl;
 	return false; // FIXME: Everything fails.
+  the is_mock() function provides a way for users to know whether the database class
+  they are using is really a mocked variant.  You should avoid using this, except
+  to abort a test-bed before doing a destructive operation, when somebody has accidentally
+  pointed the unit tests to a real-backend.  In general, avoid making logic branches based
+  on whether the back-end is mocked, or your unit testing will not have full code coverage.
 bool DB::is_mock()
-	// This base class is always non-mock, see DBMock for overridden mockery.
+	// This base class is not mocked, this function is overridden in mock derivatives.
 	return false;
 const std::string &DB::name()
+	// Return the name associated with the database.
 	return this->assoc_name;
-  This is the base class, which does the real work for the database,
-  at present, is is just a back-end which does nothing, except provide
-  a basis to demonstrate the rest of the library.
+  This is the mocked variant of the database class, it is derived directly
+  from DB, and overrides the is_mock() member function, each instance of this
+  class will create a temporary file, which will be used by DB in SQlite mode.
+  The file is destroyed when the class is destroyed.  This means you can sub-class
+  this class and create specialised, free-standing mock database objects, which can
+  be further passed to components which expect database interaction, during unit
+  testing.
 #include "DBMock.hpp"
-  This is a base class which shows the basic concept of creating a table
-  in a dynamic, faked database.
+  This is a basic class which shows the concept of creating a table
+  in a dynamic, faked database.  It is derived from DBMock.
 #include "DBMockExample.hpp"
-  This class represents the mocked variant of the database class.
-  It inherits from the main DB class, but then sets up a database
-  which is SQlite, and will be created in a temporary directory.