Page 1 of 1

Tema maria_Connect / FWCONNECT

Posted: Mon Dec 16, 2019 8:48 pm
by ruben Dario
Saludos al forum
Alquien por casualidad tiene toda la documentacion con el uso de cada uno de los Metodos.

Como hago una busqueda de un registro especifico de un query. Algun Ejemplo

Re: Tema maria_Connect / FWCONNECT

Posted: Mon Dec 16, 2019 9:49 pm
by cnavarro

Re: Tema maria_Connect / FWCONNECT

Posted: Mon Dec 16, 2019 10:29 pm
by ruben Dario
Gracias. por tu informacion,
Segun el ejemplo cual es la diferencia entre oCn:RowSet(.... y oCn:Query( ... segun veo funcionan igual , cual seria lo recomendable para el uso de cada uno.

oRs := oCn:RowSet( cTableNameOrcSqlStatement, [aParams], [lShowError] )
or
oQry := oCn:Query( cTableNameOrcSqlStatement, [aParams], [lShowError] )


oRs:SetFilter( filterexpression_with_dbfsyntax )
oRs:Filter := <newfilter>
Si uso SetFilter de esta manera no me funciona.
oDbf:SetFilter( variable='1' )
no me funciona, que error estoy cometiendo, no me funciona


Si tengo un Query y necesito buscar un registro especifico se usaria SetFilter , porque no genera un nuevo Query no se si me equivoco, Funciona igual cuando uno usa ADO (Tiene esta funciones para hacer busquedas y no genera un nuevo Query o Estancia como Find , Filter, Seek .

Tu sabes como se llama la clase de FWH no se si esta el fuente.

Lastima que exista ejemplos asi como tdolphin que se puedan reproducir.
Gracias

Re: Tema maria_Connect / FWCONNECT

Posted: Wed Dec 18, 2019 8:36 am
by nageswaragunupudi

Code: Select all

oDbf:Filter := "variable = 'abc'" // exactly like ADO
// OR
oDbf:SetFilter( "variable='abc'" )
With both ADO and FWH, the filter is set within the memory and does not read again from the server.
for filter expressions, use the familiar DBF syntax.

We can use parameters also.

Code: Select all

local nAge, cState

nAge := 40
cState := "NY"
oRs:SetFilter( "state = ? .and. age >= ?", { cState, nAge } )
// ....
// later
// ....
cState := "WA"
nAge := 50
oRs:ReFilter( { cState, nAge } )
 
Works even if the connection to server is lost.

SEEK:

oRs:Sort := <fieldname>
// OR
oRs:SetOrder( <fieldname> )

oRs:Seek( <value>, [lSoft], [lWild] ) --> lSuccess

Re: Tema maria_Connect / FWCONNECT

Posted: Wed Dec 18, 2019 8:48 am
by nageswaragunupudi
Please see
http://forums.fivetechsupport.com/viewt ... =3&t=33286

You can read the complete documentation.

References to WIKI are also given here

Re: Tema maria_Connect / FWCONNECT

Posted: Wed Dec 18, 2019 4:08 pm
by ruben Dario
Gracias G. N. Rao.

Te cuento no me funciona. Ni con seek ni setfilter o locate. No busca el registro
Lo hago asi
oDbf:SetFilter( xfind )
if oDbf:EOF()
fiarc := 0
endif

Pero usando ADO si funciona,

Te pregunto que libreria se requiere para usar este recurso.

Solamente Adicione libmysql.lib, tambien Adicione libmariadb.lib

Por curiosidad he visto una libreria mysqlclient.lib tu sabes como se usa.

Re: Tema maria_Connect / FWCONNECT

Posted: Wed Dec 18, 2019 5:08 pm
by nageswaragunupudi
I tell you it doesn't work for me. Neither with seek nor setfilter or locate. It does not search the registry.
I do it like this
oDbf: SetFilter (xfind)
if oDbf: EOF ()
fiarc: = 0
endif
I will post some working samples in my next post.
I ask you what library is required to use this resource.

Just add libmysql.lib, also add libmariadb.lib
Whether you use MySql (version 5.x) server or MariaDB server, we can use either libmysql.lib or libmariadb.lib. Both work the same way. But if we link with libmysql.lib we have to keeplibmysql.dll or if we link with libmariadb.lib, we need to keep libmariadb.dll in the exe path.

But if you use MySql server 8.0 onwards please see this post:
http://forums.fivetechsupport.com/viewt ... =6&t=38134
Out of curiosity I have seen a mysqlclient.lib library you know how it is used.
If we link mysqlclient.lib with our application, we need not use any DLL like libmysql.dll. But the size of our exe will be very large.

BUT
This lib is built with Microsoft Visual Studio and our application needs to be built with the same version of Microsoft Visual studio as the version used my MySQL to build the library.

So that is not an option for us.

Re: Tema maria_Connect / FWCONNECT

Posted: Sun Dec 22, 2019 4:55 am
by nageswaragunupudi
Small test program to test how filters work.

Code: Select all

#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB()

   oRs   := oCn:RowSet( "SELECT FIRST,STATE,AGE,SALARY FROM customer" )

   oCn:Close() // Let us close connection and see if filters still work

   XBROWSER oRs SHOW SLNUM TITLE "CUSTOMER : NO FILTER"

   oRs:SetFilter( "UPPER( ? ) $ UPPER(FIRST) .AND. STATE = ? .AND. AGE > ?", { "en", "NY", 30 } )
   oRs:GoTop()
   XBROWSER oRs SHOW SLNUM TITLE "CUSTOMER : " + oRs:cFilterExp

   oRs:ReFilter( { "o", "WA", 40 } )
   oRs:GoTop()
   XBROWSER oRs SHOW SLNUM TITLE "CUSTOMER : " + oRs:cFilterExp

return nil
 
Image

Image

Image