List:General Discussion« Previous MessageNext Message »
From:Jerry Preeper Date:November 30 1999 6:10pm
Subject:Commands out of sync error
View as plain text  
I'm trying to get a program installed and running into a glitch that I
haven't seen before - there is a section of the code in the setup program
that creates all the tables in the database.  The problem is, when I run
the code the first table gets created and the then all the others fail.
The error I get is  Creating table Category ... failed (DBSQL (19423):
Fatal Error: Unable to execute query: (and then the sql command which is
valid because I can paste it into the command monitor and then) Reason:
Commands out of sync;  You can't run this command now at ./setup.cgi line 290

I sort of understand the error from searching the listquest archive, but I
don't know how to fix it. I didn't write the program and I'm more of a
script-hack than a programmer :)  I guess somehow I need to fetch the
results of each query in the foreach loop or something in the if statement
for the category table.  The relevant code from the program follows.  If
anyone can help, I would be most appreciative.

Jerry



my $res;
print "Creating tables ... \n";
foreach (sort keys %Links::SQL::TABLES) {
   print "\tCreating table $_ ... ";
# This is line 290
   eval { $DB->do($Links::SQL::TABLES{$_}); };
   $@ ? ($@ =~ /already exists/ ? print "failed (already exists).\n" :
print "failed ($@)") : print "ok\n";
   eval { $DB->load_from_sql($_); };   
   $@ ? (print "\t\tLoading def file from SQL ... failed ($@)\n") : (print
"\t\tLoading def file from SQL ... ok!\n");
...
a bunch of if's based upon specific tables removed except for the one for
the Category table which is the first one that fails
...
     if ($_ eq 'Category') {
          $DB->{'db_is_indexed'} = 1;
          $DB->{'db_def'}{'Name'}[7] = 3;
          $DB->{'db_def'}{'Description'}[7] = 1;
          print "\t\tCreating Search Index ... ";
          eval { $DB->create_index(); };
          $@ ? (print "failed ($@)") : (print "ok!\n");
     }
   eval { $DB->write_to_file ("../defs/$_.def"); };
   $@ ? (print "\t\tSaving def file ... failed ($@)\n") : (print
"\t\tSaving def file ... ok!\n");
}
print "All done!\n";



Thread
Commands out of sync errorJerry Preeper30 Nov
  • Re: Commands out of sync errorJerry Preeper2 Dec