If you check [PEP 248, the return value from .execute is undefined (although
MySQLdb does happen to return rowcount in this case). I think the code you
want is
](http://www.python.org/dev/peps/pep-0249/)
cursor = self.__db.cursor()
cursor.execute('select * from UserConfirm where Benutzer = \'' + "test1" + '\'') 1L
row = cursor.fetchone()
[
By the way, to protect yourself against SQL injection attacks you should let
the library put your parameters into the query (and it's less code!).
](http://www.python.org/dev/peps/pep-0249/)
cursor.execute('select * from UserConfirm where Benutzer = %s',"test1")
[
](http://www.python.org/dev/peps/pep-0249/)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
(sorry for the messed-up formatting, trying again...)
If you check PEP 248, the return value from .execute is undefined (although
MySQLdb does happen to return rowcount in this case). I think the code you
want is
cursor = self.__db.cursor()
cursor.execute('select * from UserConfirm where Benutzer = \'' + "test1" + '\'') 1L
row = cursor.fetchone()
By the way, to protect yourself against SQL injection attacks you should let
the library put your parameters into the query (and it's less code!).
cursor.execute('select * from UserConfirm where Benutzer = %s',"test1")
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi!
I got a table:
+-----------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------+-------------+------+-----+---------+-------+
| Benutzer | varchar(50) | YES | | NULL | |
| Confirmed | tinyint(1) | YES | | NULL | |
+-----------+-------------+------+-----+---------+-------+
with one entry.
if I execute on the mysql console in a shell:
select Benutzer from UserConfirm where Benutzer = '{\'gid\'\:\ \'tamer\'\,\ \'uid\'\:\ \'tamer\'}'
it works, on python there comes the errormessage:
TypeError: 'long' object is not callable
Whatr did I make wrong?!
Here is my pyhon code:
cursor = self.__db.cursor().execute('select * from UserConfirm where Benutzer
= \'' + ds + '\'')
return cursor().fetchrow()
for any advise I would kindly thank you.
Tamer
If you check [PEP 248, the return value from .execute is undefined (although
MySQLdb does happen to return rowcount in this case). I think the code you
want is
](http://www.python.org/dev/peps/pep-0249/)
[
By the way, to protect yourself against SQL injection attacks you should let
the library put your parameters into the query (and it's less code!).
](http://www.python.org/dev/peps/pep-0249/)
[
](http://www.python.org/dev/peps/pep-0249/)
(sorry for the messed-up formatting, trying again...)
If you check PEP 248, the return value from .execute is undefined (although
MySQLdb does happen to return rowcount in this case). I think the code you
want is
By the way, to protect yourself against SQL injection attacks you should let
the library put your parameters into the query (and it's less code!).