#NEWLINE# def GetLastRow( self ) : #NEWLINE# #INDENT# 'Get the last row of a table (in PRIMARY KEY order).\n\n    Returns:\n      A dict of the PRIMARY KEY columns and their values.\n      Returns None if no records found in table.\n    ' #NEWLINE# order_desc = [ ] #NEWLINE# for c in self . _table . GetPrimaryKey ( ) : #NEWLINE# #INDENT# order_desc . append ( ( '`%s` DESC' % c ) ) #NEWLINE# #UNINDENT# attrs = self . _attrs . copy ( ) #NEWLINE# attrs [ 'select' ] = self . _PrimaryKeyForSelect ( ) #NEWLINE# attrs [ 'order_by' ] = ', ' . join ( order_desc ) #NEWLINE# sql = 'SELECT %(select)s FROM %(db)s.%(table)s FORCE INDEX (PRIMARY) ORDER BY %(order_by)s LIMIT 1' #NEWLINE# res = self . _dbh . ExecuteOrDie ( ( sql % attrs ) ) #NEWLINE# if res : #NEWLINE# #INDENT# return res [ 0 ]