Tema maria_Connect / FWCONNECT

Post Reply
User avatar
ruben Dario
Posts: 986
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Tema maria_Connect / FWCONNECT

Post 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
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
cnavarro
Posts: 5792
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Tema maria_Connect / FWCONNECT

Post by cnavarro »

C. Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
Si alguien te dice que algo no se puede hacer, recuerda que esta hablando de sus limitaciones, no de las tuyas.
User avatar
ruben Dario
Posts: 986
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Tema maria_Connect / FWCONNECT

Post 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
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Tema maria_Connect / FWCONNECT

Post 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
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Tema maria_Connect / FWCONNECT

Post 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
Regards

G. N. Rao.
Hyderabad, India
User avatar
ruben Dario
Posts: 986
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Tema maria_Connect / FWCONNECT

Post 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.
Ruben Dario Gonzalez
Cali-Colombia
rubendariogd@hotmail.com - rubendariogd@gmail.com
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Tema maria_Connect / FWCONNECT

Post 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.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Tema maria_Connect / FWCONNECT

Post 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
Regards

G. N. Rao.
Hyderabad, India
Post Reply