Releases: amphp/sql
Releases · amphp/sql
2.1.1
2.1.0
What's Changed
- Added support for quoted strings within connection strings, e.g.
"host=localhost port=5432 options='--client_encoding=UTF8'"
Full Changelog: v2.0.1...v2.1.0
2.0.1
2.0.0
Stable release compatible with AMPHP v3 and fibers! 🎉
As with other libraries compatible with AMPHP v3, most cases of parameters or returns of Promise<ResolutionType> have been replaced with ResolutionType.
- Added template types to interfaces for better type expression on implementations and extensions.
- All classes now start with
Sqlas a prefix to avoid name collisions with other libraries. - Combined
ResultSetandCommandResultinto a single interface,SqlResult. SqlTransactionnow extendsSqlLinkinstead ofSqlExecutorto support nested transactions.- Added
onCommit()andonRollback()methods toSqlTransaction. These methods attach callbacks after the transaction is either committed or rolled back, respectively. - Removed the methods
createSavepoint(),rollbackTo(), andreleaseSavepont()fromSqlTransaction. Use nested transactions throughSqlTransaction::beginTransaction()instead. SqlPoolnow extendsSqlConnectioninstead ofSqlLink.SqlPool::extractConnection()returns an instance ofSqlConnectioninstead ofSqlLink.- Added
SqlResult::fetchRow(), which will return a single row (associative array) from the result set on each call until no further rows remain in the result. SqlTransientResourceand now extendsAmp\Closable.- Added
SqlTransactionIsolationand an enum-based implementation,SqlTransactionIsolationLevel. - Renamed
ConnectionConfigtoSqlConfig. - Renamed
FailureExceptiontoSqlException.
2.0.0 Beta 6
What's Changed
- The
Transactioninterface now extendsLink, adding nested transaction functionality throughbeginTransaction()on a transaction object. - Added
Connectioninterface with methods to retrieve the config and get/set the current transaction isolation. - The
TransactionIsolationargument ofLink::beginTransaction()has been removed. Transaction isolation is now set on the connection in the newConnectioninterface. Poolnow extendsConnectioninstead ofLink.Pool::extractConnection()returns an instance ofConnectioninstead ofLink.SqlConnector::connect()returns an instance ofConnectioninstead ofLink.- Renamed
Transaction::getIsolationLevel()togetIsolation(). - Removed the methods
createSavepoint(),rollbackTo(), andreleaseSavepont()fromTransaction. Use nested transactions throughbeginTransaction()instead. - Added
onCommit()andonRollback()methods toTransaction. These methods attach callbacks when the transaction is either committed or rolled back, respectively.
Full Changelog: v2.0.0-beta.5...v2.0.0-beta.6
2.0.0 Beta 5
2.0.0 Beta 4
- Removed
PoolError - Updated several docblock types to be
non-empty-stringinstead ofstring
2.0.0 Beta 3
- Added
Result::fetchRow(), which will return a single row (associative array) from the result set on each call until no further rows remain in the result.
// Iterate over result rows with a simple while loop
while ($row = $result->fetchRow()) {
// ...
}
// Also useful if you know your result will contain only a single row
$id = $result->fetchRow()['id'] ?? throw new Exception('Item not found');1.0.2
2.0.0 Beta 2
- Fix template type restriction in
Amp\Sql\Pool.