code: def db_set_assoc(self, server_url, handle, secret, issued, lifetime, assoc_type):
          
          result = self.db_get_assoc(server_url, handle)
          rows = self.cur.fetchall()
          if len(rows):
              # Update the table since this associations already exists.
              return self.db_update_assoc(secret, issued, lifetime, assoc_type,
                                          server_url, handle)
          else:
              # Insert a new record because this association wasn't
              # found.
              return self.db_new_assoc(server_url, handle, secret, issued,
                                       lifetime, assoc_type)
docs: Set an association.  This is implemented as a method because
          REPLACE INTO is not supported by PostgreSQL (and is not
          standard SQL).