MySQL Forums
Forum List  »  Connector/Python

Problem with an insert on MySQL-Python.
Posted by: hadrien axel
Date: January 24, 2008 12:17PM

Hi! I'm working with MySQL on Python and I have a little problem with an insert statement and I don't understand where is the problem...

I have this table:
CREATE TABLE directory (
iddir INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
idfather INTEGER NOT NULL DEFAULT 0,
dname VARCHAR(128) NOT NULL,
PRIMARY KEY(iddir),
INDEX pare(idfather)
) TYPE=InnoDB;

And I'm trying to execute this query:
curs.execute('insert into directory(idfather,dname) values(2,/hi world)')
Of course, the directory number 2 does exist, but the IDLE prompt shows me the next message:

Traceback (most recent call last):
File "<pyshell#81>", line 1, in <module>
curs.execute(query)
File "C:\Python25\Lib\site-packages\MySQLdb\cursors.py", line 166, in execute
self.errorhandler(self, exc, value)
File "C:\Python25\Lib\site-packages\MySQLdb\connections.py", line 35, 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 '/hi world)' at line 1")

It seems that the program does not recognize the string/varchar value, but I don't know... I have already proved without the '/' character and without "gap" space and the problem still stays.

Can anybody help me?
THANKS!!

Options: ReplyQuote


Subject
Written By
Posted
Problem with an insert on MySQL-Python.
January 24, 2008 12:17PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.