位置: 编程技术 - 正文

PHP:pg_send_query()的用法_PostgreSQL函数

编辑:rootadmin
pg_send_query

推荐整理分享PHP:pg_send_query()的用法_PostgreSQL函数,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 4 >= 4.2.0, PHP 5)

pg_send_query — 发送异步查询

说明 bool pg_send_query ( resource $connection , string $query ) bool pg_send_query ( string $query )

pg_send_query() 向 connection 连接发送异步查询。和 pg_query() 不同,它可以向 PostgreSQL 发送多个查询并用 pg_get_result() 依次得到结果。当执行查询时脚本的执行不会被锁定。用 pg_connection_busy() 来检查连接连接是否为忙(即查询正在执行中)。调用 pg_cancel_query() 则有可能取消查询。

PHP:pg_send_query()的用法_PostgreSQL函数

尽管用户可以一次发送多个查询,但用户不能通过正忙的连接发送多个查询。如果向正忙的连接发送了查询,则会等待上一条查询结束并丢弃所有结果。

Example #1 异步查询

<?php$dbconn=pg_connect("dbname=publisher")ordie("Couldnotconnect");if(!pg_connection_busy($dbconn)){pg_send_query($dbconn,"select*fromauthors;selectcount(*)fromauthors;");}$res1=pg_get_result($dbconn);echo"Firstcalltopg_get_result():$res1n";$rows1=pg_num_rows($res1);echo"$res1has$rows1recordsnn";$res2=pg_get_result($dbconn);echo"secondcalltopg_get_result():$res2n";$rows2=pg_num_rows($res2);echo"$res2has$rows2recordsn";?>

上例输出如下:

参见 pg_query(),pg_cancel_query(),pg_get_result() 和 pg_connection_busy()。

PHP:pg_send_query_params()的用法_PostgreSQL函数 pg_send_query_params(PHP5=5.1.0)pg_send_query_paramsSubmitsacommandandseparateparameterstotheserverwithoutwaitingfortheresult(s).说明boolpg_send_query_params(resource$connection,string$query,array$p

PHP:pg_send_prepare()的用法_PostgreSQL函数 pg_send_prepare(PHP5=5.1.0)pg_send_prepareSendsarequesttocreateapreparedstatementwiththegivenparameters,withoutwaitingforcompletion.说明boolpg_send_prepare(resource$connection,string$stmtname,string

PHP:pg_send_execute()的用法_PostgreSQL函数 pg_send_execute(PHP5=5.1.0)pg_send_executeSendsarequesttoexecuteapreparedstatementwithgivenparameters,withoutwaitingfortheresult(s).说明boolpg_send_execute(resource$connection,string$stmtname,array$

本文链接地址:https://www.jiuchutong.com/biancheng/281445.html 转载请保留说明!

上一篇:PHP:pg_set_client_encoding()的用法_PostgreSQL函数

下一篇:PHP:pg_send_query_params()的用法_PostgreSQL函数

免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

鄂ICP备2023003026号

网站地图: 企业信息 工商信息 财税知识 网络常识 编程技术

友情链接: 武汉网站建设 电脑维修 湖南楚通运网络