def WriteSignedBinaryReferences(self,
                                  binary_id,
                                  references,
                                  cursor=None):
    """Writes blob references for a signed binary to the DB."""
    args = {
        "binary_type":
            binary_id.binary_type.SerializeToDataStore(),
        "binary_path":
            binary_id.path,
        "binary_path_hash":
            mysql_utils.Hash(binary_id.path),
        "blob_references":
            references.SerializeToString()
    }
    query = """
      INSERT INTO signed_binary_references {cols}
      VALUES {vals}
      ON DUPLICATE KEY UPDATE
        blob_references = VALUES(blob_references)
    """.format(
        cols=mysql_utils.Columns(args),
        vals=mysql_utils.NamedPlaceholders(args))
    cursor.execute(query, args)