ADO: load recordset into an Array

ADO: load recordset into an Array

Postby MOISES » Sat Nov 16, 2019 2:24 pm

Hi,

In my previous Harbour and FWH version, in order to load contents of Recordset in ADO, I did:

Code: Select all  Expand view
 IF ! ( oRsClientes:Eof .and. oRsClientes:Bof )
     oRsClientes:MoveFirst()
     aArray1 := oRsClientes:GetRows()
  ENDIF


But now, the format of the array is wrong. Is there another way to achieve the result?

Thank you.
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: ADO: load recordset into an Array

Postby leandro » Sat Nov 16, 2019 6:00 pm

Una idea
Code: Select all  Expand view

hData := RsToHash( oRsClientes)
 
Saludos
LEANDRO AREVALO
Bogotá (Colombia)
https://hymlyma.com
https://hymplus.com/
leandroalfonso111@gmail.com
leandroalfonso111@hotmail.com

[ Embarcadero C++ 7.60 for Win32 ] [ FiveWin 23.07 ] [ xHarbour 1.3.0 Intl. (SimpLex) (Build 20230914) ]
User avatar
leandro
 
Posts: 1484
Joined: Wed Oct 26, 2005 2:49 pm
Location: Colombia

Re: ADO: load recordset into an Array

Postby MOISES » Sat Nov 16, 2019 9:03 pm

Now I have problems with XBROWSE COMMAND:

@ 0, 0 XBROWSE oPanel2:oControl OF oDash ;
COLUMNS 1, 2, 3, 4, 5, 6 ;
HEADERS "Nº Cliente", oSayDNI(), "Apellidos", "Nombre", "Localidad", "Teléfono" ;
ARRAY aArray1 ;
PICTURES "9,999,999"

Does not show the hash.

But the recordset is converted into hash with RsToHash()

Thank you,
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: ADO: load recordset into an Array

Postby nageswaragunupudi » Sun Nov 17, 2019 4:31 am

MOISES wrote:Hi,

In my previous Harbour and FWH version, in order to load contents of Recordset in ADO, I did:

Code: Select all  Expand view
 IF ! ( oRsClientes:Eof .and. oRsClientes:Bof )
     oRsClientes:MoveFirst()
     aArray1 := oRsClientes:GetRows()
  ENDIF


But now, the format of the array is wrong. Is there another way to achieve the result?

Thank you.


This is due to a change in the Harbour libraries. Nothing to do with FWH.
We have now provided a function
Code: Select all  Expand view
aRows := RsGetRows( oRs, [nRows], [nStart], [aFields] )

This function is safe to use with Harbour (both new and old versions) and also xHarbour.
You need to change all
Code: Select all  Expand view

aData := oRs:GetRows()
 

as
Code: Select all  Expand view

aData := RsGetRows( oRs )
 

EVERYWHERE in your application. There is no escape from this, because of the change in Harbour libraries.

Depending on your requirements, you can also use
Code: Select all  Expand view

hData := RsToHash( oRs, ..... )
cJson  := RsToJson( oRs, .... )
 
Regards

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

Re: ADO: load recordset into an Array

Postby MOISES » Sun Nov 17, 2019 8:17 am

Thank you. RsGetRows( oRs ) Works perfect.

Two more related questions please:

1.- Is there any other change to ADO stuff that must be aware of?

2.- Also there is the Hash approach: aArray1 := RsToHash( oRs )

Is this fastest?
Saludos / Regards,

FWH 20.04, Harbour 3.2.0 dev (r1909261630) y BCC 7.40
MOISES
 
Posts: 838
Joined: Wed Aug 22, 2007 10:09 am

Re: ADO: load recordset into an Array

Postby nageswaragunupudi » Sun Nov 17, 2019 8:21 am

2.- Also there is the Hash approach: aArray1 := RsToHash( oRs )

Is this fastest?

RsGetRows() is faster than RsToHash()
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 30 guests