位置: 编程技术 - 正文

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)

  • 增值税普通发票几个点
  • 增值税留抵抵欠情况说明怎么写
  • 一般纳税人开普票税率是多少
  • 浙江注册税务师考试时间
  • 以前年度无形资产本年摊销额
  • 金税盘税务申报
  • 开发支出在资产负债表是怎
  • 哪些进项税额可以转出
  • 系统服务的重要地点在哪里
  • 火车票进项抵扣怎么勾选
  • 资产负债表里是科目还是项目
  • 没开发票的收入可以不入账吗
  • 新政府会计准则2019
  • 营业执照注销还需要交钱吗
  • 工厂员工饭票制度
  • 长期股权投资顺流交易固定资产
  • 所有的固定资产都需要计提折旧吗
  • 微信交电费怎么退款
  • 物流分公司怎么运作
  • 印花税注册资本缴税时间
  • 租赁合同印花税计税依据含税吗
  • 文化事业建设费税收优惠政策2023
  • 电梯按几年摊销
  • 进项税和销项税月末怎么结转
  • 补提以前年度税费应该计入
  • 定额发票上除了发票章还有其他章吗
  • 管理费用没发票能入账吗
  • 企业房租收入如何申报
  • windows7的笔记本有哪些
  • Win10系统如何修改开机密码
  • 销售净利率的计算公式有哪些
  • 进项发票如何抵扣销项发票
  • 哪些进项税可以加计抵减
  • 苹果电脑连接打印机打印不出来
  • PHP:session_encode()的用法_Session函数
  • 稿酬特许权使用费的预扣率是多少
  • 会计人员报销差额是多少
  • 收到原材料投资怎么做账
  • 公司注销后所欠债怎么办
  • 发票刮出来的奖有兑奖时间
  • phpforeach
  • 邓弗里斯什么水平
  • 黄金海岸冲浪者沙滩
  • vue-plugin-hiprint vue hiprint vue使用hiprint打印控件VUE HiPrint HiPrint简单使用
  • vue3父子传值
  • 无需本地部署的软件
  • 全卷积网络fcn详解
  • 研发专利什么意思
  • 帝国cms功能
  • 医疗机构销售药品能否加价
  • 合伙企业的合伙人有下列情形中的当然退伙
  • 可以以公司名义贷款吗
  • 转让旧固定资产可以开专票吗
  • 房租费待摊分录怎么做
  • 出口收汇核销单的作用
  • 未开票收入转为开票收入
  • ppp项目政府可以不出资
  • 报销的发票抬头怎么填
  • 工程施工和工程造价哪个好
  • 库存商品销售后怎么做账
  • sql中函数 判断是否是null
  • ubuntu鼠标不能移动
  • linuxsleep函数
  • centos8安装rpm包
  • win7旗舰版开机
  • 如何在mac中安装windows
  • win7免费win10
  • 红石2代
  • android base64传图片
  • delect删除
  • jquery序列化json
  • npm yarn命令对比
  • flappy bird攻略
  • 熟练使用jquery
  • 浙江省发票勾选认证操作流程2021
  • 建筑企业外地施工预缴税款
  • 查册证明怎么自动生成
  • 关于新时代新征程
  • 安徽省建筑施工企业排名
  • 2016年营改增房屋租赁
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设