Hi There,

On http://www.codepedia.com/1/PerlDBITutorial I found that prepare()
would escape a string.
Now I have a query like this:
"INSERT INTO logs (source, date, time, program, msg, inserttime) VALUES
('NovaxPRG-T0029', '2009-11-02', '09:51:11', 'NovaxPRG', 'NovaxPRG
[931]: T0029: CRITICAL: couldn't establish connection with INIT
Priority=-1 Position=0:0 Speed=0 Heading=0 Intersection= Approach="
and mysql tells me
"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 't establish connection with INIT Priority=-1
Position=0:0 Speed=0 Heading=0 Inte' at line 1 at /root/cron/
log_parser.pl line 143."

even tho my code I pass the query  to prepare() first. Why that? A
code snippet:
        print "Query: ".$query."\n";
        $pre = $dbh->prepare($query) || die "Error: ".$dbh-
>errstr."\n";
        $pre->execute || "Error: ".$dbh->errstr."\n";

Why is that? What am i doing wrong? The apostrophy in my query
apparently is messing it all up.
Thanks for help and suggestions!
Ron


-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to