error in inserting a longblob data

ketulp_baroda_at_yahoo.com
Date: 02/24/04


Date: 24 Feb 2004 05:25:40 -0800

Hi
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 "fakeloginserver.py", line 567, in _doRequest
    _handleRequest(_wfile)
  File "fakeloginserver.py", line 812, in _handleRequest
    response.body=_theMethod(**(request.paramMap))
  File "fakeloginserver.py", line 92, in invokeAddAttachment
    add.addAttachment(v,filename,values)
  File "C:\Python23\Lib\site-packages\cherrypy\code\Attachment_Model.py",
line 26, in addAttachment
    n=cursor.execute("insert into attachments
values('%s','%s','%s','%s','%s','%s','%s','%s','%s')"
%(Attachment_Model.projectid[0],values['issueid'],attachID,datetime,values['attachmentdescription'],contenttype,filename,values['attachmentpath'],submitterID))
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\cursors.py", line 95, in
execute
    return self._execute(query, args)
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\cursors.py", line 114,
in _execute
    self.errorhandler(self, exc, value)
  File "C:\PYTHON23\Lib\site-packages\MySQLdb\connections.py", 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??



Relevant Pages

  • Re: INSERT statements not INSERTING when using mysql from python
    ... Well, I've checked the SQL log, and my insert statements are certainly ... But then again when I execute the problematic command manually nothing ... and after that the original tables and database is used. ... It occured to me that if I could access the mysql query log that might ...
    (comp.lang.python)
  • Re: INSERT statements not INSERTING when using mysql from python
    ... One partial explanation might be that for some reason it is recreating ... a PSP script that makes many calls to populate a database. ... Then I execute many insert statements in various different loops on ... It occured to me that if I could access the mysql query log that might ...
    (comp.lang.python)
  • Newbie: Statement handle inactive after successful execute of SELECT
    ... certain operations fail. ... an iterator which walks a set of rows in a MySQL 3.23.58 DB using DBI 1.21. ... or the execute would have failed, and I've verified that @$bind is correct ... database instance in the same MySQL process. ...
    (perl.dbi.users)
  • Re: MySQL Database problem (probably already solved in a message, but this is somewhat urgent)
    ... MySQL server has a database with a table, ... columns, an FSR column, and a password column. ... checked if the supposed arrays that were returned were actually arrays ...
    (comp.lang.php)
  • RE: FreeBSD 5.3 MySQL Performance
    ... versions of Linux and FreeBSD for most tests. ... > popular with the ATA disk drive manufacturers. ... > Many companies have used FreeBSD and MySQL for years and years. ... it is not often that you have such a small database and such a large ...
    (freebsd-questions)