Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

There's bug with kDBList::getCountSQL method, which generates SQL for
counting list totals. It checks if there's DISTINCT in SQL and, if it's
there, tries to replace it for COUNT(DISTINCT ...) construction instead of
simple COUNT(*). Problem is that it checks for distinct in ANY place of
query, but replaces it in beginning, so, if there's DISTINCT in subquery, it
won't replace anything. So, count SQL will be equal to list SQL, and you
will get first record's first field's value (according to
kDBConnection::GetOne logic) as record count.

I attached patch that fixes it. Also, it now checks for ANY whitespaces
between SELECT and DISTINCT instead of one space.

count sql with distinct.patch

  • No labels