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.