Coroutine\PostgreSQL->prepare
最后更新于:2022-04-02 06:29:36
# Coroutine\\PostgreSQL->prepare
预处理
~~~
function Coroutine\PostgreSQL->prepare( string $name, string $sql);
function Coroutine\PostgreSQL->execute ( string $name, array $bind);
~~~
example:
~~~
go(function () {
$pg = new Swoole\Coroutine\PostgreSQL();
$conn = $pg -> connect ("host=127.0.0.1 port=5432 dbname=test user=wuzhenyu password=112");
$pg -> prepare("my_query","select * from test where id > $1 and id < $2");
$res = $pg->execute("my_query", array(1,3));
$arr = $pg -> fetchAll($res);
var_dump($arr);
});
~~~
';