Public bug reported:

Client: mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using 
readline 5.1
Server: Server version: 5.0.77 Source distribution
Python 2.7
oursql-0.9.2-py2.7-linux-i686

When calling LAST_INSERT_ID() cursor.fetchone() must be called twice, or
else a new call to cursor.fetchone() will return None:

>>> cursor.execute("INSERT INTO users (username) VALUES ('test')")
>>> cursor.execute("SELECT LAST_INSERT_ID()")
>>> print cursor.fetchone()
{'LAST_INSERT_ID()': 7L}
>>> cursor.execute("INSERT INTO users (username) VALUES ('test2')")
>>> cursor.execute("SELECT LAST_INSERT_ID()")
>>> print cursor.fetchone()
Expected:
{'LAST_INSERT_ID()': 8L}
Actual:
None

** Affects: oursql
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Agesys
Team, which is subscribed to oursql.
https://bugs.launchpad.net/bugs/718860

Title:
  Call to fetchone after LAST_INSERT_ID() does not clear cursor

Status in oursql:
  New

Bug description:
  Client: mysql  Ver 14.12 Distrib 5.0.77, for redhat-linux-gnu (i686) using 
readline 5.1
  Server: Server version: 5.0.77 Source distribution
  Python 2.7
  oursql-0.9.2-py2.7-linux-i686

  When calling LAST_INSERT_ID() cursor.fetchone() must be called twice,
  or else a new call to cursor.fetchone() will return None:

  >>> cursor.execute("INSERT INTO users (username) VALUES ('test')")
  >>> cursor.execute("SELECT LAST_INSERT_ID()")
  >>> print cursor.fetchone()
  {'LAST_INSERT_ID()': 7L}
  >>> cursor.execute("INSERT INTO users (username) VALUES ('test2')")
  >>> cursor.execute("SELECT LAST_INSERT_ID()")
  >>> print cursor.fetchone()
  Expected:
  {'LAST_INSERT_ID()': 8L}
  Actual:
  None



_______________________________________________
Mailing list: https://launchpad.net/~agesys-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~agesys-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to