Maar al te vaak zien we vragen die niet nodig zijn of code die duidelijk duidt op 'luiheid' van programmeurs. Omdat de zaal goed vol zat bij presentaties in het verleden over errorhandling en Quality of code trek ik de conclusie dat de meeste VO-programmeurs onder de SDGN-leden er graag aan willen werken en verbeteren. Vandaar even aandacht voor onderstaande 'tip' van Robert op de publieke VO-nieuwsgroep:
Hi Will,
you wrote about: 'Is Dbserver:GoTop() broken in 2.7?'
> oDB := DBServer{"mydbf"}
> oDB:gotop() //file is still at EOF
> do while !odb:Eof
> //do something profound
> odb:skip(1)
> enddo
What about:
lOk := oDB:gotop()
if ! lOk
? oDb:Status:Description
else
do while !odb:Eof
//do something profound
lOk := odb:skip(1)
if ! lOk
? oDb:Status:Description
exit
endif
enddo
endif
The methods of the DbServer class return a logic indicating success or
failure.
Why don't you test the return value ?
If it fails you can usually see the reason for the failure in the
Server:Status Hyperlabel
--
Robert van der Hulst
AKA Mr. Data
Vo2Jet & Vo2Ado Support
www.sas-software.nl
mrdataREMOVE@sas-software.com