Thursday, 15 July 2010

ms access - vb6 ADODB recordset size retrieval -



ms access - vb6 ADODB recordset size retrieval -

using adodb - there function retrieve actual size of result query ? (vb6)

i not mean it's count mean actual size, know how much info needed used through network retrieve query result.

if no such thing exists guess can take info retrieved, turn bytes, , start calculating, avoid if there's built in (which should be).

thanks !

p.s using .mdb file , using adodb 2.0 library

here sample reports workingsetsize after fetching client-side recordset using ado

option explicit private declare sub copymemory lib "kernel32" alias "rtlmovememory" (destination any, source any, byval length long) private declare function getcurrentprocess lib "kernel32" () long private declare function getprocessmemoryinfo lib "psapi" (byval hprocess long, ppsmemcounters process_memory_counters, byval cb long) long private type process_memory_counters cb long pagefaultcount long peakworkingsetsize long workingsetsize long quotapeakpagedpoolusage long quotapagedpoolusage long quotapeaknonpagedpoolusage long quotanonpagedpoolusage long pagefileusage long peakpagefileusage long privateusage long end type private function pvgetworkingsetsize() string dim ucounters process_memory_counters on error goto qh if getprocessmemoryinfo(getcurrentprocess(), ucounters, len(ucounters)) <> 0 pvgetworkingsetsize = format$(pvtounsigned(ucounters.workingsetsize) / 1024 / 1024, "0.00") & "mb" end if qh: end function private function pvtounsigned(byval lvalue long) currency phone call copymemory(pvtounsigned, lvalue, 4) pvtounsigned = pvtounsigned * 10000@ end function '--- ui stuff private sub command1_click() const conn_str string = "provider=sqloledb;data source=ucsdb\r2;initial catalog=dreem15_ivb_2;integrated security=sspi" dim rs adodb.recordset pvlog "starting" set rs = new adodb.recordset pvlog "after loading ado" set rs = new adodb.recordset rs.cursorlocation = aduseclient rs.open "select 1 id", conn_str, adopenstatic, adlockbatchoptimistic pvlog "after loading sqloledb" set rs = new adodb.recordset rs.cursorlocation = aduseclient rs.open "select top 10000 * inv_docs", conn_str, adopenstatic, adlockbatchoptimistic pvlog "after fetching 10000 records" new propertybag .writeproperty "rs", rs pvlog "propbag size: " & format$(ubound(.contents) / 1024 / 1024, "0.00") & "mb" end pvlog "after destroy propbag" set rs = nil pvlog "after destroy recordset" end sub private sub command2_click() pvlog "ping" end sub private sub pvlog(stext string) text1.text = text1.text & format$(timer, "0.00") & ": " & pvgetworkingsetsize() & ", " & stext & vbcrlf text1.selstart = &h7fff refresh end sub

here results after 3 consecutive executions

60366.48: 17.71mb, starting 60366.48: 18.04mb, after loading ado 60366.51: 22.00mb, after loading sqloledb 60366.74: 48.49mb, after fetching 10000 records 60368.34: 62.81mb, propbag size: 6.04mb 60368.34: 50.73mb, after destroy propbag 60368.34: 28.63mb, after destroy recordset 60369.45: 28.67mb, starting 60369.45: 28.68mb, after loading ado 60369.47: 28.90mb, after loading sqloledb 60369.71: 53.28mb, after fetching 10000 records 60371.30: 67.41mb, propbag size: 6.04mb 60371.30: 55.33mb, after destroy propbag 60371.30: 33.88mb, after destroy recordset 60371.95: 33.88mb, starting 60371.95: 33.88mb, after loading ado 60371.96: 33.91mb, after loading sqloledb 60372.20: 56.37mb, after fetching 10000 records 60373.80: 69.11mb, propbag size: 6.04mb 60373.80: 57.03mb, after destroy propbag 60373.80: 34.09mb, after destroy recordset

ms-access vb6 adodb

No comments:

Post a Comment