Ah ha! Bang that is it. I changed my SQL to use the 'as' syntax as a test:
SELECT foobar AS id.
And all is well :)
Thanks for taking the time to help me get to the bottom of it.
----- Original Message -----
From: "Warren Young" <mysqlpp@stripped>
To: "MySQL++ Mailing List" <plusplus@stripped>
Sent: Thursday, 18 September, 2008 5:13:55 PM GMT +00:00 GMT Britain, Ireland, Portugal
Subject: Re: Result set count correct but each attribute is empty!
James Vanns wrote:
> CREATE TABLE `host` (
> `host__id` BIGINT(8) UNSIGNED NOT NULL AUTO_INCREMENT,
> `host__guid` int(4) UNSIGNED NOT NULL,
All is clear now.
In v3, SSQLS members are populated by name, not by position as in v2.
Your SSQLS doesn't contain host__id, for instance, so when it tries to
populate it, it doesn't find it and moves on.
When I wrote the breakages section for v3, I didn't think of this as a
"breakage", though it obviously has broken your code. Code using SSQLS
as it was intended just sees this as a new feature, offering additional
freedom you didn't have in v2. In v2, using sql_create_X meant that
your SSQLS corresponded exactly to the names and order of fields in the
SQL. When this was not the case, we had other variants of sql_create,
which got removed in v3 because it's no longer necessary.
I will add something about this to the v3 breakages section.
You have two options to fix your code:
1. Change your SSQLS data members to have the same name as in the SQL
2. Use sql_create_complete_X instead, which lets you use a different
name in C++ for each field than in SQL.
> hdb_host_t record(res);
> cout << record.id << endl;
> I didn't know you could do that - I'll try it.
Yes. All SSQLSes have a constructor taking Row.
MySQL++ Mailing List
For list archives: http://lists.mysql.com/plusplus
To unsubscribe: http://lists.mysql.com/plusplus?unsub=1
Framestore CFC Ltd.