List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:June 30 2009 3:54pm
Subject:Re: ssqls internals question....
View as plain text  
Dan Cook (dancook) wrote:
> template<class T>
> vector<T> getRows(const T& object, connection) 
> {
>     Query q = conn->query();
>     q << "select * from object.table() << 
>             " where " << object.equal_list(" and ", sql_use_compare);
> cerr<<query<<endl;

As you've found, this equal_list() overload just uses the COMPCOUNT 
fields.  You would have to use one of the overloads taking "bool, bool, 
bool...." or vector<bool> to get it to do what you want.

>    test t;
>    t.fkey = 1;

For that to be a sufficient hint to MySQL++ that you're talking about 
the second field, C++ would have to be a different language.  C++ has no 
"undefined" value, as does, say, JavaScript.  Thus, we can't just check 
which field got a value.

SSQLS v2 with accessors might give us what you need here:

	test t;

with setFkey() internally doing something like:

	this->fkey_ = 1;
	this->fkey_set_ = 1;

Then we have a separate flag we can test to intuit which fields are set.
ssqls internals question....dancook)20 Jun
  • Re: ssqls internals question....Warren Young30 Jun