Componette

Componette

nextras

nextras / dbal v5.0.1

Database Abstraction Layer โ€“ concise secure API to construct queries & fetch data

download-cloud-line composer require nextras/dbal

Nextras Dbal

Build Status Downloads this Month Stable Version Code coverage Packagist PHP Version Support

A powerful abstraction layer for a database. Fast & Safe.

Supported platforms:

  • MySQL via mysqli or pdo_mysql extension,
  • PostgreSQL via pgsql or pdo_pgsql extension,
  • MS SQL Server via sqlsrv or pdo_sqlsrv extension.

Integrations:

  • Symfony Bundle
  • Nette DI Extension
  • Tracy Panel

Docs & resources

Installation

Use composer:

$ composer require nextras/dbal

License

MIT. See full license.

  • v5.0.1 v5.0.1

    Changes in this release:

  • v5.0.0 v5.0.0

    Read the main features overview in a blogpost.

    ๐Ÿš€ Notable Features

    • Make library PHP 8.1+ only (#195)
    • Stop decimal/numeric conversion to floats (BC BREAK!) (#206)
    • Removed already deprecated code (BC BREAK!) (c8c4367)
    • Added PDO drivers (#127)
    • Updated new schema API, read-only (36626a8, #199)
    • BackedEnum support by @mrceperka (#187)
    • Renamed modifier %dts (date-time simple) to %ldt (local date-time) (a25ad7a)
    • Implemented support for custom auto-value modified detection (#154)
    • Implement Result buffering (#128)
    • Switch to nextras/multi-query-parser for SQL parsing (#155)
    • Add support for array{schema, table} in %table modifier (#198)
    • Add support for Fqn instance in %table and %column (#199, 4f2d3a3)
    • Add array spread modifier (#162)
    • Add literal-string types for safe SQL construction (#163)
    • Add Result::getColumns() (#123)

    and many more little features and fixes.

    See closed tickets or see full changelog: v4.0.0...v5.0.0

    Thank you to all contributors and backers.

  • v5.0.0-rc6 v5.0.0-rc6

    • do not add excessive parenthesis to %and / %or processed values
    • make ordering of foreign keys detection stable (added order by)

    Full Changelog: v5.0.0-rc5...v5.0.0-rc6

  • v5.0.0-rc5 v5.0.0-rc5

    What's Changed

    • Added QueryBuilder::$distinct option
    • Skip Postgres' connection param if the value is empty
    • Fix & reimplement getLastInsertedId for various sequence names #240
    • Add port to docs by @jakubenglicky #247

    Full Changelog: v5.0.0-rc4...v5.0.0-rc5

  • v5.0.0-rc4 v5.0.0-rc4

    Changed since 5.0.0-rc3:

    Full Changelog: v5.0.0-rc3...v5.0.0-rc4

  • v5.0.0-rc3 v5.0.0-rc3

    Changes since 5.0.0-rc2:

    • Fix repeated QueryBuilder::from() class (#230)
    • Build & Test with Postgres 16 (#226)
    • Enhanced Tracy panel exception printing (#232)
    • Swap Fqn parameter ordering (BC break) (#234)
    • Add support for processing Fqn with %column modifier (#234)
    • Extend %multiOr, %and & %or support for passing column as Fqn instance (#235)

    Full Changelog: v5.0.0-rc2...v5.0.0-rc3

  • v5.0.0-rc2 v5.0.0-rc2

    • Build & Test with PHP 8.3 (#222)
    • Schema refactoring to readonly classes & Fqn type @hrach (#199)

    Full Changelog: v5.0.0-rc1...v5.0.0-rc2

  • v5.0.0-rc1 v5.0.0-rc1

    • Library is PHP 8.1+ only (BC break!).
    • Added PDO drivers for Mysql, Pgsql, Sqlsrv.
    • Renamed modifier %dts to %ldt (BC break!).
    • Added custom modifier resolution (SqlProcessor::addModifierResolver).
    • Added spread variant of modifiers %...s[] that does not enclose formatted list values to (, ).
    • New DB reflection API - array migrated to classes, fixed issue with escaping and missing db names.
    • PHPStan enhancements & literal-string - typing is better than ever.
    • Added support for PHP 8.1 BackedEnum.
    • New SQL file importer library nextras/multi-query-parser.

    Read more about changes in the blog-post.

    Full Changelog: v4.0.5...v5.0.0-rc1

  • v4.0.5 4.0.5

    Changes in this release:

  • v4.0.4 4.0.4

    ๐Ÿ› Bug Fixes

    Full Changelog: v4.0.3...v4.0.4

  • v4.0.3 4.0.3

    Changes in this release:

    ๐Ÿš€ Features

    • fixed support for PHP 8.1
  • v4.0.2 4.0.2

    New patch version 4.0.2 is out! โ„ What's changed from 4.0.1?

    • mysql: fixed PHP 8.0 exception when accessing field during failed connection [3fe70c9]

    See full commit changelog.

    You may support Nextras Orm by giving it a star here on GitHub โญ or by Sponsorship.
    Thanks to sponsors! ๐Ÿค—

  • v4.0.1 4.0.1

    New patch version 4.0.1 is out! ๐ŸŽƒ What's changed from 4.0.0?

    • mysqli: fixed SSL setup to pass empty string instead of null [201a4cd]

    See full commit changelog.

    You may support Nextras Orm by giving it a star here on GitHub โญ or by Sponsorship.
    Thanks to sponsors! ๐Ÿค—

  • v4.0.0 4.0.0

    The major 4.0.0 version is out! ๐ŸŒบ

    What's new: โœ”

    • added support for Symfony (Bundle + DataCollector),
    • reworked db reflection and added proper multi schema support,
    • introduced new Logger for observing Connection events,
    • added SSL support to MysqliDriver,
    • allow specifying INDEX HINTS for MySQL in QueryBuilder,
    • and many more small fixed & tuning.

    BC breaks: โ—

    • [[ and ]] are considered as escape sequence for ], [ respectively [6330fdd];
    • db reflection returns objects instead arrays [acbd9f7];
    • CachedPlatform is moved to new location [bffed89];
    • added more native types to interfaces [a69cbaf];
    • renamed Connection::getTransactionIndex to getTransactionNextedIndex [2da9cff];
    • Result::current() correctly do not return null when in invalid state [7545696];
    • query builder has new join methods (with BC functionality) [91ff937];
    • exceptions are moved to new location (with BC functionality) [bed5fb6];

    See full commit changelog since 3.1.2 version. ๐Ÿ“ƒ

    The work and this release is sponsored - thanks to all donors. ๐Ÿ’ฐ

  • v4.0.0-rc1 4.0.0 RC1

    The release candidate of major 4.0.0 version is out!

    What's new: โœ”

    • added support for Symfony (Bundle + DataCollector),
    • reworked db reflection and added proper multi schema support,
    • introduced new Logger for observing Connection events,
    • added SSL support to MysqliDriver,
    • allow specifying INDEX HINTS for MySQL in QueryBuilder,
    • and many more small fixed & tuning.

    BC breaks: โ—

    • [[ and ]] are considered as escape sequence for ], [ respectively [6330fdd];
    • db reflection returns objects instead arrays [acbd9f7];
    • exceptions are moved to new location [bed5fb6];
    • CachedPlatform is moved to new location [bffed89];
    • query builder has new join methods [91ff937];
    • added more native types to interfaces [a69cbaf];
    • renamed Connection::getTransactionIndex to getTransactionNextedIndex [2da9cff];
    • Result::current() correctly do not return null when in invalid state [7545696];

    See full commit changelog since 3.1.2 version. ๐Ÿ“ƒ

    The work and this release is sponsored - thanks to all donors. ๐Ÿ’ฐ

  • v3.2.0-rc1 3.2.0 RC1

    The first RC of 3.2.0 version is out!

    What's new:

  • v3.1.2 3.1.2

    Patch version 3.1.2 is out! โ„๏ธ

    What's new:

  • v3.1.1 3.1.1

    Patch version 3.1.1 is out! ๐ŸŒ”

    What's new:

  • v3.1.0 3.1.0

    Next minor version 3.1.0 is out! ๐Ÿฅœ

    What's new:

    • Dbal is now for PHP 7.1+;
    • added type hints for interfaces and many user-facing API (BC break!) [77587e7];
    • Connection::query() always returns a Result object [b2c884b];
    • added support for Nette 3.0;
    • fixed few bugs (caching, setting connectionTz in Postgre) and few more enhancements;

    See full commit changelog since version 3.0.

    You may support Nextras Dbal & Orm development by attending Akademie42 training.

  • v3.0.0 3.0.0

    The new major 3.0.0 version is out! ๐ŸŽ‰ ๐Ÿ

    Notable BC breaks:

    • Library requires PHP 7.0+ version.
    • Date-time fields are converted to DateTimeImmutable instances.
    • Date-time changes: %dts does not do any timezone modifications (removed simpleStorageTz), read more in documentation and see the usage matrix.
    • Connection::ping() does not connect when there is no connection.

    Notable features & changes:

    • Connection: added nested transactions & save-points.
    • Connection: added setter for transaction isolation level.
    • Added %json modifier.
    • Added IConnection interface.
    • Added factory for SqlProcessor.
    • Added SqlSrv driver & MSSQL support.
    • Enhanced Tracy's panel - added elapsed time, explain, updated visual design.
    • See full commit changelog since 2.1 version.
  • v3.0.0-rc2 3.0.0 RC2

    See 3.0 changes in RC1 release notes.

    Changes since RC1:

    • CachedPlatform requires IPlatform instead of Connection (BC break!)
    • more Connection methods moved to IConnection (BC break!)
    • Row: removed numerical array access (BC break!), see #55
    • SQL Server: fixed unique constraint violation detection
    • SQL Server: disable explain queries for debug panel
    • PHPDOC fixes, PHP 7.2 CI testing, aded PhpStan analyzer
    • See full commit changelog since 3.0-RC1 version.

    I'm really sorry for BC breaks in the RC phase, will do better next time.

  • v3.0.0-rc1 3.0.0 RC1

    The first RC of 3.0.0 is out.

    Notable BC breaks:

    • Library requires PHP 7.0+ version.
    • Date-time fields are converted to DateTimeImmutable instances.
    • Date-time changes: %dts does not do any timezone modifications (removed simpleStorageTz), read more in documentation and see the usage matrix.
    • Connection::ping() does not connect when connection is not connected.

    Notable features & changes:

    • Connection: added nested transactions & savepoints.
    • Connection: added setter for transation isolation level.
    • Added %json modifier.
    • Added IConnection interface.
    • Added factory for SqlProcessor.
    • Added SqlSrv driver & MSSQL support.
    • Enhanced Tracy's panel - added elapsed time, explain, updated visual design.
    • See full commit changelog since 2.1 version.
  • v2.1.0 2.1.0

    Next minor version 2.1.0 is out! ๐Ÿ“

  • v2.0.0 2.0.0

    Next major version 2.0.0 is out! ๐ŸŽ ๐ŸŽ‰

    • BC breaks:
      • minimal PHP version is 5.5 [c6b199b]
      • changed signature of IPlatform [91fe03f, fe3f3f8]
      • changed signature of IDriver, convertToSql() method was splitted [a28ba05]
      • changed behavior of %column[] and %table[] modifiers, no parenthesis are added, #31 [e433127]
    • New features:
      • Nette Extension: added support for multiple instances with autowired [bc406a8]
      • SqlProcessor: added %_like_ placeholder, #9 [00a1833]
      • SqlProcessor: added support for insert into table with all default values [96698e0]
      • Connection::queryArgs accepts only an array [7a3474a]
      • added QueryBuilder::getLimitOffsetClause() [2a89af2]
      • added IPlatform::getSequenceName() [91fe03f]
      • added IPlatform::getName() [fe3f3f8]
      • added CachedPlafom [ccbfd48]
    • See full commit changelog since version 1.1.
  • v2.0.0-rc1 2.0.0 RC1

    Next major beta version 2.0.0-rc1 is out!

  • v2.0.0-beta2 2.0.0 BETA 2

    Next major beta version 2.0.0-beta2 is out! What's changed?

    • additions:
      • added IPlatform::getName();
      • added IPlatform::getPrimarySequenceName();
      • added CachedPlatform class;
    • see full commit changelog
  • v1.1.1 1.1.1

    Bugfix version 1.1.1 is out! ๐Ÿ : What's new?

  • v1.1.0 1.1.0

    Minor version 1.0.1 is out! ๐Ÿ : What's new?

    • added:
      • Connection::reconnectWithConfig(), thanks @Mikulas, @JanTvrdik
      • support for DateTimeImmutable, thanks @Mikulas
      • PostgreArrayConverter
      • %blob modifier
    • fixed:
      • calling proper events
    • see full commit changelog
  • v1.0.1 1.0.1

    Bugfix version 1.0.1 is out! ๐Ÿ‹ What's new?

  • v1.0.0 Dbal 1.0.0

    The first stable release of Nextras DBAL.

price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.1)
Componette Componette felix@nette.org