xbrowse - data nDataType

Post Reply
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

xbrowse - data nDataType

Post by nageswaragunupudi »

In the constructor method ( New ) of xbrowse, nDataType is assigned a value of DATATYPE_RDD. Even the methods SetArray or SetADO do not change the nDataType. Therefore the nDataType always remains to be DATATYPE_RDD.

The Initiate method of xBrowse executes SetRDD, because nDataType is DATATYPE_RDD, though SetArray or SetADO is already used. Execution of SetRDD in such cases is not necessary and seems logically not so appropriate, though SetRDD does not disturb the existing assignments of codeblocks. The relevant part of the Initiate method is given below

Code: Select all

   do case
   case ::nDataType == DATATYPE_RDD
      ::SetRDD()
   otherwise
      MsgStop("Data type not supported", "TXBrowse class")
   end case
I may be wrong, but it is possible that this was the code written in the initial stages of development before methods like SetArray / SetAdo were incorporated. Programmers can use xBrowse even for other data sources like TData / TDatabase or any data source for that matter.

Keeping this in view, it is suggested for consideration that the above lines in the initiate method may be changed as :

Code: Select all

   if ::nDataType == DATATYPE_RDD
      ::SetRDD()
   endif
The defines for DATATYPE_RDD and DATATYPE_ARRAY already exist in the xbrowse.prg.
New defines :
#define DATATYPE_ADO 2
#define DATATYPE_USER 9
can be added and SetArray can assign ::nDataType := DATAYPE_ARRAY and SetAdo can assign ::nDataType := DATATYPE_ADO.

This will also help the application program to retrieve the value of ::nDataType for meaningful use as may be appropriate.
Regards

G. N. Rao.
Hyderabad, India
User avatar
Biel EA6DD
Posts: 680
Joined: Tue Feb 14, 2006 9:48 am
Location: Mallorca
Contact:

Post by Biel EA6DD »

Hi NageswaraRao,thanks for the great job you are doing in the Class tXbrowse.

About the DATA nDataType, personally I find not mutch usefull, but you have reason, the methods SetArray and SetAdo must initialize it.
Personally, I thing the SetRdd is not necesarty to be called in the method Inititate, we usually (me allways) call the SetRDD,SetAdo or SetArray, before calling the CreateFrom... method.

Any way

Code: Select all

 if ::nDataType == DATATYPE_RDD 
      ::SetRDD() 
   endif 
is more correct than the current.
Saludos desde Mallorca
Biel Maimó
http://bielsys.blogspot.com/
Post Reply