R
Raymond O'connor
I'm trying to use the mysql 'source' command within a ruby script to run
a batch file, but it doens't seem to work. When I run the source
command straight from mysql, though, it runs just fine. Here's a short
example of what I'm trying to do:
require 'mysql'
db = Mysql.real_connect(db_host, db_user, db_pass, db_name)
filename = "/Users/test/batch.sql"
db.query "source #{filename}"
I keep getting this error when I try to do dbh.query "source
${filename}"
Error code: 1064
Error message: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'SOURCE /Users/test/batch.sql' at line 1
Error SQLSTATE: 42000
Anyone have any ideas? Thanks in advance.
a batch file, but it doens't seem to work. When I run the source
command straight from mysql, though, it runs just fine. Here's a short
example of what I'm trying to do:
require 'mysql'
db = Mysql.real_connect(db_host, db_user, db_pass, db_name)
filename = "/Users/test/batch.sql"
db.query "source #{filename}"
I keep getting this error when I try to do dbh.query "source
${filename}"
Error code: 1064
Error message: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'SOURCE /Users/test/batch.sql' at line 1
Error SQLSTATE: 42000
Anyone have any ideas? Thanks in advance.