How many lines of C++ does a minimal CRUD database application need?
Check this example; two lines for initialization, one line for each operation:
obx::Store store(create_obx_model());
obx::Box<Task> taskBox(store);
obx_id id = box.put({.text = "Buy milk"}); // Create
std::unique_ptr<Task> task = box.get(id); // Read
if (task) {
task->text += " & some bread";
box.put(*task); // Update
...
box.remove(id); // Delete
}
Can it be done shorter than that?PS.: the example shows user code only, there's a tool to generate boilerplate code, e.g. the Task struct and "binding" it to database.
Comments
Here is an example from Wt's DBO tutorial: https://www.webtoolkit.eu/wt/doc/tutorial/dbo.html
As many as is required?
This just looks like a competition ...