in reply to Re: Locking Access Records and Database
in thread Locking Access Records and Database

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?

Replies are listed 'Best First'.
Re^3: Locking Access Records and Database
by ikegami (Patriarch) on Apr 08, 2008 at 17:19 UTC

    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?

        Well, that's not good. do should return -1 on success in this scenario, and errstr should be set if there's an error. It would seem to indicate a buggy DBD. In any case, this is far out of my realm of experience.