MySQLdb: execute query results...
mackstann
mack at incise.org
Sun Aug 31 20:14:00 EDT 2003
On Sun, Aug 31, 2003 at 11:57:07PM +0000, Sheila King wrote:
> Here is what I *think* I know...let me know if I'm wrong, for crying out
> loud!!!
>
> [...]
>
> >>> result = c.execute("""<some proper MySQL query here>""")
>
> doesn't result always return the number of affected rows?
>
> [...]
>
> Can I *RELY* on that "2L" result of the UPDATE statement under the cursor's
> "execute" method representing the number of rows updated? Or am I assuming
> too much?
Looked in site-packages/MySQLdb/cursors.py, and it seems you are
correct.
>>> from MySQLdb import cursors
>>> help(cursors.BaseCursor.execute)
Help on method execute in module MySQLdb.cursors:
execute(self, query, args=None) unbound MySQLdb.cursors.BaseCursor
method
Execute a query.
[...]
Returns long integer rows affected, if any
HTH,
--
Nick Welch aka mackstann | mack @ incise.org | http://incise.org
Harris's Lament:
All the good ones are taken.
More information about the Python-list
mailing list