VVContactRepository::remove
The remove() member function of VVContactRepository takes a customer ID and removes the associated customer from the customer list.
 
VVContactRepository&
VVContactRepository::remove(unsigned long id) //1
{
RWDBDeleter aDeleter = table_.deleter(); //2
aDeleter.where(idColumn_ == id); //3
aDeleter.execute(); //4
return *this;
}
//1 This is the definition of the remove() member function of the VVContactRepository class. It accepts one argument, the ID of the customer to be terminated.
//2 Here a deleter object is produced from the table associated with this instance of VVContactRepository. Through this instance of RWDBDeleter, rows that match a certain criterion can be removed from the table. An RWDBDeleter object encapsulates the SQL DELETE statement.
//3 On this line, a condition is formed to limit the deletion to a specific row. This condition takes the form of an RWDBCriterion instance created when applying the operator== to an RWDBColumn instance and a number. For example, this would create a condition equivalent to customer.ID = 69, if customer number 69 were to be deleted.
//4 Once the deleter is given its condition, calling the execute() member function submits the DELETE statement to the database for execution.