duda con MySQLdb
Publicado por hugo (1 intervención) el 21/03/2007 02:09:53
trato de hacer lo siguiente, construir una expresion regular y pasarla como para metro, lo hago de la siguiente manera:
i>>>mport MySQLdb
>>>db=MySQLdb.connect('localhost','root','','clientes')
>>>curs = db.cursor(MySQLdb.cursors.DictCursor)
>>>var1='"'
>>> var2='"'
>>> var3='select'
>>> var4='*'
>>> var5='from'
>>> var6='nombreCliente'
>>> vare=' '
>>>consul = var1+var3+vare+var4+vare+var5+vare+var6+var2
>>> curs.execute(cosul)
y esto es lo que recibo:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.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 \'"select * from nombreCliente"\' at line 1')
ALGUIEN QUE ME PUEDA DAR UNA MANO, MEJOR AUN DECIRME DONDE BUSCAR : ) POR FAVOR...
i>>>mport MySQLdb
>>>db=MySQLdb.connect('localhost','root','','clientes')
>>>curs = db.cursor(MySQLdb.cursors.DictCursor)
>>>var1='"'
>>> var2='"'
>>> var3='select'
>>> var4='*'
>>> var5='from'
>>> var6='nombreCliente'
>>> vare=' '
>>>consul = var1+var3+vare+var4+vare+var5+vare+var6+var2
>>> curs.execute(cosul)
y esto es lo que recibo:
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line 163, in execute
self.errorhandler(self, exc, value)
File "/usr/lib/python2.4/site-packages/MySQLdb/connections.py", line 35, in defaulterrorhandler
raise errorclass, errorvalue
_mysql_exceptions.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 \'"select * from nombreCliente"\' at line 1')
ALGUIEN QUE ME PUEDA DAR UNA MANO, MEJOR AUN DECIRME DONDE BUSCAR : ) POR FAVOR...
Valora esta pregunta


0