Releases: amphp/postgres
1.2.0
1.1.1
1.1.0
- Added methods to
PqConnection
to toggle result set buffering on and off:shouldBufferResults()
,shouldNotBufferResults()
, andisBufferingResults()
. - Removed a circular reference when destructing of unbuffered result sets that would sometimes delay destruction.
- Fixed a bug where simultaneously preparing the same statement and immediately destructing the first prepared statement object would cause the connection to be marked as available.
1.0.4
- Fixed statement reference counts if the same statement was prepared simultaneously on a single connection.
- The pool no longer caches statement pools internally. If you reuse a statement very frequently, it is recommended to retain a reference to the statement object returned from the pool for better performance. (#19)
- Removed a circular reference within
Connection
that could delay automatic destruction and closure of a single connection. - Added back-pressure to unbuffered queries to improve memory consumption of large result sets.
1.0.3
1.0.2
- Fixed an issue when using this library with
amphp/mysql
that caused the sameConnector
object to be returned by theconnector()
function in both libraries.
1.0.1
1.0.0
The interface structure of this library changed significantly, however most consumers of this library should be able to upgrade from v0.2.x
by only updating the code initializing a connection or pool to use an instance of ConnectionConfig
instead of a connection string. Using a connection or pool to perform queries has remained unchanged since v0.2.x
, with the exception that transactions are now started with Link::beginTransaction()
instead of Link::transaction()
.
- Prepared statements now support
?
and named placeholders (e.g.:SELECT * FROM people WHERE name = :name
). Named placeholders are used by providing an array with keys matching the placeholders:$statement->execute(['name' => $name])
. - The fetch-type parameter has been removed from
ResultSet::getCurrent()
. All rows are always returned as associate arrays. - Table data that is scalar or an array are automatically cast to the appropriate PHP type when using
ext-pgsql
. This matches the behavior when usingpecl-pq
. - Common interfaces such as
Statement
andPool
that are shared withamphp/mysql
are now in a separate library,amphp/sql
. ConnectionConfig
is now built with a list of parameters instead of a connection string. UseConnectionConfig::fromString()
to use a connection string.- Statements created in a pool are cached and reused if the same statement is prepared or executed again.
- The
Operation
interface has been dropped in favor of decorators. This interface was internally used to automatically free resources on destruction.
Please review the interfaces in amphp/sql
to ensure no other interface changes or method renames may affect your code.
0.2.1
0.2.0
This release adds some new features and bugfixes while mostly maintaining compatibility with the prior release. Parameter changes to execute()
is the most notable API break that will require some minor updates to existing code using this library.
API Changes
Connection::execute()
andPool::execute()
now use an array of query parameters as the second parameter instead of being variadic.Statement::execute()
also uses an array of query parameters instead of being variadic.Pool
no longer extendsConnection
. InsteadPool
andConnection
implement a new common interface,Link
. UseLink
if a pool or single connection may be used.- Abstract class
TupleResult
renamed toResultSet
and is now an interface. Result set classes have been renamed withResultSet
as a suffix (e.g.:PqUnbufferedResultSet
).
New Features
Pool::extractConnection()
added to extract a connection from a pool. Once extracted, the connection will not automatically re-added to the pool.quoteString()
andquoteName()
added toHandle
interface that quote value strings and identifier names respectively for safe insertion into query strings.- Added
QueryExecutionError
exception class extendingQueryError
, adding agetDiagnostics()
method that returns an array of debug information. See PQresultErrorField docs. - Added
isAlive()
toHandle
interface that returns false if the database connection has been closed. Connections in pool are automatically removed ifisAlive()
returns false. - Added
getQuery()
toStatement
interface that returns the prepared SQL string.
Fixes
- Preparing an invalid query with the pgsql extension will fail the promise returned from
Executor::prepare()
instead of failing when trying to useStatement::execute()
. - Prepared statements mark a pooled connection as busy to prevent unintentional query overlap. Avoid using a pool to generate a large number of long-held prepared statements.