位置: 编程技术 - 正文

PHP:pg_prepare()的用法_PostgreSQL函数

编辑:rootadmin
pg_prepare

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

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

(PHP 5 >= 5.1.0)

pg_prepare — Submits a request to create a prepared statement with the given parameters, and waits for completion.

说明 resource pg_prepare ([ resource $connection ], string $stmtname , string $query )

pg_prepare() creates a prepared statement for later execution with pg_execute() or pg_send_execute(). This feature allows commands that will be used repeatedly to be parsed and planned just once, rather than each time they are executed. pg_prepare() is supported only against PostgreSQL 7.4 or higher connections; it will fail when using earlier versions.

The function creates a prepared statement named stmtname from the query string, which must contain a single SQL command. stmtname may be "" to create an unnamed statement, in which case any pre-existing unnamed statement is automatically replaced; otherwise it is an error if the statement name is already defined in the current session. If any parameters are used, they are referred to in the query as $1, $2, etc.

Prepared statements for use with pg_prepare() can also be created by executing SQL PREPARE statements. (But pg_prepare() is more flexible since it does not require parameter types to be pre-specified.) Also, although there is no PHP function for deleting a prepared statement, the SQL DEALLOCATE statement can be used for that purpose.

参数

connection PHP:pg_prepare()的用法_PostgreSQL函数

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().

stmtname

The 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.

query

The 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.

返回值

A query result resource on success 或者在失败时返回 FALSE.

范例

Example #1 Using pg_prepare()

<?php//Connecttoadatabasenamed"mary"$dbconn=pg_connect("dbname=mary");//Prepareaqueryforexecution$result=pg_prepare($dbconn,"my_query",'SELECT*FROMshopsWHEREname=$1');//Executethepreparedquery.Notethatitisnotnecessarytoescape//thestring"Joe'sWidgets"inanyway$result=pg_execute($dbconn,"my_query",array("Joe'sWidgets"));//Executethesamepreparedquery,thistimewithadifferentparameter$result=pg_execute($dbconn,"my_query",array("ClothesClothesClothes"));?>

参见

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).

PHP:pg_port()的用法_PostgreSQL函数 pg_port(PHP4,PHP5)pg_port返回该连接的端口号说明intpg_port(resource$connection)pg_port()返回给定的PostgreSQLconnection资源所连接的端口号。

PHP:pg_pconnect()的用法_PostgreSQL函数 pg_pconnect(PHP4,PHP5)pg_pconnect打开一个持久的PostgreSQL连接说明resourcepg_pconnect(string$connection_string[,int$connect_type])pg_pconnect()打开一个到PostgreSQL数据库的持久连

PHP:pg_ping()的用法_PostgreSQL函数 pg_ping(PHP4=4.3.0,PHP5)pg_pingPing数据库连接说明boolpg_ping(resource$connection)pg_ping()ping数据库连接,如果中断则尝试重新连接。如果连接在活动状态返回TRUE,否

标签: PHP:pg_prepare()的用法_PostgreSQL函数

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

上一篇:PHP:pg_put_line()的用法_PostgreSQL函数("php")

下一篇:PHP:pg_port()的用法_PostgreSQL函数(php poll)

  • 缴纳上一年所得税附件是哪些科目
  • 税收缴款书现在还有吗
  • 待摊费用和无形资产摊销
  • 小规模纳税人申报时间
  • 出口退税转内销会计分录
  • 农产品进项抵扣政策
  • 如何计算个别资金成本?
  • 购买的固定资产什么时候折旧
  • 一次性伤残就业赔偿标准
  • 存货盘亏的分录怎么写
  • 租房的装修费怎么入账
  • 预交了一个季度的社保
  • 单位购买食品饮料的进项税可以抵扣吗?
  • 利润表中企业所得税
  • 自然人股权转让涉税信息怎么填
  • 企业为职工社保补缴怎么办理
  • 协会核定的税种都有哪些?
  • 简易计税的收入怎么做账
  • 民间非营利组织有哪些
  • 危险废物处理原则
  • 资产负债表是累计记账吗
  • 长期股权投资的初始计量
  • 税务申报系统叫什么
  • 美元兑人民币分时走势图
  • 建账时选择什么会计制度
  • 债务利率的公式
  • 收入税金账务处理
  • 公司增资的方式有什么
  • 合伙企业生产经营所得
  • 无法启用网络发展
  • pnp.npn
  • 开发产品完工结转
  • chart.js教程
  • 税务自查补税后还有风险吗
  • code particle
  • vue 组件调用
  • python导入其他文件的函数
  • 孪生神经网络 计算相似度
  • php时间代码
  • 命令start
  • 多缴纳的社保怎么查询
  • 应付利息怎么计算
  • vue this.$ref
  • mongodb重置密码
  • 本月发料凭证会计分录
  • 本年利润和利润分配属于什么账户
  • 企业捐赠自产产品的所得税处理
  • 所有者权益是怎么排列的
  • t3怎么查资产负债表
  • 累计摊销的会计分录有哪些
  • 已提足折旧固定资产
  • 残保金是应交税费吗
  • 餐饮行业购入农产品
  • 医院药品进销差价会计核算
  • 可以抵扣土地增值税的项目
  • 采购材料未付款填什么凭证
  • 公司注销开户许可证是不是要上交
  • 财务报表中预收账款
  • 油费可以进项抵税吗
  • 外汇申报材料
  • 建筑业营改增后,人工费不存在可抵扣
  • sql需要哪些基础
  • windows xp简单操作教程
  • Ubuntu14.04 的 SSH 无密码登录的设置方法
  • Linux系统中sort排序命令的使用教程
  • 备份linux命令
  • win7系统ie8浏览器
  • PHP 7.0.0 Alpha 2 发布
  • win10如何更换
  • windows 10预览版
  • shell 多个文件合并
  • js实现计时器在线时间
  • 利用jQuery及AJAX技术定时更新GridView的某一列数据
  • android 分辨率适配
  • 税控盘连接服务器失败是什么原因黑盘发票无法上传
  • 运输公司抵扣
  • 东营市税务局领导分工
  • 如何打印个人所得税证明
  • 在医院如何开报告单
  • 所有企业都要做应急预案吗
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设