Uso a função Descend() pra ordem inversa.
Acontece que descobri um bug ao se usar codepage.
Acho que a correção não vai ser rápida, já que depende de cada codepage, e tem a compatibilidade Clipper pra pensar.
index on descend( Dtos( campodata ) + campohora )
Alguma idéia de contornar este uso e outros?
Obs. Descend() usa uma string que indexada dá a string de ordem contrária, por isso depende da codepage pra encontrar o Ascii.
Bug no Harbour - como contornar?
Moderador: Moderadores
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Bug no Harbour - como contornar?
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7929
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
Bug no Harbour - como contornar?
There is no bug in DESCEND() and it works as expected.
It's documented since Clipper days that for strings it is binary
function which reverts binary byte values so results are not always
sorted in reverted order if non ASCII based collation is used.
Harbour is 100% Clipper compatible here and for many applications
such DESCEND() behavior is expected and very important for data
integrity (i.e. as part of some simple encryption code or to
exchange data with other systems) so we do not plan to change it.
All is in Clipper docs freely available in the net. If you read
it then probably you will also find solution for your case, i.e.:
STR( DESCEND( phData ) ) + STR( DESCEND( SECS( phHora ) ) )
You can also easy create your own function which will work for
digits only, i.e.:
FUNCTION REVDIGIT( cVal )
RETURN hb_strReplace( cVal, "0123456789", "9876543210" )
best regards,
Przemek
It's documented since Clipper days that for strings it is binary
function which reverts binary byte values so results are not always
sorted in reverted order if non ASCII based collation is used.
Harbour is 100% Clipper compatible here and for many applications
such DESCEND() behavior is expected and very important for data
integrity (i.e. as part of some simple encryption code or to
exchange data with other systems) so we do not plan to change it.
All is in Clipper docs freely available in the net. If you read
it then probably you will also find solution for your case, i.e.:
STR( DESCEND( phData ) ) + STR( DESCEND( SECS( phHora ) ) )
You can also easy create your own function which will work for
digits only, i.e.:
FUNCTION REVDIGIT( cVal )
RETURN hb_strReplace( cVal, "0123456789", "9876543210" )
best regards,
Przemek
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- Itamar M. Lins Jr.
- Administrador

- Mensagens: 7929
- Registrado em: 30 Mai 2007 11:31
- Localização: Ilheus Bahia
- Curtiu: 1 vez
Bug no Harbour - como contornar?
Eu olhei rápido seu código e imaginei +- isso tirar a hora do descend()
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Saudações,
Itamar M. Lins Jr.
Itamar M. Lins Jr.
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Bug no Harbour - como contornar?
Isso resolve este caso específico.
Então, a saída é criar uma Descend() própria.
Muito esquisito.
Então, a saída é criar uma Descend() própria.
Muito esquisito.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
- JoséQuintas
- Administrador

- Mensagens: 20267
- Registrado em: 26 Fev 2007 11:59
- Localização: São Paulo-SP
Bug no Harbour - como contornar?
Pra strings de qualquer codepage, ainda testando.
Código: Selecionar todos
FUNCTION CPDescend( cText )
LOCAL cResult, acAscii := {}, nCont
STATIC cFrom, cTo
IF cFrom == NIL .OR. cTo == NIL
FOR nCont = 1 TO 255
Aadd( acAscii, Chr( nCont ) )
NEXT
ASort( acAscii )
cFrom := cTo := ""
FOR nCont = 1 TO 255
cFrom += acAscii[ nCont ]
cTo += acAscii[ 256 - nCont ]
NEXT
ENDIF
cResult := hb_StrReplace( cText, cFrom, cTo )
RETURN cResult
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"
https://github.com/JoseQuintas/