No announcement yet.

sqltools file lock

  • Filter
  • Time
  • Show
Clear All
new posts

  • sqltools file lock

    I want to be able to lock a record in an Access database to keep two people from working on a specific record simultaneously (pessimistic lock).

    It looks like sql_setPos is what I want but I don't quite understand how to implement it.

    It looks like I need to configure sqlTools to return a multiple line dataset.
    Then after I retrieve the record I want, use sql_setPos to lock the record until I'm done.

    Am I on the right track?

  • #2
    Shawn --

    Yes, but with a caveat...

    Not all ODBC drivers -- and not all versions of some ODBC drivers -- support record locking, so your first step should be to define the target platform for your program ("Access 2002 or better" for example). Then perform some basic tests on a bare-minimum system: use SQL_FunctionAvailable or SQL_FuncAvail with %API_SQLSETPOS to find out whether or not the SQL_SetPos function is available. If it is, use SQL_DBInfoUInt with %DB_DYNAMIC_CURSOR_ATTRIBUTES1 to make sure the driver supports the form of locking that you need. If the driver passes those tests, then start writing the (non-trivial) code for a multirow cursor.

    You're getting into some pretty complex stuff; feel free to email Perfect Sync support along the way.

    -- Eric Pearson, Perfect Sync, Inc.
    Last edited by Eric Pearson; 16 Dec 2008, 05:22 PM.
    "Not my circus, not my monkeys."


    • #3
      thanks Eric,
      this project is not on the front burner yet, I was just doing some research ahead of time.


      • #4
        > ..I was just doing some research ahead of time.

        Don't just GIVE AWAY secrets to success like that! Now everyone will do it!

        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]


        • #5
          please leave a quarter on the counter