FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour No encuentra Registro con FWHMariaDB
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

No encuentra Registro con FWHMariaDB

Posted: Fri Jul 05, 2019 07:35 PM
Buenas estimados

No logro actualizar datos si existe el registro
Hago lo siguiente:
Code (fw): Select all Collapse
 FWCONNECT oCn HOST ViaServer USER "root" PASSWORD cPass DB "rrhh"
 oCtrl:=oCn:RowSet( "SELECT * FROM control ORDER BY usuario" )

  If oCtrl:Seek( cUser )
     ? "Found"
     oCtrl:Update( "USUARIO,ENTRA", { cUser,Datetime()} )
   Else
     ? "NoFound"
    oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} ) 
   Endif

Siempre me sale NoFound

Gracias por la ayuda
Saludos,



Adhemar C.
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Fri Jul 05, 2019 08:13 PM

Hi,

I think you should change this:

  oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

By this:

  oCtrl:Append()
  oCtrl:usuario := cUser
  oCtrl:entra := DateTime()
  oCtrl:Save()
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

Re: No encuentra Registro con FWHMariaDB

Posted: Fri Jul 05, 2019 10:54 PM

Thanks for answering Vilian

The problem is that it does not find if it already exists

Saludos,



Adhemar C.
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Fri Jul 05, 2019 11:55 PM

Here it's working perfect !

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 12:03 AM
vilian wrote:Hi,

I think you should change this:

oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

By this:

oCtrl:Append()
oCtrl:usuario := cUser
oCtrl:entra := DateTime()
oCtrl:Save()


This works
Code (fw): Select all Collapse
oCtrl:Append( "USUARIO,ENTRA", { cUser,Datetime()} )

Actually, this is simpler and recommended.
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 12:08 AM
acuellar wrote:Thanks for answering Vilian

The problem is that it does not find if it already exists


1. Please let us know the FWH version you are using. Let us test with your version.

2. If you are using a much older version:
Please try adding
Code (fw): Select all Collapse
oCtrl:SetOrder( "usuario" )

just after opening the rowset.

3. This sample program is working correctly here.
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB()
   oRs   := oCn:RowSet( "select * from states order by code" )
   if oRs:Seek( "ny" )
      ? "Found", oRs:Code, oRs:Name
   else
      ? "not found"
   endif
   oRs:Close()
   oCn:Close()

return nil


Can you test this program with your version and let us know if the seek is working for you.
Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 03:27 PM

Thanks Mr. Rao.

I have FWH1804

It works with If oCtrl:Seek( Alltrim(cUser) )
And I have SET EXACT OFF

Other
what function replaces ClipValue2SQL()

Thanks very much

Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 03:36 PM

oCn:ValToSQL( uValue )

But when you use the methods of Connection and Rowset objects, you never need to use oCn:ValToSQL( uValue ) directly.
We recommend the oCn and oRs methods to take care of the conversion rather than you do it independently.

May we know why and where do you need to use this directly?

Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 04:39 PM

Thanks Mr Rao

May we know why and where do you need to use this directly?
oRs:Filter:="TIPO = " + oCn:ValToSQL( cTipo )

Regards

Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 06:00 PM
You can also try
Code (fw): Select all Collapse
oRs:SetFilter( "TIPO = ?", { cTipo } )


If you use this approach, then later you can use refilter.
Example:
Code (fw): Select all Collapse
oRs:SetFilter( "state = ?", { "NY" } )
// after some work
oRs:Refilter( { "WA" } )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 07:02 PM
Thanks very much

Because when you filter in the search locate records that do not belong to the filter

Code (fw): Select all Collapse
   oSQL:SetFilter( "TIPO = ?", { cTipo } )
   oSQL:SetOrder( "nombre",,.F. )
   nRec := oSQL:KeyCount() 
   oSQL:GoTop()  
    @41,192 xBrowse oBrw Of oWnd SIZE aCoors[4]-515, aCoors[3]-258 PIXEL DATASOURCE oSQL AUTOSORT COLUMNS "NOMBRE" HEADER "NOMBRE" SIZES nAncho
   oBrw:nMarqueeStyle:=4 
   oBrw:lIncrFilter:= .t.
   oBrw:lSeekWild  := .t.
   oBrw:CreateFromCode()
  @4,160 SAY oBrw:oSeek PROMPT oBrw:cSeek SIZE 120,12 PIXEL OF oBrw  PICTURE '@!'


Regards
Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 07:19 PM

You are right.
That is an issue with xbrowse of all datasources dbf, ado, etc.
Issuse with DBF is fixed in FWH 1905
We try to fix the issue with other datasources also now.

Regards



G. N. Rao.

Hyderabad, India
Posts: 1710
Joined: Tue Oct 28, 2008 06:26 PM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 07:58 PM

Thanks

:(

Saludos,



Adhemar C.
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Sat Jul 06, 2019 08:00 PM

For now, in case you want to use incremental filters with xbrowse, use a rowset read with where clause. Do not use filter.

Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: No encuentra Registro con FWHMariaDB

Posted: Mon Jul 08, 2019 12:26 AM

Mr. Adhemar

This issue is resolved in FWH1906 for MariaDB RowSets also.
Now the browse incremental filters do not disturb the existing filters and work as additional filters.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion