FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Large RowSet
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Large RowSet
Posted: Sun Feb 05, 2017 08:12 AM

Dear Mr.Rao,

Can I do like below to read Large RowSet?

oRs := RowSet() limit with 1000 records.
XBROWSE oLbx

oLbx:bChange := {|| if(oRs:RecCount()=oRs:RecNo(), (oRs:ReadNext(1000), oLbx:Refresh()), ) }

Thanks in advance.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 866
Joined: Tue Oct 16, 2007 08:57 AM
Re: Large RowSet
Posted: Sun Feb 05, 2017 08:35 AM
dutch wrote:Dear Mr.Rao,

Can I do like below to read Large RowSet?

oRs := RowSet() limit with 1000 records.
XBROWSE oLbx

oLbx:bChange := {|| if(oRs:RecCount()=oRs:RecNo(), (oRs:ReadNext(1000), oLbx:Refresh()), ) }

Thanks in advance.


Hi Dutch,
How about use this
Code (fw): Select all Collapse
oServer:SelectDB(cLoginTable)
::oDB := oServer:Query("SELECT * FROM postmsf ORDER BY zipcode LIMIT 1000")
Best Regards,



Richard



Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 32bit

MySQL v8.0

Harbour 3.2.0dev (r2503251254) => Borland C++ v7.7 64bit
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Large RowSet
Posted: Sun Feb 05, 2017 09:28 AM
Hi Richard,

Thank you, But I mean
1. read 1000 records with xbrowse
2. read until hit the bottom (1,000) and then read more 1,000 from server.
3. xbrowse will show 2,000 now.

It will reduce reading time for 1 activate and read more after hit the bottom. This is my idea need.
richard-service wrote:
Hi Dutch,
How about use this
Code (fw): Select all Collapse
oServer:SelectDB(cLoginTable)
::oDB := oServer:Query("SELECT * FROM postmsf ORDER BY zipcode LIMIT 1000")

Regards,
Dutch
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Large RowSet
Posted: Sun Feb 05, 2017 10:18 AM

XBrowse is already optimized for this.

There was a topic about it :

viewtopic.php?f=3t=32264hilit=xbrowse+limit

&&

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 2706
Joined: Fri Oct 07, 2005 01:50 PM
Re: Large RowSet
Posted: Sun Feb 05, 2017 05:15 PM
Dutch

Not sure how you are creating your recordset .. I always define my oRs object with local cache

Code (fw): Select all Collapse
oRsAcc := TOleAuto():New( "ADODB.Recordset" )
oRsAcc:CursorType     := 1        // opendkeyset
oRsAcc:CursorLocation := 3        // local cache
oRsAcc:LockType       := 3        // lockoportunistic

cSQL := "SELECT * FROM ACCIDENT  order by date"

TRY
   oRsAcc:Open(cSQL,xConnect )
CATCH oErr
   MsgInfo( "Error in Opening ACCIDENT table" )
   RETURN(.F.)
END TRY


The Local Cache option allows the fetched Cursor to reside on the client rather to be on the Server. Traversing a local cursor is VERY fast ..

Rick Lipkin
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Large RowSet
Posted: Sun Feb 05, 2017 10:30 PM
Please try this sample
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB(1) // if you have FWH17.01
                 // if not you establish connection to your server

   oRs   := oCn:RowSet( "custbig", 1000 )
   oRs:lAutoExpand := .t.

   XBROWSER oRs FASTEDIT SHOW RECID //AUTOFIT

   oCn:Close()

return nil

During browse, keep pressing down arrow or page down button and you keep seeing the rowset growing automatically.

Incidentally the table `custbig` on the demo server has one million records.

Note: If you connect to your server, instead of "custbig" use any large table name. Make sure the table has a primary key.

Mr Rick
This is FWH library for MySql.
This is not possible with any other alternative
Regards



G. N. Rao.

Hyderabad, India
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Large RowSet
Posted: Mon Feb 06, 2017 12:59 AM

Mr Dutch

You can also try this example.
Connect using oCn := FW_DemoDB( 1 )

viewtopic.php?f=3t=32737p=194525hilit=large+rowsets#p194525

&&&

Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Large RowSet
Posted: Mon Feb 06, 2017 02:29 AM
Dear Mr.Rao,

What is the different of 2 samples? If I use sql statement, how does it work? Because it has some other clause that we have to use.
1st Example It's working as you said.
Code (fw): Select all Collapse
Function main
oRs   := oServer:RowSet( "fogst", 1000 )
oRs:lAutoExpand := .t.

XBROWSER oRs SHOW SLNUM FASTEDIT
oServer:close()
return nil

2nd Example This sample is not working
Code (fw): Select all Collapse
Function main
oRs   := oServer:RowSet( "select * from fogst limit 1000")
oRs:lAutoExpand := .t.

XBROWSER oRs SHOW SLNUM FASTEDIT
oServer:close()
return nil



nageswaragunupudi wrote:Please try this sample
Code (fw): Select all Collapse
#include "fivewin.ch"

function Main()

   local oCn, oRs

   oCn   := FW_DemoDB(1) // if you have FWH17.01
                 // if not you establish connection to your server

   oRs   := oCn:RowSet( "custbig", 1000 )
   oRs:lAutoExpand := .t.

   XBROWSER oRs FASTEDIT SHOW RECID //AUTOFIT

   oCn:Close()

return nil

During browse, keep pressing down arrow or page down button and you keep seeing the rowset growing automatically.

Incidentally the table `custbig` on the demo server has one million records.

Note: If you connect to your server, instead of "custbig" use any large table name. Make sure the table has a primary key.

Mr Rick
This is FWH library for MySql.
This is not possible with any other alternative
Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Large RowSet
Posted: Mon Feb 06, 2017 02:35 AM
Code (fw): Select all Collapse
oRs   := oServer:RowSet( "select * from fogst limit 1000")

This does not work.
Please tell the rowset object the size of the limit by indicating in a separate parameter.
Also, either you use name of table or in case of SQL, let it end with ORDER BY <primarykey>
Please do either if you want to take advantage of the expand feature

So,
Either
oRs := oServer:RowSet( "fogst", 1000 )
or
oRs := oServer:RowSet( "select ..... from fogst order by <primarykey>", 1000 )
Regards



G. N. Rao.

Hyderabad, India
Posts: 1598
Joined: Fri Oct 07, 2005 05:56 PM
Re: Large RowSet
Posted: Mon Feb 06, 2017 02:59 AM

Dear Mr.Rao,

It works great. It reduce the time to fetch and automatic re-fetch records.

Another question, it use the same parameter (nLimit) with ::QueryResult()
::QueryResult(cSql,nLimit)

Thanks.

Regards,

Dutch



FWH 2304 / xHarbour Simplex 1.2.3 / BCC73 / Pelles C / UEStudio

FWPPC 10.02 / Harbour for PPC (FTDN)

ADS V.9 / MySql / MariaDB

R&R 12 Infinity / Crystal Report XI R2

(Thailand)
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Large RowSet
Posted: Mon Feb 06, 2017 03:06 AM

No.

Regards



G. N. Rao.

Hyderabad, India

Continue the discussion