#NEWLINE# def last_insert_id( self , cursor , table_name , pk_name ) : #NEWLINE# #INDENT# '\n        Given a cursor object that has just performed an INSERT statement into\n        a table that has an auto-incrementing ID, returns the newly created ID.\n\n        This method also receives the table name and the name of the primary-key\n        column.\n        ' #NEWLINE# table_name = self . quote_name ( table_name ) #NEWLINE# cursor . execute ( 'SELECT CAST(IDENT_CURRENT(%s) as bigint)' , [ table_name ] ) #NEWLINE# return cursor . fetchone ( ) [ 0 ]