Re: ODBC3, VB, cursortype, bug and transactions - Mailing list pgsql-odbc

From Hiroshi Inoue
Subject Re: ODBC3, VB, cursortype, bug and transactions
Date
Msg-id 3CCCCC02.D195740C@tpf.co.jp
Whole thread Raw
In response to ODBC3, VB, cursortype, bug and transactions  (Marcelo Cid <marcid@uol.com.br>)
List pgsql-odbc
Marcelo Cid wrote:
>
> I installed ODBC3. After some tests I have some questions: (excuse my poor english)
>
> With this code:
>
>     Set rstCustomers = New ADODB.Recordset
>     rstCustomers.CursorType = adOpenKeyset
>     rstCustomers.LockType = adLockOptimistic
>     rstCustomers.Open "SELECT * FROM customers", cnnGPro
>
>     rstCustomers.AddNew
>     rstCustomers.Fields("name").Value = "Joe"
>     rstCustomers.Fields("age").Value = 20
>     rstCustomers.Update
>
>     nID = rstCustomers.Fields("id_customer").Value
>
> I can get my id_customer, but if I change the cursor type to adOpenDynamic, I won't get.

Dynamic cursors aren't supported by the driver.
Maybe you have to set the CursurLocation property
to adUseClinent if you need dynamic cursors.
Keyset-driven cursors aren't implemented yet either.
ADO seems to use updatable static cursors instead.
As for keyset driven cursors I hope I would be
able to support it in the near future.

> I think that I found a bug:
>
>     Set rstCustomers = New ADODB.Recordset
>     rstCustomers.CursorType = adOpenKeyset
>     rstCustomers.LockType = adLockOptimistic
>
>     cnnGPro.BeginTrans
>
>     rstCustomers.Open "SELECT * FROM customer WHERE substr(upper(name), 1, 1) = 'M'", cnnGPro
>
>     Debug.Print rstCustomers.RecordCount
>
>     Do While Not rstCustomers.EOF
>         rstCustomers.Delete
>         rstCustomers.MoveNext
>         Debug.Print rstCustomers.RecordCount
>     Loop
>
>     rstCustomers.Close
>
>     cnnGPro.RollbackTrans
>
> After I deleted the last record I get a error (80040e23) at rstCustomers.MoveNext.
> Prior after the last delete I get:
>
>     ? rstCustomers.EOF, rstCustomers.BOF
>     False         False
>
> After the error at rstCustomers.MoveNext, I get:
>
>     ? rstCustomers.EOF, rstCustomers.BOF
>     True          False
>
> If I change the cursor type to adOpenDynamic no error will happen.
> So if I need my id_customer I have to use adOpenKeyset and if I need to delete a record I have to use adOpenDynamic.

Probably I fixed the bug.
Please try the snapshot dll at http://w2422.nsk.ne.jp/~inoue/.

Hiroshi Inoue
    http://w2422.nsk.ne.jp/~inoue/

pgsql-odbc by date:

Previous
From: Hiroshi Inoue
Date:
Subject: Re: [GENERAL] Auth problem in pg_hdba.conf
Next
From: Popovics Attila
Date:
Subject: Read-only records with timestamp