List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:January 17 2000 9:07pm
Subject:Re: LOCK TABLE - ERROR 1100
View as plain text  
Hi!

>>>>> "Eric" == Eric Moore <evmoore@stripped> writes:

Eric> Sasha,
Eric> Thanks for the response.  I tried the following and still received the 
Eric> error 1100 message:

Eric> "DBD::mysql::st execute failed: Table 'a' was not locked with LOCK TABLES 
Eric> at..."

Eric> ---Revised Code---
Eric> sub InsertTermCourseList()
Eric> {
Eric> # First Lock the tables
Eric>     my $InsStr = "LOCK TABLES
Eric>                   table_alpha WRITE,
Eric>                   table_bravo WRITE,
Eric>                   table_charlie WRITE";
Eric>     my $rv = $main::dbh->do($InsStr)
Eric>             or die "Can't Execute  $InsStr: $main::dbh->errstr\n";

Eric> # Delete all 'old' courses
Eric>     $InsStr = "SELECT a.id
Eric>                FROM table_alpha a, 
Eric>                     table_bravo b, 
Eric>                     table_charlie c
Eric>                WHERE a.student_id = $student_id and
Eric>                      c.acyear_acterm_id = $acyear_acterm_id and
Eric>                      b.acyear_acterm_time_id = c.id and
Eric>                      a.course_acyear_acterm_time_id = a.id";

Fix:

Change the LOCK TABLES entry to:

LOCK TABLES table_alpha as "a" WRITE,
            table_bravo as "b" WRITE,
            table_charlie as "c" WRITE";

The MySQL manual explains why!

Regards,
Monty
Thread
LOCK TABLE - ERROR 1100Eric Moore16 Jan
  • Re: LOCK TABLE - ERROR 1100Sasha Pachev17 Jan
Re: LOCK TABLE - ERROR 1100Eric Moore17 Jan
  • Re: LOCK TABLE - ERROR 1100Sasha Pachev17 Jan
  • Re: LOCK TABLE - ERROR 1100Michael Widenius18 Jan
Re: LOCK TABLE - ERROR 1100Eric Moore17 Jan