Przemek:

Thanks.  If I hear no other feedback, I'll remove the RTE so the code
you described can still work.

Does anyone else have an opinion as to whether it's useful to add
the feature of an explicit NIL value to mean to "return to default 
direction" ?   Or is it not worth the trouble, and unlikely to
be supported in other RDDs anyway?

--
Brian Hays


> -----Original Message-----
> From: Przemysław Czerpak [mailto:dru...@acn.waw.pl]
> Sent: Tuesday, December 01, 2009 3:15 PM
> To: bhays; 'Viktor Szakáts'; Harbour Project Main Developer List.
> Subject: Re: CHANGELOG: 2009-12-01 01:37 UTC-0800 Brian Hays
> 
> On Tue, 01 Dec 2009, Brian Hays wrote:
> 
> > I need help with a decision on whether to throw an error or not.
> Please see discussion below.
> > 2009-12-01 01:37 UTC-0800 Brian Hays <bhays/at/abacuslaw.com>
....


> Dynamic DESCEND flag is not supported also in many Clipper RDDs.
> So far the standard way in Clipper and [x]Harbour to check if dynamic
> descending order is supported was checking the value returned by:
>    ordDescend( [<tag>], [<bag>] )
> just after:
>    ordDescend( [<tag>], [<bag>], <lOnOff> )
> i.e.:
>    ordDescend( nTag,, .T. )
>    ? "order:", iif( ordDescend( nTag ), "descending", "ascending" )
> 
> such code works for any RDDs and will work also for ADS if you do not
> enable such RTE.
> In all core native RDDs (NTX, CDX, NSX) I implemented dynamic descend
> flags so such RTE cannot be generated so I think that it will be most
> important for ADS users which without RTE can easy create the same code
> for different ADS versions.
> 
> > A second question:  AdsSetIndexDirection takes an unusual flag that
> > EITHER takes 0 to return to the original state, or TRUE to 
> > "reverse the direction from the current state"
> > IOW, they have the ability to “go back to normal which IIUC
> > Clipper/(x)Harbour does NOT.

> To clarify some technical issues.
> In indexes like CDX, ADI or NSX there is no "normal" state.
> Physically they exist only in ascending order and descending
> order is done by logical flag (BTW I'm surprised why adding
> user interface to change such logical flag took such long time
> ADS authors) so we can talk only about default settings for
> this flag stored in index header. Only NTX format uses reverted
> key orders in index file to implement default descending sorting
> so in our DBFNTX I implemented both versions and it's possible
> to use dynamic switching too just like in CDX or NSX formats.
> 
> I guess that you are asking about method of "resetting" DESCEND
> flag to value chose by RDD when index is open. So far we do not
> have such functionality though it can be easy implemented if we
> agree how to inform RDD that we want to "reset" this flag.
> 
> > Am I missing something?  It would be nice to have a value to "return
> > to native state" in our syntax
> > instead of requiring a close/re-open of the file.  Note: Once the
> > direction has been dynamically changed, ordDescend() is only 
> > capable of returning the CURRENT state; there is no
> > api to get the Original direction setting.
> 
> Please remember that we are always in native state. The order direction
> is in practice only logical flag. Usually structural code have to safe
> and restore descend flag settings because it cannot assume that it was
> in the same state as after opening table. Operation like resetting
> order
> DESCEND flag to the same state as after opening table are not
> structural
> so are less usable in most of code. Probably the only one type of code
> I can imagine is some DBU like program which may want to display some
> information with default order settings.
> 
> > In some COMIX functions, there was the difference between an explicit
> NIL
> > and an ignored parameter
> > to distinguish between intentions.  I never liked having to explain
> it to
> > people, BUT
> > this may be an instance where explicitly passing NIL as the third arg
> could
> > be the flag
> > to revert to the original state of the index.
> 
> NIL can be used for such job. In such case it's necessary to modify
> ordDescend() in dbcmd53.c and change:
>       pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_LOGICAL );
> to:
>       pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_LOGICAL );
>       if( pOrderInfo.itmNewVal )
>          pOrderInfo.itmNewVal = hb_param( 3 , HB_IT_NIL );
> 
> > Is there a good way to add the extended value/functionality of either
> > learning or setting the original direction?
> 
> The other method is defining new DBOI_* action for dbInfo() to extract
> default DESCEND flag settings which can be used as ordDescend()
> parameter.
> 
> best regards,
> Przemek
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 8.5.426 / Virus Database: 270.14.67/2506 - Release Date:
> 12/01/09 07:59:00


------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
xHarbour-developers mailing list
xHarbour-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xharbour-developers

Reply via email to