Skip to content

0.3.0

Compare
Choose a tag to compare
@trowski trowski released this 12 Dec 17:45
· 254 commits to 3.x since this release
a3c4ba5

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 and Pool share a common Link 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 a Connection object) and connection pools created using the Amp\Mysql\pool() function.
  • Added dedicated transaction API through the Transaction object returned by Link::transaction(). All operations performed on a Transaction object use a single underlying connection.
  • Added Executor interface, implemented by connections, pools, and the Transaction object.
  • Stmt renamed to ConnectionStatement. Statement interface added (use this interface for any type-declarations), implemented by ConnectionStatement.
  • ResultSet has been refactored to implement Amp\Iterator. Queries returning multiple result sets may use ResultSet::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.