Revision 143a60e7
Added by David Sorber over 9 years ago
| software/sqlite_poc/main.cc | ||
|---|---|---|
|
// Make a DBManager instance which will connect to our test DB automagically
|
||
|
DBManager db_mgr("database.db");
|
||
|
|
||
|
|
||
|
// Make a query
|
||
|
std::string query("SELECT Number, Float FROM sample;");
|
||
|
std::string query("SELECT Number, Words, Float FROM sample;");
|
||
|
|
||
|
// Execute the query making sure the template params match up with the
|
||
|
// query params
|
||
|
int rc = 0;
|
||
|
auto results = db_mgr.execute_query<int64_t, double>(query, rc);
|
||
|
auto results = db_mgr.execute_query<int64_t, std::string, double>(query, rc);
|
||
|
std::cout << "Return code: " << rc << std::endl;
|
||
|
|
||
|
// If we returned successfully, print out the result rows
|
||
After much contemplation I realized that my previous approach to solving this execute query template function problem was more wrong than right. Several days of staring at and reading about variadic templates later I figured out the correct way to accomplish my goal.