1
0
mirror of https://github.com/danog/postgres.git synced 2024-11-26 12:04:50 +01:00
Go to file
2018-07-01 12:40:23 -05:00
examples Use common SQL interface library 2018-07-01 12:33:12 -05:00
src Fix Transaction; Fix tests; Remove extension repo directories after install on travis 2018-07-01 12:40:23 -05:00
test Fix Transaction; Fix tests; Remove extension repo directories after install on travis 2018-07-01 12:40:23 -05:00
travis Fix Transaction; Fix tests; Remove extension repo directories after install on travis 2018-07-01 12:40:23 -05:00
.gitattributes Update export-ignore files 2017-11-22 20:35:23 -06:00
.gitignore Use code fixer 2017-05-15 23:27:47 -05:00
.php_cs Use common SQL interface library 2018-07-01 12:33:12 -05:00
.travis.yml Use common SQL interface library 2018-07-01 12:33:12 -05:00
composer.json Use common SQL interface library 2018-07-01 12:33:12 -05:00
LICENSE Initial commit 2016-09-14 09:27:39 -05:00
phpdoc.dist.xml Initial commit 2016-09-14 09:27:39 -05:00
phpunit.xml.dist lib → src 2018-03-26 23:02:35 -05:00
README.md Error if pecl-ev is used with ext-pgsql 2018-02-28 19:00:24 -06:00

postgres

Build Status Code Coverage Release License

Async PostgreSQL client built with Amp.

Installation

This package can be installed as a Composer dependency.

composer require amphp/postgres

Requirements

Note: pecl-ev is not compatible with ext-pgsql. If you wish to use pecl-ev for the event loop backend, you must use pecl-pq.

Documentation & Examples

Prepared statements and parameterized queries support named placeholders, as well as ? and standard numeric (i.e. $1) placeholders.

More examples can be found in the examples directory.

Amp\Loop::run(function () {
    /** @var \Amp\Postgres\Pool $pool */
    $pool = Amp\Postgres\pool("host=localhost user=postgres dbname=test");

    /** @var \Amp\Postgres\Statement $statement */
    $statement = yield $pool->prepare("SELECT * FROM test WHERE id = :id");

    /** @var \Amp\Postgres\ResultSet $result */
    $result = yield $statement->execute(['id' => 1337]);
    while (yield $result->advance()) {
        $row = $result->getCurrent();
        // $row is an array (map) of column values. e.g.: $row['column_name']
    }
});

Versioning

amphp/postgres follows the semver semantic versioning specification like all other amphp packages.

Security

If you discover any security related issues, please email contact@amphp.org instead of using the issue tracker.

License

The MIT License (MIT). Please see LICENSE for more information.