Subject Re: SQLSelect, RecCount() and SQL_XPP_ERROR
From Boris Borzic <bb>
Date Thu, 30 Aug 2018 23:08:22 +0200
Newsgroups sqlexpress

Raimundo Alba <> wrote in news:dne26o6ouoqw6qb.300820181120@daz17:

> I'm rewritting an old piece of code involving error control made by
> other guy many years ago and would like to ask a question about.
>
> Whenever a connection is opened and a SQLSelect is done there is a
> check for SQL_XPP_ERROR state but also there is a routine checking
> RecCount() result value not being "-1".
>
> Now I'm seeing as SQLExpress documentation shows that this result in a
> "SELECT COUNT(*) FROM..." statement being executed too and this is
> overheating the system.
>
> My question is that if really needed this second control for errors or
> if there is any other more lightweight of doing it, maybe and eof()
> control?

No, you definitely don't need this when using SQLSelect because it will
result in an additional "select count(*)..." being executed.

Replace the :RecCount with a check for :eof()

Note that the above does not apply to SQLDataSet. There is no penalty for
calling reccount on a SQLDataSet object.

--
Best regards,
Boris Borzic

http://xb2.net
http://sqlexpress.net
industrial strength Xbase++ development tools

Recent messages in this thread
 
-# SQLSelect, RecCount() and SQL_XPP_ERROR Raimundo Alba <> 30-Aug-2018 10:20 am
.\# Re: SQLSelect, RecCount() and SQL_XPP_ERROR (Current message) Boris Borzic <bb> 30-Aug-2018 10:08 pm