Releases: amphp/mysql
Releases · amphp/mysql
0.3.0
This release represents a major internal refactor and API refactor for similarity to the amphp/postgres library API. The query method signatures (query
, prepare
, execute
) remain unchanged from the previous version. However most code using this library will likely require some changes based on list of API changes below.
API Changes
- Pools have been significantly refactored.
Pool
is now an interface.Connection
andPool
share a commonLink
interface, so most operations can be performed using a single connection or a pool of connections. Operations using a pool automatically return the underlying connection to the pool once the operation has completed. - Connections should be made using the
Amp\Mysql\connect()
function (returns a promise resolved with aConnection
object) and connection pools created using theAmp\Mysql\pool()
function. - Added dedicated transaction API through the
Transaction
object returned byLink::transaction()
. All operations performed on aTransaction
object use a single underlying connection. - Added
Executor
interface, implemented by connections, pools, and theTransaction
object. Stmt
renamed toConnectionStatement
.Statement
interface added (use this interface for any type-declarations), implemented byConnectionStatement
.ResultSet
has been refactored to implementAmp\Iterator
. Queries returning multiple result sets may useResultSet::nextResultSet()
to move the iterator to the next result set.- Promises from data modification queries (e.g.: INSERT, UPDATE, DELETE) are now resolved with a
CommandResult
object.
Further documentation is in progress, for now please have a look through the code doc-blocks for more information.