On Mon, Dec 31, 2001 at 08:47:27AM -0600, Stephen Spalding wrote:
: insert into crontabs values
: (' ', 'dev2', 'asn', '00', '19', 'ALL', 'ALL', '1');
: insert into crontabs values
: (' ', 'dev2', 'asn', '00', '19', 'ALL', 'ALL', '2');

Are these inserts really broken into two lines for each?

: $connection2 = DBI->connect("DBI:mysql:$database", $user, $message) || die 
: "Cannot connect to $database";
: $load_sql = "source ${CRONLIST_SQL}/load.sql.${file_date}";

This is the part the doesn't seem right...  I don't believe "source" is
valid for this use, it's not like this is the shell.

: $cursor2 = $connection2->prepare($load_sql) or die "Can't prepare $load_sql: 
: $connection2->errstr\n";
: $cursor2->execute;
: $rc2 = $cursor2->finish;
: $rc2 = $connection2->disconnect;

Now, assuming your load file has one statement per line, this is a snap.
If otherwise, you'll have to do multi-line pattern matching to grab your
SQL statements.

Basically:

open(FH, "$CRONLIST_SQL/load.sql.$file_date") or die "cannot open file";
while(<FH>){
        chomp;
        $cursor2 = $connection2->prepare($_);
        $cursor2->execute;
        ....
}
close(FH);

Also, are you intentionally putting braces around your variable names?
After all, this is perl, not the shell... 

-- 
Jason Costomiris <><           |  Technologist, geek, human.
jcostom {at} jasons {dot} org  |  http://www.jasons.org/ 
          Quidquid latine dictum sit, altum viditur.
                    My account, My opinions.



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to