Re: ODBC3, VB, cursortype, bug and transactions

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Marcelo Cid <marcid(at)uol(dot)com(dot)br>
Cc: pgsql-odbc(at)postgresql(dot)org
Subject: Re: ODBC3, VB, cursortype, bug and transactions
Date: 2002-04-29 04:28:50
Message-ID: 3CCCCC02.D195740C@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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/

In response to

Browse pgsql-odbc by date

  From Date Subject
Next Message Popovics Attila 2002-04-29 11:00:44 Read-only records with timestamp
Previous Message Hiroshi Inoue 2002-04-29 02:29:06 Re: [GENERAL] Auth problem in pg_hdba.conf