Python insert_id()
PHP의 mysql_insert_id() 와 같은 역할을 하는 python의 메쏘드나 프로퍼티
import MySQLdb db = Mysql.connect('db.db.com', 'test', 'test', 'test')
cursor = db.connection.cursor(MySQLdb.cursors.DictCursor)
cursor.excute("INSERT INTO table SET 'field' = 'value'")
print db.connection.insert_id()
cursor의 메쏘드가 아니라 db의 connection의 메쏘드 임을 유의
개발
2008/07/29 13:38
댓글을 달아 주세요