Page 1 of 4

Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Sat Aug 13, 2016 4:30 am
by cmsoft
Estimados
Como hago para que la busqueda autoincremental con Xbrowse y Dolphin me encuentre texto con la letra Ñ
La tabla tiene el CHARSET utf8 y la Collation utf8_general_ci
El orden lo muestra asi:
CAMISA
CAÑA
CANDADO
CANILLA
CAÑO
CANOBOTE

Pero cuando escribo CAÑO en la busqueda incremental no abanza mas alla de candado
Alguna sugerencia?
Gracias de antemano

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Sun Aug 14, 2016 6:47 pm
by cnavarro
Los COLLATION siven para cambiar la manera en que ordenamos la información. Si nos fijamos en los COLLATION presentes para UTF-8, podemos apreciar de que existen 2 que llaman la atención: utf8_spanish_ci y utf8_spanish2_ci.

La diferencia entre ambos es que la primera se ocupa para español moderno mientras que la segunda se aplica a español tradicional. De esta forma, podemos ver que ambos incorporan el uso de la “Ñ” como una letra entre la “N” y la “O”, de forma que si tenemos los siguientes registros:


Una COLLATION utf8_spanish_ci ordenará los registros de una forma mientras que utf8_spanish2_ci la ordenará de otra, debido a que el español tradicional considera “ch” como una letra entre la “C” y la “D”. Asimismo, considera el uso de la letra “LL” como una letra entre la “L” y “M”.


Además, utf8 general-ci, que, entre otras cosas, considera iguales las letras "N" y "N", y también entre mayúsculas y minúsculas (utf8 General ** - ** ci). Esto también se aplica a las tildes, no hay diferencia entre papa y papá

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Mon Aug 15, 2016 6:48 pm
by cmsoft
Gracias Cristobal por responder. Lei eso, probé cambiar la tabla, pero igual al hacer la busqueda con xbrowse no ubica el registro que tiene el criterio escrito en cSeek. No se si hay algun seteo en xbrowse para indicar la coleccion de caracteres.

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Mon Aug 15, 2016 7:27 pm
by cnavarro
Yo no uso Dolphin, y creo que el xbrowse funciona correctamente
Qué versión de Fwh utilizas, Harbour o xHarbour?


Image

Image

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Mon Aug 15, 2016 7:32 pm
by cnavarro
cmsoft wrote:Gracias Cristobal por responder. Lei eso, probé cambiar la tabla, pero igual al hacer la busqueda con xbrowse no ubica el registro que tiene el criterio escrito en cSeek. No se si hay algun seteo en xbrowse para indicar la coleccion de caracteres.


En todo caso tendrás que indicarle a la tabla el juego de caracteres que utilizas, bien a nivel de seteo general, de tabla o de columna

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Mon Aug 15, 2016 8:41 pm
by nageswaragunupudi
In my tests xbrowse incremental seek is working correctly. Assuming that you are using Spanish codepage.

But the above order does not appear to be correct. The order should be

CAMISA
CANDADO
CANILLA
CAÑA
CAÑO
CANOBOTE

This is because utf8_general_ci does not collate your data correctly. You will get correct collation if you use utf8_spanish2_ci or utf8_spanish_ci or latin1_spanish_ci

For me incremental seek is working correctly with Dolphin and also FWH's MySql.

This is my test program. Column is created with "utf8_spanish2_ci" collation.

Code: Select all  Expand view

#include "fivewin.ch"
#include "tdolphin.ch"

REQUEST HB_LANG_ES
REQUEST HB_CODEPAGE_ESWIN

static oCn, oServer
static cHost := "localhost", cUser := "gnrao", cPwd := "secret", cDB := "fwh"
static cCollate   := "utf8_spanish2_ci"

//----------------------------------------------------------------------------//

function Main()

   HB_CDPSELECT("ESWIN")
   HB_LangSelect( "ES" )

   FWMYSQL_test()
   Dolphin_test()

return nil

//----------------------------------------------------------------------------//

function FWMYSQL_test()

   local oRs
   local aData := { { "CAMISA" }, { "CAÑA" },  { "CANDADO" }, { "CANILLA" }, ;
                  { "CAÑO" }, { "CANOBOTE" } }

   FWCONNECT oCn HOST cHost USER cUser PASSWORD cPwd DATABASE cDB

   if oCn:TableExists( "cana" )
      ocn:DropTable( "cana" )
   endif
   oCn:CreateTable( "cana", { { "name", 'C', 20, 0, cCollate } }, .t., cCollate )

   oCn:Insert( "cana", { "name" }, aData )

   oRs   := oCn:RowSet( "cana" )
   oRs:Sort := "name"  // Sorting at Client by RowSet
   oRs:GoTop()

   xbrowser oRs TITLE "FWH " + cCollate AUTOSORT

return nil

//----------------------------------------------------------------------------//

