[ANNOUNCE] Introducing pg_builder and pg_wrapper packages for PHP

Поиск
Список
Период
Сортировка
От Alexey Borzov
Тема [ANNOUNCE] Introducing pg_builder and pg_wrapper packages for PHP
Дата
Msg-id 00713789-05fa-eb58-c456-d3f069a6f0e1@cs.msu.su
обсуждение исходный текст
Список pgsql-announce
I'm pleased to announce a new version of pg_builder, updated to support new 
syntax features of upcoming Postgres 10. Its sister package pg_wrapper is 
updated as well.

What's more important, both packages now have user documentation.


pg_builder version 0.2.1
---------------------------

pg_builder is a query builder for Postgres backed by a partial PHP 
reimplementation of PostgreSQL's own query parser. Current version supports all 
syntax available for SELECT (and VALUES), INSERT, UPDATE, and DELETE queries in 
Postgres 10 with minor omissions.

* Query is represented by an Abstract Syntax Tree consisting of Nodes. This is 
quite similar to what Postgres does internally.
* Query parts (e.g. new columns for a SELECT or parts of a WHERE clause) can 
usually be added to the AST either as Nodes or as strings. Strings are processed 
by parser, so query being built is automatically checked for correct syntax.
* Nodes can be removed and replaced in AST (e.g. calling join() method of a node 
in FROM clause replaces it with a JoinExpression node having the original node 
as its argument).
* AST can be analyzed and transformed, the package takes advantage of this to 
allow named parameters like :foo instead of standard PostgreSQL's positional 
parameters $1 and to infer parameters' types from SQL typecasts.

pg_builder can be used on its own, but using it together with pg_wrapper allows 
to run the built queries and to leverage transparent conversion of query 
parameters to Postgres types.

Requirements
---------------

PHP 5.3+

Links
--------

Source: https://github.com/sad-spirit/pg-builder
Documentation: https://github.com/sad-spirit/pg-builder/wiki

The package is installable with Composer
$ composer require sad_spirit/pg_builder




pg_wrapper version 0.2.2
---------------------------

pg_wrapper wraps around functions of PHP's pgsql extension and provides 
transparent conversion of database types to their PHP equivalents

Postgres types supported * Numeric types, character types, boolean, bytea * Date and time types, intervals * Arrays of
anybase type * Ranges of any base type * Composite types * json / jsonb * Geometric types * hstore (from
contrib/hstore)

For those types where a corresponding native PHP type or class is available it 
is used (text -> string, timestamp -> DateTime, interval -> DateInterval, hstore 
-> associative array, etc.). For other types (geometric types, ranges) the 
package provides custom classes.

Conversion of query result fields is done automatically using database metadata, 
query parameters may require specifying type:

$connection->executeParams(    'select typname from pg_catalog.pg_type where oid = any($1) order by typname',    [[21,
23,25]],    ['integer[]']
 
);

Requirements
---------------

PHP 5.3+ with pgsql extension.


Links
--------

Source: https://github.com/sad-spirit/pg-wrapper
Documentation: https://github.com/sad-spirit/pg-wrapper/wiki

The package is installable with Composer
$ composer require sad_spirit/pg_wrapper





-- 
Sent via pgsql-announce mailing list (pgsql-announce@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-announce

В списке pgsql-announce по дате отправления:

Предыдущее
От: David Fetter
Дата:
Сообщение: [ANNOUNCE] == PostgreSQL Weekly News - September 17 2017 ==
Следующее
От: Stephen Frost
Дата:
Сообщение: [ANNOUNCE] PostgreSQL v10 RC 1 Released!