Patches item #784222, was opened at 2003-08-06 15:00
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=307869&aid=784222&group_id=7869
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Jonathan Wakely (redi)
Assigned to: Nobody/Anonymous (nobody)
Summary: Reorder headers and forward declarations
Initial Comment:
Compiling with GCC 3.4 (experimental) fails in Query.h
because the Query::storein*() function templates try to
call member functions on a Connection object, but
Connection has only been forward declared in Query.h.
This worked previously because GCC delayed all name
lookup in templates until the point of instantiation,
by which time Connection had been declared. Because GCC
3.4 looks up non-dependent names (such as, in this
context, the member functions of Connection) during the
first phase of compilation it errors as soon as you
refer to a member of the undefined Connection class.
This patch re-orders some headers and forward
declarations so that all classes are defined before any
of their members are referred to. This basically
involved swapping the declarations of Connection and
Query, so that Connection.h only gets a forward
declaration of Query, and Query.h includes Connection.h
(where this used to be the other way around).
Once this change was made another problem arose, namely
that the definitions of the storein*() function
templates had not been updated when smart pointers were
added to the library, so still referred to the (now
removed) mysql_res member of Result_Use. Presumably
this problem wasn't noticed before because the function
templates were never instantiated and so were never
compiled, but GCC 3.4's first phase of template
compilation issues a diagnostic when it sees the
reference to mysql_res. I changed the function
definitons to use the fetch_row() member of Result_Use
instead BUT ...
N.B. I am not entirely sure of the semantics of the
fetch_row() function, so am not sure my try/catch
blocks do the right thing in the storein*() function
templates. Please review this change carefully.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=307869&aid=784222&group_id=7869
|