Large RowSet

Large RowSet

Postby dutch » Sun Feb 05, 2017 8: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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Large RowSet

Postby richard-service » Sun Feb 05, 2017 8: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: Select all  Expand view

oServer:SelectDB(cLoginTable)
::oDB := oServer:Query("SELECT * FROM postmsf ORDER BY zipcode LIMIT 1000")
 
Best Regards,

Richard

Harbour 3.2.0dev (r2402101027) => Borland C++ v7.7 32bit
MySQL v8.0 /ADS v10
Harbour 3.2.0dev (r2011030937) => Borland C++ v7.4 64bit
User avatar
richard-service
 
Posts: 803
Joined: Tue Oct 16, 2007 8:57 am
Location: New Taipei City, Taiwan

Re: Large RowSet

Postby dutch » Sun Feb 05, 2017 9: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: Select all  Expand view

oServer:SelectDB(cLoginTable)
::oDB := oServer:Query("SELECT * FROM postmsf ORDER BY zipcode LIMIT 1000")
 

Regards,
Dutch
Regards,
Dutch

FWH 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Large RowSet

Postby Marc Venken » Sun Feb 05, 2017 10:18 am

XBrowse is already optimized for this.

There was a topic about it :

viewtopic.php?f=3&t=32264&hilit=xbrowse+limit
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Large RowSet

Postby Rick Lipkin » Sun Feb 05, 2017 5:15 pm

Dutch

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

Code: Select all  Expand view

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
User avatar
Rick Lipkin
 
Posts: 2665
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: Large RowSet

Postby nageswaragunupudi » Sun Feb 05, 2017 10:30 pm

Please try this sample
Code: Select all  Expand view
#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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Large RowSet

Postby nageswaragunupudi » Mon Feb 06, 2017 12:59 am

Mr Dutch

You can also try this example.
Connect using oCn := FW_DemoDB( 1 )
viewtopic.php?f=3&t=32737&p=194525&hilit=large+rowsets#p194525
Regards

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

Re: Large RowSet

Postby dutch » Mon Feb 06, 2017 2: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: Select all  Expand view
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: Select all  Expand view
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: Select all  Expand view
#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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Large RowSet

Postby nageswaragunupudi » Mon Feb 06, 2017 2:35 am

Code: Select all  Expand view
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
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Large RowSet

Postby dutch » Mon Feb 06, 2017 2: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 19.01 / 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)
User avatar
dutch
 
Posts: 1542
Joined: Fri Oct 07, 2005 5:56 pm
Location: Thailand

Re: Large RowSet

Postby nageswaragunupudi » Mon Feb 06, 2017 3:06 am

No.
Regards

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Carles and 116 guests