From: Greg Campbell <greg.campbell@us.michelin.com>
To: Joseph Armbruster <josepharmbruster@gmail.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: vb6 inquiry
Date: Mon, 17 Oct 2005 08:59:31 -0400
Message-ID: <4353A033.6070502@us.michelin.com> (raw)
In-Reply-To: <938f42d70510121234m121a622ahe934c1ea9c22587d@mail.gmail.com>
References: <938f42d70510121234m121a622ahe934c1ea9c22587d@mail.gmail.com>
I was under the impression that psqlODBC does not support server side cursors. Therefore the correct way
to retrieve data is to use a client side cursor (adUseClient). This is inline with a "disconnected" model
that returns all the requested records immediately, instead of waiting for the client to cursor through
them. This also is supposed to allow a more immediate release of the connection, ultimately providing
greater scalability. (Is scalability still a buzz-word?).
BTW your sample specifies a LockType in two places. It's ok, but you don't really need that. I think the
one on the rs.Open line is good enough.
Note:
adUseServer=2
adUseClient=3
Joseph Armbruster wrote:
> All,
>
> I am working off of the vb6 sample given in the psqlODBC doc that
> accompanies the odbc driver. My issue is, when I am displaying the
> rs.Cursortype, it is reading 3, however this is not what was requested.
> Shouldn't this be 2?
>
> Thank You,
> Joseph Armbruster
>
> Dim cn As New adodb.Connection
> Dim rs As New adodb.Recordset
>
> cn.Open "DSN=test_post;UID=postgres;PWD=acupostgres;Database=vbtest"
>
> rs.CursorType = adOpenDynamic
> rs.LockType = adLockOptimistic
> rs.CursorLocation = adUseServer
> rs.Open "SELECT id, data FROM vbtest", cn, adOpenDynamic, adLockOptimistic
>
> MsgBox "AdoEnums.CursorType.DYNAMIC = " & adodb.CursorTypeEnum.adOpenDynamic
> MsgBox "rs.CursorType = " & rs.CursorType & vbCrLf & "rs.CursorLocation = "
> & rs.CursorLocation
>
> While Not rs.EOF
> Debug.Print rs!id & ": " & rs!Data
> rs.MoveNext
> Wend
>
> rs.AddNew
> rs!id = 76
> rs!Data = "More random data"
>
> rs.Update
>
> cn.Execute "INSERT INTO vbtest (id, data) VALUES (23, 'Some random data');"
> rs.Update
>
>
> If rs.State <> adStateClosed Then rs.Close
> Set rs = Nothing
> If cn.State <> adStateClosed Then cn.Close
> Set cn = Nothing
>
Attachments:greg.campbell.vcf (text/x-vcard, 239B) download
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-odbc@postgresql.org
Cc: greg.campbell@us.michelin.com, josepharmbruster@gmail.com
Subject: Re: vb6 inquiry
In-Reply-To: <4353A033.6070502@us.michelin.com>
References: <938f42d70510121234m121a622ahe934c1ea9c22587d@mail.gmail.com> <4353A033.6070502@us.michelin.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox