Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > error in inserting a longblob data

Reply
Thread Tools

error in inserting a longblob data

 
 
ketulp_baroda@yahoo.com
Guest
Posts: n/a
 
      02-24-2004
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??
 
Reply With Quote
 
 
 
 
wes weston
Guest
Posts: n/a
 
      02-24-2004
http://www.velocityreviews.com/forums/(E-Mail Removed),

Is it possible that the error is caused by a string
that has an ' in it? Thus yielding something like
'abc'xyz' - a string with an embedded '. The listed
're looks suspecious; like it was the end of you're
maybe.

wes

(E-Mail Removed) wrote:
> 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??


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how much data can you pump into longblob from textarea? davemitc@gmail.com HTML 63 03-20-2011 12:23 AM
Fetching & Inserting Data into a column of TEXT Data type in SQL server 2000 Using ASP.NET Bhavesh ASP .Net 5 07-18-2007 07:39 AM
Fetching & Inserting Data into a column of TEXT Data type in SQL server 2000 Using ASP.NET Bhavesh ASP .Net 1 07-17-2007 09:05 AM
Inserting & Fetching Data into a column of TEXT Data type in SQL server 2000 Using ASP.NET Bhavesh ASP .Net 0 07-16-2007 11:15 AM
Inserting into one table data from 2 tables and some input data. Renie83 ASP General 1 07-10-2003 08:29 PM



Advertisments