return None
return self._rotate()
- def maintain(
- self,
- query: PostgresQuery,
- results: Sequence["PGresult"],
- prep: Prepare,
- name: bytes,
- ) -> Optional[bytes]:
- """Maintain the cache of the prepared statements."""
- key = self.maybe_add_to_cache(query, prep, name)
- if key is None:
- return None
-
- return self.validate(key, prep, name, results)
-
def clear(self) -> Optional[bytes]:
if self._prepared_idx:
self._prepared.clear()
# Update the prepare state of the query.
# If an operation requires to flush our prepared statements cache, do it.
- cmd = self._conn._prepared.maintain(pgq, results, prep, name)
- if cmd:
- yield from self._conn._exec_command(cmd)
+ key = self._conn._prepared.maybe_add_to_cache(pgq, prep, name)
+ if key is not None:
+ cmd = self._conn._prepared.validate(key, prep, name, results)
+ if cmd:
+ yield from self._conn._exec_command(cmd)
return results