Skip to content

Commit

Permalink
Prepare release 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sad-spirit committed Sep 12, 2024
1 parent 19befdf commit 332965d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
9 changes: 7 additions & 2 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# Changelog

## [Unreleased]
## [2.5.0] - 2024-09-12

### Fixed
* `converters\datetime\IntervalConverter::output()` could incorrectly format the passed `float`-typed value.
* `$block` property of `types\Tid` class no longer has an `int` typehint: as was the case with OIDs, block number
is an *unsigned* 32-bit integer and may be out of range of PHP's *signed* `int` type on 32-bit builds.

### Deprecated
* Getters / issers methods of classes representing complex PostgreSQL types. Use corresponding magic properties,
Expand Down Expand Up @@ -302,4 +307,4 @@ Initial release on GitHub
[2.3.0]: https://github.com/sad-spirit/pg-wrapper/compare/v2.3.0-beta...v2.3.0
[2.4.0]: https://github.com/sad-spirit/pg-wrapper/compare/v2.3.0...v2.4.0
[2.4.1]: https://github.com/sad-spirit/pg-wrapper/compare/v2.4.0...v2.4.1
[Unreleased]: https://github.com/sad-spirit/pg-wrapper/compare/v2.4.1...HEAD
[2.5.0]: https://github.com/sad-spirit/pg-wrapper/compare/v2.4.1...v2.5.0
34 changes: 21 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@ This package has two parts and purposes
While the converter part can be used separately e.g. with [PDO](https://www.php.net/manual/en/book.pdo.php),
features like transparent conversion of query results work only with the wrapper.

## Installation

Require the package with composer:
```
composer require sad_spirit/pg_wrapper
```
pg_wrapper requires at least PHP 7.2. Native [pgsql extension](https://php.net/manual/en/book.pgsql.php)
should be enabled to use classes that access the DB (the extension is not a hard requirement).

Minimum supported PostgreSQL version is 9.3

It is highly recommended to use [PSR-6 compatible](https://www.php-fig.org/psr/psr-6/) metadata cache in production
to prevent possible metadata lookups from database on each page request.

## Why type conversion?

PostgreSQL supports a large (and extensible) set of complex database types: arrays, ranges, geometric and date/time
Expand Down Expand Up @@ -119,15 +133,19 @@ SELECT * FROM stuff WHERE id IN (?)
```
where `?` actually represents a variable number of parameters.

On the one hand, Postgres has native array types and this can be easily achieved with the following query
On the one hand, if you don't need the abstraction, then Postgres has native array types,
and this can be easily achieved with the following query
```SQL
-- in case of using PDO just replace $1 with a PDO-compatible placeholder
SELECT * FROM stuff WHERE id = ANY($1::INTEGER[])
```
passing an array literal as its parameter value
```PHP
$factory = new DefaultTypeConverterFactory();
$arrayLiteral = $factory->getConverterForTypeSpecification('INTEGER[]')->output([1, 2, 3]);
use sad_spirit\pg_wrapper\converters\DefaultTypeConverterFactory;

$arrayLiteral = (new DefaultTypeConverterFactory())
->getConverterForTypeSpecification('INTEGER[]')
->output([1, 2, 3]);
```

On the other hand, Doctrine DBAL [has its own solution for parameter lists](https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/data-retrieval-and-manipulation.html#list-of-parameters-conversion)
Expand All @@ -152,13 +170,3 @@ Working with PostgreSQL:
* [Executing a query](https://github.com/sad-spirit/pg-wrapper/wiki/query)
* [Working with a query result](https://github.com/sad-spirit/pg-wrapper/wiki/result)
* [Transactions handling](https://github.com/sad-spirit/pg-wrapper/wiki/transactions)


## Requirements

pg_wrapper requires at least PHP 7.2. [pgsql extension](https://php.net/manual/en/book.pgsql.php) should be enabled to use classes that actually work with the DB.

Minimum supported PostgreSQL version is 9.3

It is highly recommended to use metadata cache in production to prevent possible metadata lookups from database on each
page request.

0 comments on commit 332965d

Please sign in to comment.