Releases: amphp/sql
Releases · amphp/sql
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
Sql
as a prefix to avoid name collisions with other libraries. - Combined
ResultSet
andCommandResult
into a single interface,SqlResult
. SqlTransaction
now extendsSqlLink
instead ofSqlExecutor
to 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. SqlPool
now extendsSqlConnection
instead ofSqlLink
.SqlPool::extractConnection()
returns an instance ofSqlConnection
instead 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. SqlTransientResource
and now extendsAmp\Closable
.- Added
SqlTransactionIsolation
and an enum-based implementation,SqlTransactionIsolationLevel
. - Renamed
ConnectionConfig
toSqlConfig
. - Renamed
FailureException
toSqlException
.
2.0.0 Beta 6
What's Changed
- The
Transaction
interface now extendsLink
, adding nested transaction functionality throughbeginTransaction()
on a transaction object. - Added
Connection
interface with methods to retrieve the config and get/set the current transaction isolation. - The
TransactionIsolation
argument ofLink::beginTransaction()
has been removed. Transaction isolation is now set on the connection in the newConnection
interface. Pool
now extendsConnection
instead ofLink
.Pool::extractConnection()
returns an instance ofConnection
instead ofLink
.SqlConnector::connect()
returns an instance ofConnection
instead 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-string
instead 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
.
2.0.0 Beta 1
Initial release compatible with AMPHP v3.
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.
TransientResource
now extendsAmp\Closable
- Added
TransactionIsolation
and an enum-based implementation,TransactionIsolationLevel
- Combined
ResultSet
andCommandResult
into a single interface,Result
- Renamed
ConnectionConfig
toSqlConfig
- Renamed
Connector
toSqlConnector
- Renamed
FailureException
toSqlException