位置: 编程技术 - 正文
推荐整理分享PHP:pg_send_prepare()的用法_PostgreSQL函数,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 5 >= 5.1.0)
pg_send_prepare — Sends a request to create a prepared statement with the given parameters, without waiting for completion.
说明 bool pg_send_prepare ( resource $connection , string $stmtname , string $query )Sends a request to create a prepared statement with the given parameters, without waiting for completion.
This is an asynchronous version of pg_prepare(): it returns TRUE if it was able to dispatch the request, and FALSE if not. After a successful call, call pg_get_result() to determine whether the server successfully created the prepared statement. The functions parameters are handled identically to pg_prepare(). Like pg_prepare(), it will not work on pre-7.4 versions of PostgreSQL.
参数connection
PostgreSQL database connection resource. When connection is not present, the default connection is used. The default connection is the last connection made by pg_connect() or pg_pconnect().
stmtnameThe name to give the prepared statement. Must be unique per-connection. If "" is specified, then an unnamed statement is created, overwriting any previously defined unnamed statement.
queryThe parameterized SQL statement. Must contain only a single statement. (multiple statements separated by semi-colons are not allowed.) If any parameters are used, they are referred to as $1, $2, etc.
返回值Returns TRUE on success, FALSE on failure. Use pg_get_result() to determine the query result.
范例
Example #1 Using pg_send_prepare()
<?php$dbconn=pg_connect("dbname=publisher")ordie("Couldnotconnect");//Prepareaqueryforexecutionif(!pg_connection_busy($dbconn)){pg_send_prepare($dbconn,"my_query",'SELECT*FROMshopsWHEREname=$1');$res1=pg_get_result($dbconn);}//Executethepreparedquery.Notethatitisnotnecessarytoescape//thestring"Joe'sWidgets"inanywayif(!pg_connection_busy($dbconn)){pg_send_execute($dbconn,"my_query",array("Joe'sWidgets"));$res2=pg_get_result($dbconn);}//Executethesamepreparedquery,thistimewithadifferentparameterif(!pg_connection_busy($dbconn)){pg_send_execute($dbconn,"my_query",array("ClothesClothesClothes"));$res3=pg_get_result($dbconn);}?> 参见pg_connect() - 打开一个 PostgreSQL 连接 pg_pconnect() - 打开一个持久的 PostgreSQL 连接 pg_execute() - Sends a request to execute a prepared statement with given parameters, and waits for the result. pg_send_execute() - Sends a request to execute a prepared statement with given parameters, without waiting for the result(s). pg_send_query_params() - Submits a command and separate parameters to the server without waiting for the result(s).
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$
PHP:pg_select()的用法_PostgreSQL函数 pg_select(PHP4=4.3.0,PHP5)pg_select选择记录说明mixedpg_select(resource$connection,string$table_name,array$assoc_array[,int$options=PGSQL_DML_EXEC])pg_select()根据assoc_array数组中的field=v
PHP:pg_result_status()的用法_PostgreSQL函数 pg_result_status(PHP4=4.2.0,PHP5)pg_result_status获得查询结果的状态说明intpg_result_status(resource$result)pg_result_status()返回该查询结果资源的状态。可能的返回值有PGSQ
标签: PHP:pg_send_prepare()的用法_PostgreSQL函数
本文链接地址:https://www.jiuchutong.com/biancheng/281447.html 转载请保留说明!上一篇:PHP:pg_send_query_params()的用法_PostgreSQL函数
下一篇:PHP:pg_send_execute()的用法_PostgreSQL函数
友情链接: 武汉网站建设