function Dolphin_test()

   local oQry

   CONNECT oServer HOST cHost USER cUser PASSWORD cPwd DATABASE cDB

   oQry  := oServer:Query( "select * from cana order by name" )

   XBROWSER oQry TITLE "Dolphin " + cCollate AUTOSORT

return nil

//----------------------------------------------------------------------------//
 


Both FWH and Dolphin show the results in the correct order and both Incremental Seeks work correctly.

Image

Image

For some reason, if you can not change the collation and have to stay with "utf8_general_ci" only, FWH rowset still displays the data in correct order. Dolphin displays data the same way as sorted by the MySql server. The problem is with the Collation Order and has nothing to do with Dolphin.

To check please change the static variable
Code: Select all  Expand view

static cCollate   := "utf8_general_ci"
 

and re-execute the above program.

FWH works as expected if we let the client do the sorting.

Image

Dolphin displays the data returned by the Server correctly. Even though the data is not correctly sorted, Dolphin still does an excellant job to do the incremental seek:

Image

In your case you may get better results by copying data from Dolphin Query to Array and browse the array. Sorting and incremental seek work as expected.

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 3:02 am
by cmsoft
Estimado Rao:
Cambie la tabla collation utf8_spanish_ci, me ordena bien el browse, pero pruebo su ejemplo y tampoco me funciona la busqueda.
Utilizo HARBOUR 3.1.0, Borland 5.82 y FW 11.12. Puede ser que sea mi version de FW?

La busqueda de mi xbrowse para Dolphin dice esto:
Code: Select all  Expand view
static FUNCTION DolphinSeek( c, oQry, oBrw )

   LOCAL nStart
   LOCAL uData, nNum
   LOCAL cSortOrder

   STATIC aLastRec := {}

   nNum = AScan( oBrw:aCols, {| o | !Empty( o:cOrder ) } )

   if nNum < 1
      RETURN .f.
   endif

   cSortOrder = oBrw:aCols[ nNum ]:cSortOrder

   IF Len( aLastRec ) < Len( c )
      IF Len( aLastRec ) == 0
         nStart = 1
      ELSE
         nStart = oQry:RecNo()
      ENDIF
      AAdd( aLastRec, nStart )
   ELSE
      ADel( aLastRec, Len( aLastRec ) )
      ASize( aLastRec, Len( aLastRec ) - 1 )
      IF Len( aLastRec ) == 0
         nStart = 1
      ELSE
         nStart = ATail( aLastRec )
      ENDIF
   ENDIF

   oQry:Seek( c, cSortOrder, nStart, oQry:LastRec(), .T., .T. )

RETURN .T.

Agradezco su ocupacion

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 9:17 am
by cnavarro
Si lo has probado con un array y con una DBF y no te funciona, lo normal es que sea la versión de Fw

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 9:26 am
by nageswaragunupudi
Your dolphinseek is okay. I do not also think it is FW version issue. There is not much change in the code relating to dolphin incremental seek. Only change after your version is for incremental filter. I am not able to comment unless I actually try with the old version.

The problem is coming with Accented char.

We get some idea if you try the example with the same data in array. Can you check and see if that works well?

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 11:53 am
by cmsoft
Estimado Mr. Rao:
Con los datos pasados a una array el seek funciona correctamente!!
Donde puede estar el error?
Gracias por su tiempo!

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 12:28 pm
by acuellar
Cmsoft

Has intentado con el collaction uft8_spanish2.ci

Con ese funciona correctamente.

Image

Saludos,

Adhemar

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 1:29 pm
by MarioG
Estimado;
Tengo definida así una tabla con apellidos y nombres:
(aunque la seleccione a sentimiento :oops: )
    COMMENT='Tabla de Tutores'
    COLLATE='latin1_spanish_ci'
    ENGINE=InnoDB
El orden es correcto, y la búsqueda responde (uso MariaDB)
Image

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Tue Aug 16, 2016 6:23 pm
by cmsoft
Esta es la imagen donde busco CAÑO pero el browse no se mueve mas alla de CA (ya que no reconoce la Ñ
Image
Esta es la imagen mostrando que si existen nombres con Ñ y estan bien ordenados para el alfabeto español (Aca me desplazo con el cursor solo a efectos de mostrar que existen datos)
Image

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Thu Aug 18, 2016 6:35 pm
by cmsoft
Estimados Rao / Cristobal:
Acabo de adquirir la version 16.06 de FW, hago las pruebas que me indicaron y me sigue dando el mismo error (no encuentra la ñ). Si la encuentra con ARRAY y con FWMYSQL. Si les envio el acceso a mi base de datos, podrian verificarlo?
Desde ya muchas gracias.
Mi email es cmsoft70 arroba gmail com

Re: Seek en XBrowse con Dolphin texto con Ñ

PostPosted: Thu Aug 18, 2016 7:28 pm
by cnavarro
El problema lo tienes cuando usas Dolphin?
Has probado a realizar un XBROWSER, como los ejemplos que ha puesto Mr Rao?