Fixes for #2162. SphinxQL: COUNT(*) get error.

When trying to get the total number of items, an error is returned.