Everything should be made as simple as possible, but not simpler. | |
Albert Einstein |
dbstreams takes its name from std::iostreams because it conceives of a database connection as analogous to a file handle, and as a table to a file. Consider:
How is a database like a file?
Open, read, write, close
Connection may be broken
Data conversion
Read until "end"
How is a database not like a file?
Database systems are (comparatively) intelligent.
They are more varied than filesystems.
Database access is record- rather than byte-oriented.
Their contents are self-describing.
They have much more complex error states.
Intuition is a measure of the familiar. If you know std::iostreams, and the dbstreams operations look familiar and predictable, we have succeeded. The only goal beyond that is that when the database presents a problem with no filesystem analog, the method offered is a plausible extension: clear, consistent, and easy to use.