From: | "Greg Campbell" <greg(dot)campbell(at)us(dot)michelin(dot)com> |
---|---|
To: | Joseph Armbruster <josepharmbruster(at)gmail(dot)com> |
Cc: | pgsql-odbc(at)postgresql(dot)org |
Subject: | Re: vb6 inquiry |
Date: | 2005-10-17 12:59:31 |
Message-ID: | 4353A033.6070502@us.michelin.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-odbc |
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
>
Attachment | Content-Type | Size |
---|---|---|
greg.campbell.vcf | text/x-vcard | 241 bytes |
From | Date | Subject | |
---|---|---|---|
Next Message | Greg Martin | 2005-10-18 06:01:58 | Re: unixODBC vs postgeSQL driver on RHEL4? |
Previous Message | Rainer Hochreiter | 2005-10-17 11:55:36 | Re: unixODBC vs postgeSQL driver on RHEL4? |