The fix done here is in having a C return statement after throwing the 
error.  

There are many places in adsfunc.c where this is not done; lots have a 
"prg-level" hb_retni(0) style return, which pushes a return value but 
doesn't stop execution.  Presumably those are not blowing up
because they get to the end of the function before calling
anything else that might cause the error.

So the question is loudly begged: What's the right way to 
code "api" funcs like these that will call  hb_errRT_DBCMD ??

Should all such calls be followed by a   >> return; <<    ??
is any PRG level return value from hb_ret* ever used,
or other code ever executed after hb_errRT_DBCMD ?

I am indeed adding more stuff to adsfunc.c so if it needs an 
overhaul in error handling, now's a good time.

I still would appreciate knowing how to interpret:
>> hb_vmRequestQuery() is set - Couldn't create error ADSISEMPTY '(null)'

Thanks!

--
Brian Hays


> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Luis Krause Mantilla
> Sent: Monday, April 07, 2008 1:54 PM
> To: [EMAIL PROTECTED]
> Cc: Xharbour-Developers
> Subject: Re: [xHarbour-developers] hb_vmRequestQuery error - what does
> this mean?
> 
> Toninho:
> 
> Found the problem (besides the && instead of ||).
> This now correctly raises a r/t error if the param
> passed isn't char or numeric:
> 
> ---cut---
> HB_FUNC( ADSISEMPTY )
> {
>    UNSIGNED32 ulRetVal = ~AE_SUCCESS;
>    UNSIGNED16 pbEmpty = FALSE;
>    ADSAREAP   pArea;
>    UNSIGNED8* pucFldName;
> 
>    pArea = hb_rddGetADSWorkAreaPointer();
>    if( ! ISCHAR( 1 ) && ! ISNUM( 1 ) )
>    {
>       hb_errRT_DBCMD( EG_ARG, 1014, NULL, "ADSISEMPTY" );
>       return;
>    }
>    else if( pArea )
>    {
>       pucFldName = (UNSIGNED8 *) ( ISCHAR( 1 ) ? hb_parcx( 1 ) :
> ADSFIELD( hb_parni( 1 ) ) );
>       ulRetVal = AdsIsEmpty( pArea->hTable, pucFldName, &pbEmpty );
>    }
> 
>    if ( ! pArea || ulRetVal != AE_SUCCESS )
>    {
>       hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSISEMPTY" );
>    }
> 
>    hb_retl( pbEmpty );
> }
> ---cut---
> 
> Regards,
> 
> [EMAIL PROTECTED] wrote:
> >> Unrecoverable error 9000:
> >>
> >
> > Luis, try this function, here works for me:
> >
> > ---cut---
> > HB_FUNC( ADSISEMPTY )
> > {
> >    UNSIGNED32 ulRetVal;
> >    UNSIGNED16 pbEmpty;
> >    ADSAREAP   pArea;
> >    UNSIGNED8* pucFldName;
> >
> >    pArea = hb_rddGetADSWorkAreaPointer();
> >
> >    if( !ISCHAR( 1 ) && !ISNUM( 1 ) )
> >    {
> >       hb_errRT_DBCMD( EG_ARG, 1014, NULL, "ADSISEMPTY" );
> >    }
> >    else if( pArea )
> >    {
> >       pucFldName = (UNSIGNED8 *) ( ISCHAR( 1 ) ? hb_parcx( 1 ) :
> > ADSFIELD( hb_parni( 1 ) ) );
> >       ulRetVal = AdsIsEmpty( pArea->hTable, pucFldName, &pbEmpty );
> >    }
> >
> >    if ( !pArea || !( ulRetVal == AE_SUCCESS ) )
> >    {
> >       hb_errRT_DBCMD( EG_NOTABLE, 2001, NULL, "ADSISEMPTY" );
> >    }
> >
> >    hb_retl( pbEmpty );
> > }
> > ---cut---
> >
> >
> >
> >
> > Regards,
> >
> > Toninho.
> >
> >
> > ---------------------------------------------------------------------
> ----
> > This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> > Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> > Monday, April 7! Use priority code J8TLD2.
> >
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/
> javaone
> > _______________________________________________
> > xHarbour-developers mailing list
> > xHarbour-developers@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/xharbour-developers
> >
> >
> 
> --
> Luis Krause Mantilla
> lkrausem at shaw dot ca
> luis_krause at hotmail dot com
> "May the Source be with GNU"
> 
> 
> 
> -----------------------------------------------------------------------
> --
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
> Register now and save $200. Hurry, offer ends at 11:59 p.m.,
> Monday, April 7! Use priority code J8TLD2.
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/
> javaone
> _______________________________________________
> xHarbour-developers mailing list
> xHarbour-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/xharbour-developers
> 
> No virus found in this incoming message.
> Checked by AVG.
> Version: 7.5.519 / Virus Database: 269.22.8/1363 - Release Date:
> 4/7/2008 8:56 AM
> 


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to