xbrowse - data nDataType
Posted: Sun Dec 30, 2007 8:58 pm
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
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 :
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.
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
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
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.