FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin para Harbour/xHarbour Pasar query a un arreglo
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pasar query a un arreglo
Posted: Mon Jul 01, 2019 03:34 AM
Documentation:

For documentation of Connection class and Rowset class, please see these postings:
viewtopic.php?f=3&t=33286

Please see the documentation in WIKI:
http://wiki.fivetechsoft.com/doku.php?i ... connection

http://wiki.fivetechsoft.com/doku.php?i ... ariarowset

Samples:

fwh\samples\maria01.prg ... maria*.prg

Migration:

To use native FWH lib, you need not migrate your entire application. You can continue to run your application in Dolphin and use native libs for new modules only.

If you are already connected to the server with Dolphin, you can easily get fwmariadb connection like this;
Code (fw): Select all Collapse
oCn := maria_Connect( oServer ) // where oServer is Dolphin server

and start using FWH native libs for new modules or some work in the same modules. In other words, you can use both dolphin and fwh libs at the same time side by side.

Over a period of time, you can convert existing modules at your convenience.
Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Pasar query a un arreglo
Posted: Mon Jul 01, 2019 03:56 AM

Thank you very much for your help... :shock:

Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pasar query a un arreglo
Posted: Mon Jul 01, 2019 04:25 AM

May I know your FWH version?

Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Pasar query a un arreglo
Posted: Mon Jul 01, 2019 04:36 AM
nageswaragunupudi wrote:May I know your FWH version?

18.05, gracias... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pasar query a un arreglo
Posted: Mon Jul 01, 2019 05:18 AM

In FWH1805, only the simple syntax oRs:GetRows() works without any parameters.
The extended syntax given above works from FWH1807.

Regards



G. N. Rao.

Hyderabad, India
Posts: 2064
Joined: Fri Jan 06, 2006 09:28 PM
Re: Pasar query a un arreglo
Posted: Tue Jul 02, 2019 12:47 AM
nageswaragunupudi wrote:In FWH1805, only the simple syntax oRs:GetRows() works without any parameters.
The extended syntax given above works from FWH1807.

Ok, lo tendre en cuenta e ire probando que puedo hacer, gracias...saludos... :-)
Dios no está muerto...



Gracias a mi Dios ante todo!
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Pasar query a un arreglo
Posted: Fri Oct 01, 2021 03:57 AM
hola
si quiero que me devuelva un array para luego usarlo en un combobox,

Code (fw): Select all Collapse
METHOD cargarSucursales()
   LOCAL cSql, oQry

   TEXT into cSql
   Select
   s.nombre
   FROM tbsucursal s
   order by s.nombre
   ENDTEXT

   oQry:= ::oCnx:QUERY(cSql)

   RETURN oQry:getRows("nombre")


eso me devuelve un ARRAY multidimensional, yo solo quiero esto:
"sucursal 1"
"sucursal 2"
"sucursal 3"
FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pasar query a un arreglo
Posted: Fri Oct 01, 2021 06:39 AM
Code (fw): Select all Collapse
aList := ArrTranspose( ::oCnx:Execute( "select nombre from tbsucursal order by nombre" ) )[ 1 ]
Regards



G. N. Rao.

Hyderabad, India
Posts: 1956
Joined: Fri Oct 07, 2005 07:08 PM
Re: Pasar query a un arreglo
Posted: Sun Dec 05, 2021 09:37 AM

Me gustaría (si es que ya no existe) que getRows te de la posibilidad de agregar columnas vacias al array,

Por ejemplo:
Supongamos que la consulta devuelva 2 columas: id, nombre y 5 rows. Que yo pueda hacer esto:

a:= oQry:getRows(, {"id", "nombre", 0.0, .f.})

y el resultado seria
a:= [
1, "gustavo", 0.0, .f.,
2, "miguel", 0.0, .f.
3, "angel", 0.0, .f.
4, "velazquez", 0.0, .f.
5, "fernandez", 0.0, .f.
]

FWH 21.02
Harbour 3.2.0dev (r2104281802)
Copyright (c) 1999-2021, https://harbour.github.io/
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Pasar query a un arreglo
Posted: Sun Dec 05, 2021 05:21 PM
Code (fw): Select all Collapse
a:= oQry:getRows( nil, nil, {"id", "nombre", { || 0.0 }, { || .f. } } )
// OR
a := oQry:GetRows( nil, nil, { "id", "nombre", "0.0". ".f." } )


"0.0" and ".f." will be returned as numeric 0.0 and logical .f..
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion