On Thu, 28 Jan 2010, smu johnson wrote:

Hi,

> I heard that Przemek is the guru to ask about SixCDX questions from Viktor.
> Well I think I have found a Clipper / Harbour incongruency.  (or maybe I'm
> going about it the wrong way)... :).  In the case below, whenever I use 3
> args for SX_KEYADD, and three args are present...
> I have included the result, and the code.  I had to get someone else who
> knew Clipper better than I did to write a Hello World-sized app to reproduce
> the error.  Problem is, this never was an issue when using Clipper 5.2e.
> I have found that if i just use two params instead of three, I get no
> errors, (though I'm quite sure it is because something completely different
> is being accomplished, that I wouldn't want).
> ---- The execution:
> C:\hbm>hello.exe
> Error DBFNTX/1052  Unknown error
> Called from SX_KEYADD(0)
> Called from HELLO(11)
> ---- My source code below:
> #include "hbsix.ch"
> USE DATBASE
> INDEX ON SXCHAR(10) TAG "MIKEY" OF TEMP
> DBGOTOP()
> DO WHILE !EOF()
>   IF SX_KEYADD("mikey",1,padr("mike",10))
>     WAIT
>   ENDIF
>   DBSKIP()
> ENDDO
> -------
> By the way, the DATBASE is an arbitrary .dbf I picked.  I picked some other
> .dbf files I had handy, and the same thing occured.

In this example you are using DBFNTX and the code you create use
some hidden SIX3 SIXCDX feature.
In SIX3 if index expression starts with "SXCHAR(", "SXDATE(", "SXNUM("
or "SXLOG(" then it's automatically marked as TEMPLATE index which is
EMPTY. It also means that above code in Clipper does not execute SX_KEYADD()
even once because after:
   INDEX ON SXCHAR(10) TAG "MIKEY" OF TEMP
empty index is created and it's set as controlling index.
I intentionally haven't replicated this behavior in core RDD though
in SIXCDX Harbour RDD there is inactive initial code which enables it
(see src/rdd/dbfcdx/dbfcdx1[3497]). I simply do not like such hacks
(some partial key expression analyzes to create completely different
index) so in Harbour you have to explicitly use CUSTOM or EMPTY clause
in INDEX ON command to create indexes where you can manually add and
delete keys using sx_keyAdd()/sx_keyDel() or ordKeyAdd()/ordKeyDel():
   INDEX ON SXCHAR(10) TAG "MIKEY" OF TEMP EMPTY
or is you do not use hbsix.ch:
   INDEX ON SXCHAR(10) TAG "MIKEY" TO TEMP CUSTOM
otherwise above RTE is generated. 1052 is CL53 DBFCDX compatible error
when user tries to execute key add or del operation on normal non custom
index. If it's really big problem then I can change it in Harbour SIXCDX
RDD to work like SIX3 RDD (without above RTE and with automatic TEMPLATE
index attribute setting) but I cannot touch DBFCDX and other RDDs where
I would like to keep more strict behavior which is also CL53 DBFCDX/COMIX
compatible.

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to