I did use the Null-stuff from the 3.0 release. I
didn't see any weird stuff so far, it all seems to
work fine. Before I used a workaround by defining a
VIEW on tables with null-column(s) that converts NULL
to 0 to support SELECT-statements and a TRIGGER that
converts 0 to NULL for UPDATE/INSERT statements. Then
I could use SSQLS with 0 acting as NULL. Worked pretty
well actually, but too much works for maintaining all
the VIEWs and TRIGGERs :(
But yes, declaring a constant:
const mysqlpp::Null<mysqlpp::sql_int_unsigned>
msr_null(mysqlpp::null);
And using it like this works fine:
unsigned msr_id = ...;
volume(1, 1, msr_id ? msr_id : msr_null, 1, "dummy")
Still don't really understand why it doesn't work in a
"a?a:b" embedded statement while using a null-value
directly does not. It seems like the former makes a
non-const mysqlpp::Null (when it isn't used in the
left side of an assignment) and the latter a const,
but why?
Cheers,
Andrej
--- Warren Young <mysqlpp@stripped> wrote:
> Andrej van der Zee wrote:
> > First of all, thanks for this release (candidate)!
> I
> > expected more effort for upgrading my project to
> > mysqlpp 3.0, but it was done without pain in a few
> > hours!
>
> Thanks for the report.
>
> > Where volume is the SSQLS struct:
> >
> > sql_create_complete_5(volume, 1, 5,
> > mysqlpp::sql_bigint_unsigned, _volume_id,
> > "volume_id",
> > mysqlpp::sql_smallint_unsigned, _session_id,
> > "session_id",
> > mysqlpp::Null<mysqlpp::sql_int_unsigned>,
> _msr_id,
> > "msr_id",
> > mysqlpp::Null<mysqlpp::sql_bigint_unsigned>,
> > _report_id, "report_id",
> > mysqlpp::sql_varchar, _name, "name"
> > );
>
> I see you're already using new MySQL++ features.
> Or, were you using the
> Waba Null<T>-for-SSQLS patch against v2.0?
>
> > error: passing const mysqlpp::null_type as
> this
> > argument of mysqlpp::null_type::operator Type()
> [with
> > Type = unsigned int] discards qualifiers
> >
> > Note that the following construct works perfectly
> > fine:
> >
> > volume vol(volume_id, session_id, mysqlpp::null,
> > report_id, name);
>
> It's clear what it wants. You just have to declare
> null_type::operator
> Type() as const. There's no reason for it to be any
> other way. Good
> thing you caught it when you did, though: the fix
> breaks the ABI, so it
> might not have been possible to fix it after
> release.
>
> --
> MySQL++ Mailing List
> For list archives: http://lists.mysql.com/plusplus
> To unsubscribe:
>
http://lists.mysql.com/plusplus?unsub=1
>
>
___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/