Tema maria_Connect / FWCONNECT

Tema maria_Connect / FWCONNECT

Postby ruben Dario » Mon Dec 16, 2019 8:48 pm

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
ruben Dario
 
Posts: 1070
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Tema maria_Connect / FWCONNECT

Postby cnavarro » Mon Dec 16, 2019 9:49 pm

Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6549
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: Tema maria_Connect / FWCONNECT

Postby ruben Dario » Mon Dec 16, 2019 10:29 pm

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
ruben Dario
 
Posts: 1070
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Tema maria_Connect / FWCONNECT

Postby nageswaragunupudi » Wed Dec 18, 2019 8:36 am

Code: Select all  Expand view  RUN
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  Expand view  RUN

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: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tema maria_Connect / FWCONNECT

Postby nageswaragunupudi » Wed Dec 18, 2019 8:48 am

Please see
viewtopic.php?f=3&t=33286

You can read the complete documentation.

References to WIKI are also given here
Regards

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

Re: Tema maria_Connect / FWCONNECT

Postby ruben Dario » Wed Dec 18, 2019 4:08 pm

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
ruben Dario
 
Posts: 1070
Joined: Thu Sep 27, 2007 3:47 pm
Location: Colombia

Re: Tema maria_Connect / FWCONNECT

Postby nageswaragunupudi » Wed Dec 18, 2019 5:08 pm

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:
viewtopic.php?f=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: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Tema maria_Connect / FWCONNECT

Postby nageswaragunupudi » Sun Dec 22, 2019 4:55 am

Small test program to test how filters work.
Code: Select all  Expand view  RUN
#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
User avatar
nageswaragunupudi
 
Posts: 10663
Joined: Sun Nov 19, 2006 5:22 am
Location: India


Return to FiveWin para Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 58 guests