I am trying to put together a general purpose query template function using equal_list. I
want to query using different fields in the object. For example "select * from test where
fkey=1". This contrived query selects everything matching the foreign key "fkey".
The guts of the template function is:
vector<T> getRows(const T& object, connection)
Query q = conn->query();
q << "select * from object.table() <<
" where " << object.equal_list(" and ", sql_use_compare);
For a given SSQLS Definition say:
If I want all the objects with fkey = 1 I thought I could do this:
t.fkey = 1;
vector vec = getRows(test, conn);
When I do this I see the output from the query:
select * from test where id=65434534;
(Since id is not initialized, I assume it is a garbage value).
I was expecting to see something like:
select * from test where fkey=1;
What am I doing wrong here? Any help would greatly be appreciated.