CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
DBD::mysql::st execute failed: You have an error in your SQL syntax;

 



mapat
New User

Jan 8, 2018, 2:45 PM

Post #1 of 1 (3269 views)
DBD::mysql::st execute failed: You have an error in your SQL syntax; Can't Post

Hello,

I am trying to run a sql script from perl from CentOS host.

I am getting the following error:
DBD::mysql::st execute failed: 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 'SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COL' at line 7 at dump.pl line 109, <INPUT> line 333.
Couldn't execute SQL script: /home/marco/CircleBlack/Repos/database_structure/database-data/nodata/alerts_nodata.sql/alerts_nodata.sql

This is the part of the code that is generating the error. It is complaining about the /*!40101 SET @OLD_COL*/; entries inside the sql script it is supposed to run (alerts_nodata.sql)

Somehow it does not recognize those /*!*/ statements.

This is my code:


Code
unless ( open( INPUT, $sqlFileToExecute ) ) { die "\nCannot open $sqlFileToExecute\n"; } 

my $str = <INPUT>;
print "*** String: " . $str . "\n";

my $lines = "";
while ( $str = <INPUT> ) {
$lines = $lines . $str;
}
print "LINE: " . $lines . "\n";

my $sth2 = $dbh->prepare($lines); #This parses correctly - I see next print stmt
print "End of FILE!!\n";

$sth2->execute() || die "Couldn't execute SQL script: $sqlFileToExecute\n";
$sth2->finish();

close(INPUT);


I would have to get this working so any prompt help would be greatly appreciated.

Thank you.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives