Page 1 of 1

Problems with DBSeek()

Posted: Tue Apr 03, 2007 6:47 pm
by jose_murugosa
If you look for the word dbseek in the forum you will see many recent messages refering to errors in searches.

Them all have in common the use of DBSEEK, of course, and many of them were resolved with searches of fwh objects or just not resolved.

What I really believe is that this function doesnt work properly, and It was working properly in March 2006.

In this sample you can see a very simple search, you will see if you write "DISKETTE" in both searches that the one builded with FWH March 2006 work properly and the builded with FWH 7.01 does´nt work (6.12 is the same), source code is attached too.

http://www.mediafire.com/?1junmnokzil

Please confirm me If I´m wright or wrong, and In both cases what can I do.
_________________

Posted: Tue Apr 03, 2007 11:26 pm
by Antonio Linares
Jose,

DbSkeek() its not a FWH function, but a Harbour/xHarbour one.

If there is a problem with DbSkeek() then we may check what Harbour/xHarbour build you are using and try to reproduce a possible bug in text mode (without FWH) and report it to the Harbour/xHarbour developers mailing list.

Please lets build a small sample that proves the existence or not of a DbSeek() bug. Also it is very important to rebuild the indexes as they could be corrupted.

Posted: Wed Apr 04, 2007 4:07 pm
by James Bott
Jose,

Here is the problem; the last character typed into the get is getting added to the search string twice so you see:

DD
DII
DISS
DISKK
etc.

Here is how you can test it. Add a msgInfo() as shown:

Code: Select all

STATIC FUNCTION Busqueda( oGetBusca, cKey, oDlg, oLbx, XNOMEC )
//ogetbusca el objeto get, xnomec la variable del get


    LOCAL RetornaBusca := ""

    MEMVAR oNome_Busca

    BusquedaInterna( oGetBusca, cKey, oDlg, @RetornaBusca, oLbx )

    msgInfo( retornaBusca ) // Add this line

    IF lOpcaoRadio=1  //-> Busqueda de opcion uno en Radio Button
        PRODUCTO->( DBSEEK( ALLTRIM( RetornaBusca), .t. ) )
    ELSE              //-> Busqueda de Opcion 2 do Radio Button
        PRODUCTO->( ORDWILDSEEK( "*" + ALLTRIM( RetornaBusca ) + "*", .F. ) )
    ENDIF

    oLbx:Refresh()

RETURN( .T. )
There were changes to the way oGet:bChange is processed which probably explains what is happening. Users were complaining that bChange didn't contain the last character typed so TGet was modified so that it did. And you are adding the last character, thus you now have the last character twice.

I suggest using oGet:bPostKey instead of oGet:bChange. bPostKey will contain the last character typed, and I have made a recommendation to Antonio to switch bChange back to its original processing as it is needed to reject invalid characters. Thus if you modify your code to work with bChange now, it will be broken again when Antonio changes the code back to its original form. You can search the forum for this discussion which was about two to three weeks ago.

I hope I have explained this well.

Regards,
James

Posted: Wed Apr 04, 2007 6:15 pm
by jose_murugosa
James,

As always you are wright, just a few hours before I recieve a sugestion in the same direction.

You are completely clear, that is the problem, I proved with my tget class of March 2006 and it works ok.

Thanks for your help and support, I will prove with 7.01 class using oGet:bPostKey code block.

Thanks!!!!!!!