List:MySQL++« Previous MessageNext Message »
From:Warren Young Date:September 18 2008 4:13pm
Subject:Re: Result set count correct but each attribute is empty!
View as plain text  
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[0]);
> 	cout << record.id << endl;
> 
> I didn't know you could do that - I'll try it.

Yes.  All SSQLSes have a constructor taking Row.
Thread
Result set count correct but each attribute is empty!James Vanns10 Sep
  • Re: Result set count correct but each attribute is empty!Warren Young10 Sep
    • Re: Result set count correct but each attribute is empty!James Vanns10 Sep
      • Re: Result set count correct but each attribute is empty!Warren Young10 Sep
Re: Result set count correct but each attribute is empty!James Vanns11 Sep
  • Re: Result set count correct but each attribute is empty!Warren Young11 Sep
Re: Result set count correct but each attribute is empty!James Vanns11 Sep
  • Re: Result set count correct but each attribute is empty!Warren Young11 Sep
Re: Result set count correct but each attribute is empty!James Vanns18 Sep
  • Re: Result set count correct but each attribute is empty!Warren Young18 Sep
    • Re: Result set count correct but each attribute is empty!James Vanns18 Sep
      • Re: Result set count correct but each attribute is empty!Warren Young18 Sep
        • Re: Result set count correct but each attribute is empty!James Vanns18 Sep
        • Re: Result set count correct but each attribute is empty!Warren Young18 Sep
    • Re: Result set count correct but each attribute is empty!James Vanns18 Sep