On Fri, 08 May 2009, Mindaugas Kavaliauskas wrote:

Hi,

> I'm using ADSX RDD, but sometimes I need to call ADS*() function. It does 
> not work, because hb_adsGetWorkAreaPointer() know nothing about ADSX. I 
> need to duplicate existing ADS*() function, changing the only function 
> hb_adsGetWorkAreaPointer() call to hb_adsxGetWorkAreaPointer().
> What is the more beautiful way to do this? I mean, I'd like to make ADS*() 
> functions work for all RDDs inherited from ADS RDD.

Good question. There is no easy way to detect inheritance order. We do
not keep such information in general RDD structures so it will have to
be implemented in given GT.
In this case probably the easiest way is using new DBI_ or RDDI_ action.
To not cause additional overhead you can add action which will not operate
on given item value so you can pass NULL as parameter, f.e.:
add to dbinfo.ch:

   #define RDDI_ADSBASED   45 /* check if given RDD inherits from ADS* ones */

add to adsRddInfo() method:

      case RDDI_ADSBASED:
         break;

and changed hb_adsGetWorkAreaPointer():

   ADSAREAP hb_adsGetWorkAreaPointer( void )
   {
      ADSAREAP pArea = ( ADSAREAP ) hb_rddGetCurrentWorkAreaPointer();

      if( pArea )
      {
         if( SELF_RDDINFO( SELF_RDDNODE( pArea ),
                           RDDI_ADSBASED, 0, NULL ) == HB_SUCCESS )
            return pArea;
      }
      return NULL;
   }

best regards,
Przemek
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to