X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 5AB679DC878 for ; Sun, 18 Dec 2005 16:52:14 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97483-08 for ; Sun, 18 Dec 2005 16:52:13 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from gk-us2.us.michelin.com (gk-us2.michelin.com [156.65.14.19]) by postgresql.org (Postfix) with ESMTP id 7DCAD9DC814 for ; Sun, 18 Dec 2005 16:52:09 -0400 (AST) Received: from oncpfxp4-out.onc.michelin.com (unverified [10.21.4.32]) by gk-us2.us.michelin.com (Clearswift SMTPRS 5.1.7) with ESMTP id for ; Sun, 18 Dec 2005 15:51:39 -0500 Received: from ONCMH1.onc.michelin.com (ONCMH1.onc.michelin.com [156.65.124.40]) by oncpfxp4-out.onc.michelin.com (Postfix) with ESMTP id 7B52A174FD for ; Sun, 18 Dec 2005 15:51:59 -0500 (EST) Received: from oncmtap1.onc.michelin.com by oncmh1.onc.michelin.com with ESMTP for pgsql-odbc@postgresql.org; Sun, 18 Dec 2005 15:51:59 -0500 Received: from oncems01.onc.michelin.com ([156.65.125.150]) by oncmtap1.onc.michelin.com (Netscape Messaging Server 4.15) with ESMTP id IRPOMM00.L2G for ; Sun, 18 Dec 2005 15:51:58 -0500 Received: from [10.36.138.28] (unverified) by oncems01.onc.michelin.com (Content Technologies SMTPRS 4.2.5) with ESMTP id ; Sun, 18 Dec 2005 15:51:57 -0500 Message-Id: <43A5CBE8.2080902@us.michelin.com> Date: Sun, 18 Dec 2005 15:51:52 -0500 From: "Campbell, Greg" User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.7) Gecko/20050414 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Ludek Finstrle CC: Dave Page , pgsql-odbc@postgresql.org Subject: Re: VB6 and RowCount fix References: <20051218194850.GA9020@soptik.pzkagis.cz> In-Reply-To: <20051218194850.GA9020@soptik.pzkagis.cz> Content-Type: multipart/mixed; boundary="------------080400070102060102030703" X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=2.152 required=5 tests=[RCVD_IN_WHOIS_INVALID=2.151, UNPARSEABLE_RELAY=0.001] X-Spam-Score: 2.152 X-Spam-Level: ** X-Archive-Number: 200512/232 X-Sequence-Number: 6711 This is a multi-part message in MIME format. --------------080400070102060102030703 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit I am coming late to this thread. The issue for RowCount is not in VB, but always in ADO regardless of language, although the overwhelming majority is in VB. The key to rs.RowCount behaviour is the type of recordset cursor you are opening. For example rs.CursorLocation = adUseClient rs.Open conn, sql, adOpenStatic debug.print rs.RowCount will pull all the records into a client side recordset. while rs.CursorLocation = adUseServer rs.Open conn, sql, adOpenForwardOnly debug.print rs.RowCount will attempt to open a server side cursor, When first opened the recordset will NOT know how many rows there are (rs.RowCount = -1). You have to iterate through a server side or ForwardOnly cursor to get a recordcount. The count may not be accurate until the end of the recordset. For small recordset, clearly the client side processing is better. For large sets, like table access to millions of records, I am not sure on what is the best approach. I typically try to redefine the approach, in those situations. I make everything I can a detached client side recordset. I am unclear on what calls the ADO will make to the ODBC driver, and if DECLARE/FETCH will be triggered based on the pgodbc setup. The only thing that should reliable in any case is rs.EOF. I have not seen your sample VB code, but things like this make a huge difference. Again, I am late in having this thread grab my attention. If my remarks are off-base, please ignore then and forgive me. Ludek Finstrle wrote: >>>I disagree. I try your example even againist MS SQL and it still returns >>>-1. The test suite for VB6 RowCount you sent me doesn't work at all. >> >>The test app works perfectly well - look at the source code; all it does > > > I took a look at t source code. But I don't know VB. > > >>is report the value from ADODB.Recordset.RowCount. What is not clear, >>is whether that ever worked for any data provider. I always use the >>"while not rs.EOF..." approach when I wrote VB code in the past. > > > I think the question is how VB get RowCount value. It seems to me that > VB counts it internaly from fetched rows. > > I close this chapter now if noone proof the opposite. > > Regards, > > Luf > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match --------------080400070102060102030703 Content-Type: text/x-vcard; charset=utf-8; name="greg.campbell.vcf" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="greg.campbell.vcf" begin:vcard fn:Greg Campbell n:Campbell;Greg org:Michelin North America - US5 Lexington;ENG-ASE email;internet:greg.campbell@us.michelin.com title:ASE Systems Engineer tel;work:803-951-5561/x75561 x-mozilla-html:FALSE version:2.1 end:vcard --------------080400070102060102030703--