Re: Working with Images

2008-04-22 Thread Sebastian Mendel

Victor Subervi schrieb:

Hi;
The python code works properly, so I assume this is a strictly MySQL
question now :)
If I grab an image in the database thus:

  sql = select pic1 from products where id=' + str(id) + ';
  cursor.execute(sql)
  pic1 = cursor.fetchall()[0][0].tostring()
#  pic1 = cursor.fetchall()[0][0]  // either this or the above line

and try and re-insert it thus:

  cursor.execute('update products set pic1=%s where id=%s, ;',
(pic1, id))


i am not familiar with this python db abstraction class, but

the last comma seems to be wrong

try
'update products set pic1=%s where id=%s;'
instead of
'update products set pic1=%s where id=%s, ;'

or even without ';' too

and is this some sort of prepared statement, or are the parameters escaped 
somewhere else?


--
Sebastian Mendel

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: Working with Images

2008-04-21 Thread Eric Bergen
Victor,

Please give us an example with the python removed and include the
actual syntax error.


-Eric

On Fri, Apr 18, 2008 at 8:41 AM, Victor Subervi [EMAIL PROTECTED] wrote:
 Hi;
  The python code works properly, so I assume this is a strictly MySQL
  question now :)
  If I grab an image in the database thus:

   sql = select pic1 from products where id=' + str(id) + ';
   cursor.execute(sql)
   pic1 = cursor.fetchall()[0][0].tostring()
  #  pic1 = cursor.fetchall()[0][0]  // either this or the above line

  and try and re-insert it thus:

   cursor.execute('update products set pic1=%s where id=%s, ;',
  (pic1, id))

  it tells me I have an error in my MySQL syntax. What is the error?
  TIA,
  Victor




-- 
high performance mysql consulting.
http://provenscaling.com

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Working with Images

2008-04-18 Thread Victor Subervi
Hi;
The python code works properly, so I assume this is a strictly MySQL
question now :)
If I grab an image in the database thus:

  sql = select pic1 from products where id=' + str(id) + ';
  cursor.execute(sql)
  pic1 = cursor.fetchall()[0][0].tostring()
#  pic1 = cursor.fetchall()[0][0]  // either this or the above line

and try and re-insert it thus:

  cursor.execute('update products set pic1=%s where id=%s, ;',
(pic1, id))

it tells me I have an error in my MySQL syntax. What is the error?
TIA,
Victor