Skip to content

Releases: davahome/database

Added PHP 8.1+ support

07 Jan 15:55

Choose a tag to compare

General

  • Dropped PHP 7 support
  • New minimum required version: 8.1
  • Enforced PHP8 types on methods (mainly type mixed as all other types were present since v2.0)

Testing

  • Removed all obsolete build configurations (travis, Jenkins)
  • Added GitHub Actions build pipeline
  • Relaced PHPunit with Pest PHP

v2.0

20 Jan 00:27

Choose a tag to compare

v2.0 Pre-release
Pre-release

General

  • Dropped PHP 5 support
  • New minimum required version: 7.4
  • Enforced PHP7 types on methods
  • Moved classes into new namespaces
    • DavaHome\Database\DatabaseInterface => DavaHome\Database\Adapter\AdapterInterface
    • Mysql, Pdo & Sqlite3 => from DavaHome\Database to DavaHome\Database\Adapter
    • DirectValue & CustomOperator => from DavaHome\Database to DavaHome\Database\Extension

Mysql

  • New default encoding => from utf8 to utf8mb4

1.6.1

02 Jan 22:10

Choose a tag to compare

1.6.1 Pre-release
Pre-release

Fixed PHPDoc return values for MySQL-class

Isolation Level Constants, DatabaseInterface, UTF8

29 Oct 17:43

Choose a tag to compare

Isolation Level Constants

The Mysql class has now a set of isolation level constants and a helper method for setting the level.

# New constants
Mysql::ISOLATION_LEVEL_READ_UNCOMITTED
Mysql::ISOLATION_LEVEL_READ_COMMITTED
Mysql::ISOLATION_LEVEL_REPEATABLE_READ
Mysql::ISOLATION_LEVEL_SERIALIZABLE

# New method
void setIsolationLevel($isolationLevel)

# Example
$mysql = new Mysql();
$mysql->setIsolationLevel(Mysql::ISOLATION_LEVEL_SERIALIZABLE);

DatabaseInterface

There is a new interface which defines the core functionality (update, insert, select and delete). Future wrappers (like Sqlite3) will implement this interface as well.

DavaHome\Database\DatabaseInterface

UTF8

The Mysql class will now perform a second query on initial connection:

SET CHARACTER SET utf8

Documentation

Updated the Readme and fixed some syntax errors in demo code.

Notes

Warning: Despite its existence the DavaHome\Database\Sqlite3 class shouldn't be used yet.

Allow empty where-statements for select

18 Jul 20:34

Choose a tag to compare

It is now possible to give an empty array to ->select() without creating an error but the parameter $where is still required

$db->select('table', []);

Added CustomOperator

30 Jun 23:32

Choose a tag to compare

Regular query building

Input

['foo' => 'bar']

Query

`foo` = :value_0

CustomOperator query building

Input

use DavaHome\Database\CustomOperator;
['foo' => new CustomOperator('!=', 'bar')]

Query

`foo` != :value_0

Advanced CustomOperator query building

Input

use DavaHome\Database\CustomOperator;
use DavaHome\Database\DirectValue;
['foo' => new CustomOperator('!=', new DirectValue('NOW()'))]

Query

`foo` != NOW()

Fixed custom options for PDO

30 Jun 22:31

Choose a tag to compare

-        $options = array_merge([
+        $options = array_replace([

Added createUuid()

20 Jun 14:17

Choose a tag to compare

$db = new \DavaHome\Database\Mysql();
$uuid = $db->createUuid();

Commit: 3060047
UUID() Documentation: https://dev.mysql.com/doc/refman/5.7/en/miscellaneous-functions.html#function_uuid

Added select() and delete()

09 Jun 12:22

Choose a tag to compare

$db = new \DavaHome\Database\Mysql();

$pdoStatement = $db->select('table', ['id' => 1]);
$pdoStatement = $db->delete('table', ['id' => 1]);

Fixed undefined constant error

08 Jun 19:50

Choose a tag to compare

CRIT (2): Error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in src/DavaHome/Database/Mysql.php:16