Skip to content

Commit a2f486e

Browse files
committed
fix(pool): answer the attribute support setter without a checkout
Its answer depends only on the value asked for, and every checkout already replays that value, so it is kept per pool like the capabilities. A pinned connection is told directly, since it is not replayed onto.
1 parent 48dbdc2 commit a2f486e

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

‎src/Database/Adapter/Pool.php‎

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,13 +936,28 @@ public function setUTCDatetime(string $value): mixed
936936

937937
/**
938938
* The setter returns the support the adapter ends up with, which is what
939-
* the getter has to report from now on.
939+
* the getter has to report from now on. That answer depends only on the
940+
* value asked for, so it is kept per pool, and every checkout replays the
941+
* value itself. A pinned connection is not replayed onto, so it is told
942+
* directly.
940943
*/
941944
public function setSupportForAttributes(bool $support): bool
942945
{
943946
$this->supportForAttributes = $support;
947+
$this->pinnedAdapter?->setSupportForAttributes($support);
944948

945-
return $this->reportedSupportForAttributes = $this->delegate(__FUNCTION__, \func_get_args());
949+
$key = __FUNCTION__ . ($support ? '(true)' : '(false)');
950+
$answer = self::$capabilities[$this->pool][$key] ?? null;
951+
952+
if ($answer === null) {
953+
$answer = $this->delegate(__FUNCTION__, \func_get_args());
954+
955+
$answers = self::$capabilities[$this->pool] ?? [];
956+
$answers[$key] = $answer;
957+
self::$capabilities[$this->pool] = $answers;
958+
}
959+
960+
return $this->reportedSupportForAttributes = $answer;
946961
}
947962

948963
public function getSupportForIntegerBooleans(): bool

0 commit comments

Comments
 (0)