def ReadSignedBinaryReferences(
      self, binary_id,
      cursor=None):
    """Reads blob references for the signed binary with the given id."""
    cursor.execute(
        """
      SELECT blob_references, UNIX_TIMESTAMP(timestamp)
      FROM signed_binary_references
      WHERE binary_type = %s AND binary_path_hash = %s
    """, [
        binary_id.binary_type.SerializeToDataStore(),
        mysql_utils.Hash(binary_id.path)
    ])
    row = cursor.fetchone()

    if not row:
      raise db.UnknownSignedBinaryError(binary_id)

    raw_references, timestamp = row
    # TODO(hanuszczak): pytype does not understand overloads, so we have to cast
    # to a non-optional object.
    datetime = cast(rdfvalue.RDFDatetime,
                    mysql_utils.TimestampToRDFDatetime(timestamp))

    references = rdf_objects.BlobReferences.FromSerializedString(raw_references)
    return references, datetime
def ReadSignedBinaryReferences ( self , binary_id , cursor = None ) : cursor . execute ( """
      SELECT blob_references, UNIX_TIMESTAMP(timestamp)
      FROM signed_binary_references
      WHERE binary_type = %s AND binary_path_hash = %s
    """ , [ binary_id . binary_type . SerializeToDataStore ( ) , mysql_utils . Hash ( binary_id . path ) ] ) row = cursor . fetchone ( ) if not row : raise db . UnknownSignedBinaryError ( binary_id ) raw_references , timestamp = row datetime = cast ( rdfvalue . RDFDatetime , mysql_utils . TimestampToRDFDatetime ( timestamp ) ) references = rdf_objects . BlobReferences . FromSerializedString ( raw_references ) return references , datetime
Reads blob references for the signed binary with the given id.