[php-src] PR #24375: ext/pdo_odbc: add support for PDO::ATTR_TIMEOUT
| From: | NattyNarwhal | Date: | Fri, 16 Oct 2026 18:11:11 +0000 |
| Subject: | [php-src] PR #24375: ext/pdo_odbc: add support for PDO::ATTR_TIMEOUT | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-39509@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/24375
Author: NattyNarwhal
From the main commit:
> ODBC has both a connection timeout for the connection level and a query
> timeout at the statement level. Annoyingly, these are somewhat poorly
> defined. The connection timeout, for instance, can be defined as either
> a login/connection setup timeout, or as a generic "any action" timeout,
> and if the latter, the query timeout may not necessarily be implemented.
>
> Accordingly, because we have no way to differentiate, we have to set
> both, and have special handling for the initial connection, as the
> setAttribute call won't handle early enough if it only handles initial
> connection timeouts. This means changing it after for a connection isn't
> relevant for existing statements that have already been constructed;
> this commit doesn't add a way to change it for a statement after
> changing it on the connection (be it via setAttribute on the statement,
> or somehow changing statements from the connection setAttribute).
>
> Also annoying is the difference in behaviour between drivers when a
> timeout happens. For example, SQL Server has a query timeout which just
> gracefully ends the current query, but Db2i only has a connection
> timeout which puts the whole connection into an invalid state (but at
> least it should fail a liveness check for a persistent connection). We
> don't have much control over this unfortunately.
>
> In the future, we should consider clarifying the PDO timeout attribute
> behaviour's on statements vs. connections, or make them separate
> attributes, like how PDO_DBLIB has.
May need some refinement for i.e. statement timeout stuff, but I suspect anything needing a new
attribute will need the RFC process.