一覧へ戻る
swoole/ext-postgresql(新しいタブで開きます)
主要言語: C++
🐘 Coroutine-based client for PostgreSQL
- star 数
- 66
- watcher 数
- 8
- fork 数
- 20
- issue 数
- 13
- 最終更新
- 2022/09/28
主要言語: C++
🐘 Coroutine-based client for PostgreSQL
ext-postgresql is the Swoole Postgres Client library can be used with in the coroutine context without blocking.
libpq is requiredswoole version >= 4.4.0git clone git@github.com:swoole/ext-postgresql.git
phpize
./configure
make && make installEnable swoole_postgresql in php.ini by adding the following line:
extension=swoole_postgresql.so
<?php Co\run(function () { $db = new Swoole\Coroutine\PostgreSQL(); $db->connect("host=127.0.0.1 port=5432 dbname=test user=root password=password"); $db->prepare('fortunes', 'SELECT id, message FROM Fortune'); $res = $db->execute('fortunes', []); $arr = $db->fetchAll($res); var_dump($arr); $db->prepare('select_query', 'SELECT id, randomnumber FROM World WHERE id = $1'); $res = $db->execute('select_query', [123]); $ret = $db->fetchAll($res); var_dump($ret); });
You can find more examples in the /examples folder.