xsharp.eu • move in DBFCDX orders to speed up filters
Page 1 of 1

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 12:14 pm
by wriedmann
Hello,
in order to speed up filter in DBFCDX (both in VO and later in X#), I would like to process only the orders.
To explain it better: I would like to read only the order, without move the record pointer in the DBF, and build a in-memory array of the order values, and then use this array to build filters.
Unfortunately I have not found any function that lets me do that....
Any help would be very welcome!
Wolfgang
P.S. if in VO such things are not available, but in the X# RDD, this would be another reason to move to X# (and something I could "sell" to my customers).

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 12:39 pm
by robert
Wolfgang,
This is doable.
I might be able to define a special DBOI_ value to retrieve the list of recno - keyvalue pairs for an index or for a part of an index (if you have set a scope first).
The key values would be represented as byte arrays, and for numeric and date keys these would be encoded just like FoxPro encodes them.
The CDX keys are all stored in Leaf pages. See https://github.com/X-Sharp/XSharpPublic ... afPage.prg
I could return a list of a subset of the fields inside CLASS CdxLeaf that you can find in that page. I don't think you need the other properties from that class.

Robert

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 12:50 pm
by wriedmann
Hi Robert,
that would be great!
Wolfgang
P.S. the implicit answer is then that VO cannot do that.... but it seemed to me that Clipper 5.3 could do something like this

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 12:57 pm
by wriedmann
Hi Robert,
another question: the X# RDD currently supports custom orders?
It is ages that I have not used them, but I think I could need them, combined with the order seek.
Wolfgang

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 3:31 pm
by Karl-Heinz
Hi Wolfgang,

X# recognizes a VO created custom order and you can already create with X# a custom order, but OrdKeyAdd() and OrdKeyDel() are not working yet. i just tried it in my test app and it still fails..

Code: Select all

METHOD PshAddToCustomOrder() 


//	IF DbOrderInfo ( DBOI_KEYADD , , "Order3" )
		
	IF SELF:server:OrderKeyAdd ( "Order3" ) 		
		
		MsgInfo ( "'" + AllTrim ( SELF:server:FIELDGET ( #last )) + "' added to Custom order 'ORDER3' " ) 
		
		
	ELSE 
		 MsgInfo ( "OrderKeyAdd() failed" ) 
		
	ENDIF 
	
	RETURN SELF 

I searched in GitHub and found this in the DbfCdx.prg. Maybe it's on the way ;-)

Code: Select all

                CASE DBOI_KEYADD
                    IF workOrder != NULL
                        info:Result := workOrder:AddKey(SELF:Recno)
                    ELSE
                        info:Result := FALSE
                    ENDIF
                CASE DBOI_KEYDELETE
                    IF workOrder != NULL
                        info:Result := workOrder:DeleteKey(SELF:Recno)
                    ELSE
                        info:Result := FALSE
                    ENDIF. 
regards
Karl-Heinz

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 3:46 pm
by robert
Wolfgang,
VO (and Vulcan) both have the support to manipulate what is called "RecordLists" inside the CDX RDD.
It has never been documented and brought to the surface.
If you look in volibSyslibRDD.PRG you will find a commented out section with DBI_RL_ defines and functions that start with Rl().
You could use this in VO to create recordlists or retrieve the internal recordlist created by the RDD . rlNewQuery() would take an expression and get it evaluated by the RDD and return a new recordlist, there are functions to mark a record as set or cleared in the recordlist and rlNextRecNo() and rlPrevRecNo() find the next and previous record in the recordlist . You can also created multiple recordlists and And or Or them to combine the selected records.

"YouKnowWho" decided that we should not "Unlock" this. You can imagine that MrData would have wanted to do so.

Robert

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 3:52 pm
by robert
Wolfgang,
wriedmann wrote: another question: the X# RDD currently supports custom orders?
It is ages that I have not used them, but I think I could need them, combined with the order seek.
This is on my todo list. And like Karl discovered, there is partial support for this in the RDD layer but not yet in the Tag layer.

Robert

move in DBFCDX orders to speed up filters

Posted: Wed Jan 08, 2020 4:09 pm
by wriedmann
Hi MrData,

thank you very much for your anser(s)!

I don't have any doubts your todo list is huuuuge <g>.
And I was thinking we could start collecting money for the DBFServer product <g>....

Wolfgang