Mailing List
Home
Forum Home
MySQL General - General MySQL discussion
MaxDB - Everything about MaxDB, formerly known as SAP DB
MySQL++ - Programming with the C++ API to MySQL
MySQL on Win32 - Runing MySQL on Windows 9x/Me/NT/2000/XP
ODBC - ODBC with the MySQL Connector/ODBC driver
Java Help - Mostly related to the MySQL Connector/J driver
Perl - Perl support for MySQL with DBI and DBD::mysql
GUI - MySQL GUI Tools
Announcement
Subjects
mysql openssl Question
mysql:it 's a db not a dbms how it 's possible?!
Does the binary log enabling affect the MySQL performances?
Strange behavior, Table Level Permission
FULLTEXT query format question
Preventing Duplicate Entries
Comparing and writing out BLOBS
Executing MySQL Commands From Within C Program
Can 't access mysql after kernel upgrade
Mysql 4 0 Oracle Stored Procedure Trigger Conversion
Downgrade Mysql from 4 to 3 23
MySQL Cluster Software
mysql test 4 1 fails with the gis test
ERROR 2002: Can 't connect to local MySQL server through socket
Getting Identity after INSERT
Update one field with more fields from another table
ERROR 1045: Access denied for user: 'root@localhost ' (Using
password: NO)
mysql have same function mthod as Oracle decode()
 
Problem with INSERT

Problem with INSERT

2006-07-03       - By Duane Hill

 Back
Reply:     1     2     3  

Can someone either answer or point me somewhere for the answer?

I am attempting to store text lines from an e-mail message into a MySQL
table through the use of Perl and DBI. Periodically I get the error that
states there was an error in the statement and to check the syntax. I know
it has something to do with how the statement is being interpreted. Here
is the Perl that is in question:

  $sql  = "INSERT INTO msg_line_hash ";
  $sql .= "  (line_text, line_hash, total_count) ";
  $sql .= "VALUES ";
  $sql .= "  ('$msgline', '$digest', 1) ";
  $sql .= "ON DUPLICATE KEY UPDATE total_count = total_count + 1";

  $sth = $dbh->prepare_cached($sql);
  $sth->execute();

I'm preparing the statement as cached based on the fact it will be the
same statement that will execute several times. Therefore, eliminating
having to contact the server on every perpare.

I know it's the $msgline that is causing issues in that if I pack $msgline
into a readable hex text line, it stores without any errors. That would
mean the SQL statement is getting messed up because of some of the
characters within $msgline.

As to $digest, there isn't any issues with that. It is just an SHA hash of
$msgline.

--
"This message was sent using 100% recycled electrons."

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/mysql?unsub=mysql@(protected)