error in inserting a longblob data

ketulp_baroda at ketulp_baroda at
Tue Feb 24 14:25:40 CET 2004

I am storing the attachment in the database. For some file the data
gets stored in the database but for other files it gives a MySql
error. For eg. when I am trying to attach the file say foo.txt it gets
stored in database correctly whereas the file bar.txt gives an error.
The error given is:

Traceback (most recent call last):
  File "", line 567, in _doRequest
  File "", line 812, in _handleRequest
  File "", line 92, in invokeAddAttachment
  File "C:\Python23\Lib\site-packages\cherrypy\code\",
line 26, in addAttachment
    n=cursor.execute("insert into attachments
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\", line 95, in
    return self._execute(query, args)
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\", line 114,
in _execute
    self.errorhandler(self, exc, value)
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\", line
33, in defaulterrorhandler
    raise errorclass, errorvalue
ProgrammingError: (1064, "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 're just getting started with CherryPy, read the
tutorial (in do")

values['attachmentpath'] contains the file data.
The data type of the file data is LONGBLOB in MySql.
I am not getting why it works for some file but not for others.How can
I make it work for all files??

More information about the Python-list mailing list