Pasar query a un arreglo

User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Pasar query a un arreglo

Post by nageswaragunupudi »

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


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
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Pasar query a un arreglo

Post by joseluisysturiz »

Thank you very much for your help... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Pasar query a un arreglo

Post by nageswaragunupudi »

May I know your FWH version?
Regards

G. N. Rao.
Hyderabad, India
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Pasar query a un arreglo

Post by joseluisysturiz »

nageswaragunupudi wrote:May I know your FWH version?

18.05, gracias... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Pasar query a un arreglo

Post by nageswaragunupudi »

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
User avatar
joseluisysturiz
Posts: 2064
Joined: Fri Jan 06, 2006 9:28 pm
Location: Guatire - Caracas - Venezuela
Contact:

Re: Pasar query a un arreglo

Post by joseluisysturiz »

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... :shock:
Dios no está muerto...

Gracias a mi Dios ante todo!
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: Pasar query a un arreglo

Post by goosfancito »

hola
si quiero que me devuelva un array para luego usarlo en un combobox,

Code: Select all | Expand

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/
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Pasar query a un arreglo

Post by nageswaragunupudi »

Code: Select all | Expand

aList := ArrTranspose( ::oCnx:Execute( "select nombre from tbsucursal order by nombre" ) )[ 1 ]
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
goosfancito
Posts: 1955
Joined: Fri Oct 07, 2005 7:08 pm

Re: Pasar query a un arreglo

Post by goosfancito »

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/
User avatar
nageswaragunupudi
Posts: 10721
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Been thanked: 8 times
Contact:

Re: Pasar query a un arreglo

Post by nageswaragunupudi »

Code: Select all | Expand

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