Skip to main content
Tweeted twitter.com/#!/StackCodeReview/status/115499888086757376
Source Link
user36
user36

Database class design

I'm writing a SQLite wrapper for C++. I have this class representing a database:

  class Database {
    sqlite3 *db;
  public:
    Database(const std::string& file_path, bool readonly = false) throw(SQLiteException);
    ~Database();
    
    std::vector<std::map<std::string, Value> > Query(const std::string& query) throw(SQLiteException);
    std::vector<std::map<std::string, Value> > Query(const std::string& query, const std::vector<Value>& bindings) throw(SQLiteException);
  };

Where Value is a container for an int, double, std::string or std::vector<char> (because the returned type isn't yet known at compile-time).

I'm concerned about the return value types of Database::Query. How could I simplify this?