On Mon, Dec 31, 2001 at 08:47:27AM -0600, Stephen Spalding <[EMAIL PROTECTED]> 
wrote:
| I'm trying to 'source' a mysql script file from inside of perl and I'm 
| having problems. The mysql script file is called load.sql.20011231, and it's 
| full of insert statements. Here a small sample:
| 
| insert into crontabs values
| (' ', 'dev2', 'asn', '00', '19', 'ALL', 'ALL', '1');
| insert into crontabs values
| (' ', 'dev2', 'asn', '00', '19', 'ALL', 'ALL', '2');
| 
| Here is the perl code that I'm using to try to execute the sourcing of this 
| file:
| 
| $connection2 = DBI->connect("DBI:mysql:$database", $user, $message) || die 
| "Cannot connect to $database";
| $load_sql = "source ${CRONLIST_SQL}/load.sql.${file_date}";
| $cursor2 = $connection2->prepare($load_sql) or die "Can't prepare $load_sql: 
| $connection2->errstr\n";
| $cursor2->execute;
| $rc2 = $cursor2->finish;
| $rc2 = $connection2->disconnect;
| 
| Here is the error that I'm getting when trying to run this:
| 
| DBD::mysql::st execute failed: You have an error in your SQL syntax near 
| 'source /home/cronlist/sql/load.sql.20011231' at line 1 at
| /home/cronlist/bin/crontab_load.pl line 74.

MySQL has a "SOURCE" command? News to me.

But it has a LOAD DATA command:

        
http://www.mysql.com/documentation/mysql/bychapter/manual_Reference.html#IDX1416

Cheers,
-- 
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

          "Neomort" : Brain-dead human, kept alive for medical purposes.
"Medicine Lecturer" : Brain-dead human, kept alive for medical purposes.



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

Reply via email to