#NEWLINE# def _HandleResult( self , result ) : #NEWLINE# #INDENT# 'Handle the ResultProto from an Exec/ExecOp call.\n\n    Args:\n      result: The client_pb2.ResultProto to handle.\n\n    Returns:\n      The given client_pb2.ResultProto.\n\n    Raises:\n      DatabaseError: A SQL exception occurred.\n    ' #NEWLINE# if result . HasField ( 'rows' ) : #NEWLINE# #INDENT# description = self . _GetDescription ( result ) #NEWLINE# if description : #NEWLINE# #INDENT# self . _description = description #NEWLINE# #UNINDENT# if ( not self . _rows ) : #NEWLINE# #INDENT# self . _rows = collections . deque ( ) #NEWLINE# #UNINDENT# new_rows = self . _GetRows ( result ) #NEWLINE# if ( new_rows is not None ) : #NEWLINE# #INDENT# if ( self . _rowcount == ( - 1 ) ) : #NEWLINE# #INDENT# self . _rowcount = len ( new_rows ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . _rowcount += len ( new_rows ) #NEWLINE# #UNINDENT# self . _rows . extend ( new_rows ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if result . HasField ( 'rows_updated' ) : #NEWLINE# #INDENT# self . _rowcount = result . rows_updated #NEWLINE# #UNINDENT# #UNINDENT# if result . generated_keys : #NEWLINE# #INDENT# self . lastrowid = long ( result . generated_keys [ ( - 1 ) ] ) #NEWLINE# #UNINDENT# if result . HasField ( 'statement_id' ) : #NEWLINE# #INDENT# self . _statement_id = result . statement_id #NEWLINE# #UNINDENT# self . _more_rows = result . more_rows #NEWLINE# self . _more_results = result . more_results #NEWLINE# return result