Hi Christian,

I have problem related to SQLAPI library connected to Informix server.
The problem is the library seems not putting locks on rows.
So, look at this snippet of code:

  // DBConnection is a SQLConnectionsMBS properly initialized and connected
  // cmd is a global property which doesn't go out of scope
  dim selectCmd as string = "SELECT * FROM testtable FOR UPDATE"
  cmd = new SQLCommandMBS(DBConnection, selectCmd)
  cmd.Execute

Please note the "FOR UPDATE" statement into the SELECT. This instruct Informix 
to put a promotable lock on rows retrieved: so other users can read but can't 
set a lock.
Well, the lock is NOT set, since I can edit the selected rows from other 
programs.

Also, setting a lock from the Informix CLI (which works), the above code should 
produce an error: the rows are locked and can't be retrieved. This is not what 
happens: the code above just execute and no errors. The only error I get, is 
when I try to UPDATE one or more locked row(s).

Now I tried using the RS native method, ODBC access.
This code:

  // DBConnection is a ODBCDatabase properly initialized and connected
  // rs is a RecordSet and it's a global property
  dim selectCmd as string = "SELECT * FROM testtable FOR UPDATE"
  rs = DBConnection.SQLSelect(selectCmd)
  rs.Edit

This code works, the command is executed and rows are LOCKED: other programs 
can read but not putting a lock.
Also, locking the rows from Informix CLI, I get a NIL RecordSet, for the same 
reason. Stripping the "FOR UPDATE" I get a valid RecordSet but then I get an 
error when I try to edit it. Makes sense.

So, the server is the same, the driver is the same (just accessed directly from 
SQLAPI, and via ODBC from RealStudio) the only thing which changes is the 
SQLAPI library.

Can you help on this?

Thanks

Massimo Valle




SACO Software and Consulting GmbH, Mühlgasse 5, D-97840 Hafenlohr
Tel.: ++49 9391 90890-0, Fax: ++49 9391 90890-99, E-Mail: [email protected]
Amtsgericht Würzburg HRB 5410, Geschäftsführer: Peter Schubert, 
Dipl.-Wirt.ing.(FH) Thorsten Beck

_______________________________________________
Mbsplugins_monkeybreadsoftware.info mailing list
[email protected]
https://ml01.ispgateway.de/mailman/listinfo/mbsplugins_monkeybreadsoftware.info

Reply via email to