Hi,

I've registered a callback function successfully via xHarbour, but keep getting 100% on a query three or four times before the query has completed. What could cause this?

Remote server connection to the c drive.

The query:

SELECT convert(rtrim(cgrp.cdesc) + ' (' + rtrim(cgrp.ckey) + ')', sql_char) grpname, 
    convert(rtrim(cns.cdesc) + ' (' + rtrim(cns.ckey) + ')', sql_char) consname, 
    sum((det.namount + det.npvat + det.ntax) /*iif(det.cdoctype = 'I', 1, -1)*/) totalfare, 
    sum(det.ncommiif(det.cdoctype = 'I', 1, -1)) totcomm
FROM invdet det
LEFT JOIN genmast cns ON det.cconscode = cns.ckey
    AND cns.cScope = 'C'
LEFT JOIN genmast cgrp ON cns.cgen1 = cgrp.ckey
    AND cgrp.cscope = 'U'
WHERE (
        det.cregtype + det.cbranch + det.cdate BETWEEN 'APta20120400'
            AND 'APta20120431'
       )
GROUP BY grpname, consname

Thanks, Alex

asked 13 Aug '12, 02:24

Alex%20Schaft's gravatar image

Alex Schaft
1416715
accept rate: 0%

edited 13 Aug '12, 08:12

Mark%20Wilkins's gravatar image

Mark Wilkins
7.2k226133


Computing progress information for queries is more of an art than a science. Actually, it involves a fair bit of guess work. The server examines the query and tries to break it into the component pieces and assigns a percentage of each time to each part. It then has to determine some kind of summation value (floating point) to use to add to the total at certain iteration points. It is quite possible for the initial guesses to be wrong and it can reach the total pre-allocated percentage for parts of the query before it is actually finished. In other words, it might reach 30% earlier than expected and thus report 30% for a few calls before moving on. More importantly (with respect to the question), it can reach 100% before it is actually done.

It is quite possible that ARC is also receiving progress reports of 100% more than once; it just may leave the progress bar unchanged.

From an application standpoint, the only way to really know that it is 100% complete is when the function call returns. One possibility in your own application might be to change the progress callback function information and never return a value more than 99% (if 100% is reported, just change it to 99%). Then when the function returns, treat it as 100%. I don't know for sure if this is possible in xHarbour, but it would be possible in some clients.

link

answered 13 Aug '12, 08:22

Mark%20Wilkins's gravatar image

Mark Wilkins
7.2k226133
accept rate: 26%

Hi Alex;

Please try enclosing your query as a subquery. You might have to group on the outter select but the result should be the same. As in: SELECT * FROM ( ...your query... ) a ORDER BY...

Is the progress bar more accurate?

Reinaldo.

link

answered 22 Sep '12, 08:41

Reinaldo's gravatar image

Reinaldo
816202346
accept rate: 6%

Depends on the Query...if it's a loop, the query processor can't determine the actual position.

link

answered 13 Aug '12, 03:43

Joachim%20Duerr's gravatar image

Joachim Duerr
8.7k1031133
accept rate: 18%

Query below:

Select convert(rtrim(cgrp.cdesc) + ' (' + rtrim(cgrp.ckey) + ')', sql_char) grpname, convert(rtrim(cns.cdesc) + ' (' + rtrim(cns.ckey) + ')', sql_char) consname, sum((det.namount + det.npvat + det.ntax)iif(det.cdoctype='I', 1, -1)) totalfare, sum(det.ncommiif(det.cdoctype='I', 1, -1)) totcomm from invdet det left outer join genmast cns on det.cconscode = cns.ckey and cns.cScope = 'C' left outer join genmast cgrp on cns.cgen1 = cgrp.ckey and cgrp.cscope = 'U' where (det.cregtype+det.cbranch+det.cdate between 'APta20120400' and 'APta20120431') group by grpname, consname

(13 Aug '12, 03:45) Alex Schaft

can you see the same behaviour using data architect?

(13 Aug '12, 03:46) Joachim Duerr

No. Data architect shows proper progress, as does the remote server info.

(13 Aug '12, 05:03) Alex Schaft

If it works in ARC then you need to check your implementation. ARC uses the same ACE API calls - AdsRegisterCallbackFunction, AdsClearCallbackFunction.

(13 Aug '12, 05:20) Joachim Duerr
Your answer to the original question.
If responding to a request for additional information, please edit the question or use the comment functionality.
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "Title")
  • image?![alt text](/path/img.jpg "Title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×154
×20

Asked: 13 Aug '12, 02:24

Seen: 2,097 times

Last updated: 22 Sep '12, 08:41

Advantage Developer Zone Contact Us Privacy Policy Copyright Info


Powered by Advantage Database Server and OSQA
Disclaimer: Opinions expressed here are those of the poster and do not necessarily reflect the views of the company.