Warren Young wrote:
> I will add something about this to the v3 breakages section.
Here's what it says now:
> SSQLSes get populated by field name now, not by field order. In v2,
> it was absolutely required that your SSQLS had its fields declared in
> exactly the same order as the fields in the database server, and
> there could be no gaps. An ALTER TABLE command would almost always
> necessitate redefining the corresponding SSQLS and rebuilding your
> program. Some alterations actually made using SSQLS impossible. For
> the most part, this change just gives your program additional
> flexibility in the face of future changes. However, code that was
> taking advantage of this low-level fact will break when moving to v3.
> Before I explain how, let’s go over the high-level functional changes
> you’ll find in v3’s SSQLS mechanism.
> Because MySQL++ no longer needs the SSQLS field order to match the
> SQL field order, the sql_create_c_order_* SSQLS creation macro was
> dropped in v3. We were also able to drop the ordering parameters from
> sql_create_complete_*. That in turn means there is no longer a
> difference between the way it and sql_create_c_names_* work, so the
> latter was also dropped. Thus, there are now only two groups of SSQLS
> creation macros left: sql_create_*, which works pretty much as it
> always has, and sql_create_complete_*, which is the same except for
> the lack of ordering parameters.
> In general, you should be using sql_create_* for all SSQLSes unless
> you need to use different names for data members in C++ than you use
> for the corresponding columns in SQL. In that case, use
> sql_create_complete_* instead.
> In v2, it was possible to have different SQL column names than SSQLS
> data member names while still using sql_create_* if you only used
> SSQLS for data retrieval.[*] In v3, you must use
> sql_create_complete_* for absolutely all uses of SSQLS when you want
> the C++ field names to differ from the SQL column names.
> [*] In MySQL++ v2, data retreival (Query::storein(), SSQLS(const
> Row& other), etc.) worked fine regardless of whether your SSQLS field
> names matched those in the corresponding SQL table, because the SSQLS
> was populated by position, not by field name. Thus, if all you used
> SSQLS for was data retrieval, you could define your structures with
> sql_create_* in v2. This was never recommended, because such an
> SSQLS wouldn’t work with other features of MySQL++ like
> Query::insert() because they depend on being able to map names from
> C++ to SQL and back. You needed to use sql_create_c_names_* to make
> these features work in v2 in the face of a naming scheme difference
> between C++ and SQL.