Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL puzzle
Message
From
01/10/2001 02:25:29
Al Doman (Online)
M3 Enterprises Inc.
North Vancouver, British Columbia, Canada
 
 
To
01/10/2001 01:50:55
Vladimir Zhuravlev
Institute of the Physics of Earth,Russia
Moscow Region, Russia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00562396
Message ID:
00562400
Views:
18
>Function getsum is pretty usual, also has sql inside, not touching aliasis
> inside the main sql,
With UDFs used in SELECT - SQL it's a good idea to "leave things as you found them". Your SELECT, although to an array, might still open the tables involved or USE AGAIN in another work area. Work area it leaves as "current" may not be predictable. The code added in bold below works around this:
Function getsum(rid,_s)
Local _smres[1],m.rss,<b>lnSelect
lnSelect = SELECT(0)</b>
_smres[1]=00000000.00000000
select sum(iif(prh.kol!=0,round(prh.smr/prh.kol*prhrsh.kol,2),00000000.00000000));
from dbf_ck!prh,dbf_ck!prhrsh ;
where   prh.str_id=prhrsh.strp_id and prhrsh.strr_id=rid into array _smres
m.rss=_smres[1]
if type('_smres')!='U'
  release _smres
endif
<b>SELECT (lnSelect)</b>
return m.rss
If that doesn't help I can think of two other things:

- rather than simply REINDEXing (which may not fix subtle index corruption), issue DELETE TAG ALL and then reapply the indices from scratch.

- Scan your .DBFs for low level corruption, perhaps indicated by extended characters outside the valid range.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform