#NEWLINE# def process_insert_get_id( self , query , sql , values , sequence = None ) : #NEWLINE# #INDENT# '\n        Process an "insert get ID" query.\n\n        :param query: A QueryBuilder instance\n        :type query: QueryBuilder\n\n        :param sql: The sql query to execute\n        :type sql: str\n\n        :param values: The value bindings\n        :type values: list\n\n        :param sequence: The ids sequence\n        :type sequence: str\n\n        :return: The inserted row id\n        :rtype: int\n        ' #NEWLINE# if ( not query . get_connection ( ) . transaction_level ( ) ) : #NEWLINE# #INDENT# with query . get_connection ( ) . transaction ( ) : #NEWLINE# #INDENT# query . get_connection ( ) . insert ( sql , values ) #NEWLINE# cursor = query . get_connection ( ) . get_cursor ( ) #NEWLINE# if hasattr ( cursor , 'lastrowid' ) : #NEWLINE# #INDENT# id = cursor . lastrowid #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# id = query . get_connection ( ) . statement ( 'SELECT LAST_INSERT_ID()' ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# query . get_connection ( ) . insert ( sql , values ) #NEWLINE# cursor = query . get_connection ( ) . get_cursor ( ) #NEWLINE# if hasattr ( cursor , 'lastrowid' ) : #NEWLINE# #INDENT# id = sql . lastrowid #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# id = query . get_connection ( ) . statement ( 'SELECT LAST_INSERT_ID()' ) #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( id , int ) : #NEWLINE# #INDENT# return id #NEWLINE# #UNINDENT# if str ( id ) . isdigit ( ) : #NEWLINE# #INDENT# return int ( id ) #NEWLINE# #UNINDENT# return id