[mythtv] Request: MythHelp

Stuart Morgan stuart at tase.co.uk
Wed Feb 7 13:26:17 UTC 2007


On Wednesday 7 February 2007 12:56, usleepless at gmail.com wrote:
> Stuart,
>
> On 2/7/07, Stuart Morgan <stuart at tase.co.uk> wrote:
> > On Wednesday 7 February 2007 12:02, usleepless at gmail.com wrote:
> > > > You seem to have taken rejection on the postgreSQL issue very
> > > > personally and so you now spend your time being destructive instead
> > > > of
> >
> > constructive.
> >
> > > > Ideas and patches are rejected all the time, even my own, most people
> > > > accept that and move on, why can't you?
> > >
> > > don't you see i have moved on? i am happy with my own
> > > mythtv-0.18-postgresql, and am contributing to the freebsd port of
> > > 0.20. i just will never run it myself, since the port doesn't address
> > > the mysql issue. and i have no need for 0.20.
> >
> > This thread is evidence to the contrary. You're still bringing up the
> > postgreSQL issue, still complaining about what you perceive to be bugs in
> > the code and which you have no intention of fixing.
>
> ad hominem.

*sigh*

You're the one trying to deflect the arguments.

> i interpret this as you don't have a clue either why the .isActive()
> and .size() calls are there in the first place?

You're right I've no clue why we are doing:
if (query.isActive() && query.size() && query.next())

That doesn't mean the right solution is to do away with .isActive() 
and .size() completely.

If .next() were sufficient consider why QT provides .size() and .isActive().

.next() will return false in at least three different situations:
1) The Query failed (bad query, database problems etc) - checked by 
isActive().
2) The query returned no results - checked by .size()
3) We have reached the end of the result set

It's good practice to check whether the result is what we expect and throw an 
error if that isn't the case. This is always the case, even if it is 
extremely unlikely to occur.

So the correct method would be something like:

if (query.isActive())
{
    if (query.size > 0)
    {
        while (query.next())
        {
            // fetch the result
        }
    }
    else
    {
        // error, the query produced no results
    }
}
else
{
 // error, the query failed
}
-- 
Stuart Morgan


More information about the mythtv-dev mailing list