in reply to Locking Access Records and Database

Locking on the Perl side is done the SQL "LOCK" statement.

On the Access side, forms have properties that control locking.

  • Comment on Re: Locking Access Records and Database

Replies are listed 'Best First'.
Re^2: Locking Access Records and Database
by merrymonk (Hermit) on Apr 08, 2008 at 16:13 UTC
    Thank you for your suggestions.

    I have tried to use the SQL LCOK in the following way after I found a reference that said
    LOCK TABLES table_name WRITE will provide a lock but let me write records
    to the table.
    $lock_res = 'unset'; $lock_str = "LOCK TABLES " . $table . " WRITE"; $lock_res = $dbh->do($lock_str); print "[lock_table] locking table <$table> result <$lock_res>\n";
    However, this does not seem to have worked since
    1. $lock_res did not contain anything after the code;
    2. I could use Access normally to alter data in the table.
    What am I doing wrong?

      So what's the error message ($dbh->errstr)?

        I altered the Perl as shown below to get the value of $dbh->errstr.
        I then printed this out with the text I used in the $dbh->do statement.
        The change code is next.
        print "\n[lock_table] entry\n\n"; $lock_res = 'unset'; $lock_str = "LOCK TABLES " . $table . " WRITE"; $lock_res = $dbh->do($lock_str); $dberr = $dbh->errstr; print "[lock_table] locking table <$table> with <$lock_str>\nresul +t <$lock_res>\nerror message <$dberr>\n";
        The output is next
        [lock_table] entry [lock_table] locking table <Stock> with <LOCK TABLES Stock WRITE> result <> error message <>
        As you can see the error string did not contain anything.
        Any ideas about what to do next?