Skip to content

Releases: PhpGt/Database

Refactored and restyled

05 Dec 17:26
ba65fb6
Compare
Choose a tag to compare
Pre-release
  • All CodeSniffer inspections are resolved.
  • The updated PHP.Gt/StyleGuide has been adhered to.
  • CircleCI updated to 2.0

Variable argument bugfixes

25 Aug 17:06
Compare
Choose a tag to compare
Pre-release

Allowing named or ordered bindings utilised the new PHP feature of variable arguments, using the ... operator. This new feature, coupled with the shorthand helper methods caused a situation where bindings could be doubly nested.

Shorter more expressive syntax

25 Aug 16:15
Compare
Choose a tag to compare
Pre-release

The introduction of the concept of a QueryCollection meant that longhand API usage was too wordy and had too many steps to perform simple operations.

This release includes a new shorter syntax and due to this syntax being preferred, dropping accessing QueryCollection via ArrayAccess (backwards breaking).

New syntax:

$db = new Client();

$customer = $db->fetch("customer/getById", ["id" => 123]);
$customerList = $db->fetchAll("customer/getInTown", ["town" => "London"]);
$newCustomerId = $db->insert("customer/create", $details);
$updatedCount = $db->update("customer/setDetails", $details);
$deletedCount = $db->delete("customer/deleteOlderThan", ["createdAt" =>new DateTime("-30 days")]);

Pure PDO dependency

22 Aug 16:39
Compare
Choose a tag to compare
Pure PDO dependency Pre-release
Pre-release

As in v1 we are not supporting any QueryBuilder or SchemaBuilder, we're dropping the requirement of Illuminate's database layer. There was no benefit from the heavy reliance on Reflection, so now it's been removed and there is only a dependency on PDO itself.

Connection and migration changes

07 Mar 11:40
Compare
Choose a tag to compare
Pre-release
  • Set port number in settings constructor
  • Refactor db-migrate script
  • Dependencies updated to avoid major bug with Illuminate's dependency injector

Variable argument queries for question mark parameters

05 Feb 18:18
Compare
Choose a tag to compare

Certain queries are better to use ? placeholders rather than :named placeholders, typically queries where the placeholder can be inferred by the query name.

For example, the getById query should only take the one parameter, which doesn't need to be named "id" when calling.

Clean, improved syntax:

$customer = $db["customer"]->getById(123);

Rather than:

$customer = $db["customer"]->getById(["id" => 123]);

Migration integrity

12 Jan 10:15
Compare
Choose a tag to compare
Migration integrity Pre-release
Pre-release

During migration, each migration script is hashed and stored in the database to prevent accidental edits to already-migrated scripts. The migration tool will halt without altering the database if any edit is detected.

Major bugfixes

05 Jan 12:48
Compare
Choose a tag to compare
Major bugfixes Pre-release
Pre-release

Many bugs have been fixed working with subsequent query calls.

Migrations

19 Dec 15:37
Compare
Choose a tag to compare
Migrations Pre-release
Pre-release

Basic database migration functionality implemented.

Updates to ResultSet

19 Dec 15:37
Compare
Choose a tag to compare
Updates to ResultSet Pre-release
Pre-release

Rows are now Iterable.
Exceptions are thrown by default.
Parameters have their placeholder characters set by default.
ResultSet::hasResult added.