Loading ...
Sorry, an error occurred while loading the content.
 

slightly OT, SQL question.

Expand Messages
  • Franki
    Hi guys, I am now writing the system version of my script that grabs sql files and imports them... I have the SQL file names all in an array called @files
    Message 1 of 4 , Jan 27, 2003
      Hi guys,

      I am now writing the "system" version of my script that grabs sql files and
      imports them...

      I have the SQL file names all in an array called @files

      and then this:

      foreach my $file (@files)
      {
      system("mysql -u username -p password db_name $sql_directory/$file");
      unlink $file;
      }

      which would hopefully grab the sql files one at a time, hand them to mysql
      client and then delete the file...

      I have a problem with this, the -p password bit doesn't work like that on my
      systems, on the console you put the -p in there, and then it will ask you
      for the password manually, entered on STDIN...

      Is there a way to pass it as part of the actual command or do I need to pass
      it via the perl script.???

      Also, is there some way of testing what the system command returned ?? so if
      its not successful for whatever reason, I can send an email report on the
      problem and not unlink the file...


      Any tips would be great..

      It would appear that using DBI would have been faster to write, but not as
      fast to run. (particularly since all it really does is call the mysql client
      itself anyway.)


      regards

      Franki
    Your message has been successfully submitted and would be delivered to recipients shortly.