Ronny Bremer wrote:
>
> the compiler I am using is Metrowerks Codewarrior...
> am trying to compile it for Netware.
Wow...you're really a glutton for punishment, aren't you? :)
I have nothing against dead technologies, but trying to combine them
with new ones is often very frustrating, as you've found. Usually when
I'm in a situation like that, I end up just looking for older versions
that are contemporaneous with the other technologies I'm using, or
simpler alternatives. In this case, that would mean MySQL++ 1.7.x, or
the plain C API.
I'm not trying to brush you off here. Just realize that you're probably
the only one on this list right now who has this problem. That makes it
hard to have a dialog, since no one else can test things in a similar
environment.
> template <class Sequence> void Query::storein_sequence(Sequence& con,
> const char* s)
>
> For some reason, the Codewarrior compiler complains about the
> typename statement at line 720: con.push_back(typename
> Sequence::value_type(row));
'typename' is a relatively recent addition to C++. Maybe CW doesn't
actually understand it? GCC was like that back in the 2.9x series: it
wouldn't emit an error when it saw 'typename', but it wouldn't actually
do anything different when it saw it...it just skipped over it and tried
to understand the declaration the old fashioned way.
So: try taking the 'typename' keyword out instead. If that fixes it,
I'd be more likely to accept a patch to make 'typename' optional than to
hack template parameter names just to make an obsolete compiler happy.
One is a kludge, the other is a workaround. :)
> Anyway, the second issue is what others have reported in the past.
> When compiling custom1.cpp the following error occurs:
>
> ..\..\test\stock.h:47: illegal explicit conversion from 'const
> mysqlpp::ColData_Tmpl<mysqlpp::const_string>' to
> ..\..\test\stock.h:47: 'std::basic_string<char,
> std::char_traits<char>, std::allocator<char>>' ..\..\test\stock.h:47:
> (point of instantiation: 'stock::stock(const mysqlpp::Row &)')
> ..\..\test\stock.h:47: (instantiating: 'populate_stock<0>(stock *,
> const mysqlpp::Row &)')
It looks like it isn't bright enough to realize that it can use
ColData::operator cchar*() to convert to a std::string. The only fix
would be to add an operator std::string to ColData. You're welcome to
hack your copy of MySQL++ to try it, but such a thing won't be accepted
into the official version: it makes the code less efficient even for
compilers that are smart enough to figure out the indirect conversion,
because it looks like the "best" conversion from the compiler's perspective.
You could also just choose not to use SSQLS. MySQL++ is still quite
useful without it.
> I tried to understand the meaning behind the
> ColData_Tmp<const_string> template class trying to static_cast to a
> basic_string, but I could not find a function like that.
The cast is in lib/custom.h. It isn't easy to spot unless you know what
you're looking for in there. If you truly want to figure out how the
SSQLS type conversion logic works, it's better to start with
lib/custom.pl, so you can see the high-level logic without the
repetitive nature of the code in custom.h obscuring your view.