Author |
Topic  |
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 30 December 2002 : 09:13:36
|
quote: Originally posted by HuwR
it is cachesize which governs how many records are fetched, not the pagesize, if you set cachesize to 15 and pagesize, it will only fetch 15 records, not the whole 25.
Not so with GetRows |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 30 December 2002 : 14:02:34
|
perhaps we should not do this GetRows(adGetRowsRest)
adGetRowsRest is what makes it fetch the entire recordset
|
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 30 December 2002 : 15:38:34
|
Exactly, HUWR. It should be GetRows(strPageSize) for most situations in snitz code. |
Edited by - GauravBhabu on 30 December 2002 15:42:18 |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 31 December 2002 : 06:04:44
|
I think this would require a rethink of the paging code though. I know you can also pass a start value, but this requires that the db driver supports bookmarking, which may not be the case for mysql, but I do not know for sure. |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 31 December 2002 : 07:27:49
|
I think it does support bookmarks.
quote:
MyODBC 3.51 supports three types of scrollable cursors, using this, an application can move backward and forward in the result set based on the requirement:
Forward-only Static and Dynamic (only from MyODBC 3.51.01) Note, driver doesn't yet support Key set-Driven Cursor type, and to have dynamic support, one must check the option "Enable Dynamic Cursor Type" from DSN settings or by passing OPTION=32 as the connection string.
Application can set the cursor type through SQLSetStmtAttr (or SQLSetStmtOption in MyODBC 2.50 driver) with option as SQL_ATTR_CURSOR_TYPE. By default, driver implicitly uses forwards-only cursor.
Using the forwards-only cursor, an application can only forward in the result set, and it can not go backward, where as in the other case, Static cursor type, an application can move forward or backward or to any desired location in the result set.
http://www.mysql.com/products/myodbc/manual.html#Cursor_Types |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 31 December 2002 : 10:53:29
|
cursors are not the same as bookmarks, it needs to support bookmarks in order to all
getrows(start,pagesize) |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 31 December 2002 : 13:01:50
|
...Using the forwards-only cursor, an application can only forward in the result set, and it can not go backward, where as in the other case, Static cursor type, an application can move forward or backward or to any desired location in the result set.
I forgot to highlight this part. However, it is GetRows(numRows, start). We can also specify the fields to get
getRows(numRows[,start][,Fields]) |
 |
|
HuwR
Forum Admin
    
United Kingdom
20600 Posts |
Posted - 31 December 2002 : 13:19:49
|
Ok, sounds like it would work then, maybe I'll have aplay later |
 |
|
GauravBhabu
Advanced Member
    
4288 Posts |
Posted - 31 December 2002 : 14:13:21
|
I did some tests. One thing which is, as far as i undestoood, is that start is the bookmark value as returned by using bookmark property. So it can not be used if the page is loaded again because the recordset is created a new. Can it be?
<edited to add> Note: When used on a client-side Recordset object, the Bookmark property is always available.
So using the AbsolutePage property seems to be the choice
Recordset.PageSize = varNumberOfRecords
varPageCount = Recordset.PageCount
if varPageNumber > varPageCount then varPageNumber = varPageCount
Recordset.AbsolutePage = varPageNumber
varRowsArray = Recordset.GetRows(varNumberOfRecords, adBookmarkCurrent)
'adBookmarkCurrent = 0
'This is also default setting for GetRows
'the following statement will behave same as above
varRowsArray = Recordset.GetRows(varNumberOfRecords)
We can also use the Recordset.Move method to get specific records (First n Records, last n records, n records starting from nth record) from the recordset, though that will require additional coding to set the value for AbsolutePage property, checking the .EOF and/or .BOF property etc. |
Edited by - GauravBhabu on 31 December 2002 14:47:14 |
 |
|
bjlt
Senior Member
   
1144 Posts |
Posted - 20 March 2003 : 01:34:10
|
What's the solution for this finally? Thanks. |
 |
|
RichardKinser
Snitz Forums Admin
    
USA
16655 Posts |
|
Topic  |
|