位置: 编程技术 - 正文

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)

  • 企业所得税税款可以税前扣除吗
  • 已发货没开票分录
  • 企业所得税优惠政策最新2023小规模纳税人
  • 买的矿泉水可以烧开吗
  • 集体不动产和动产包括
  • 交通补贴算工资收入吗
  • 申报增值税无附表怎么填写
  • 小规模季度不超过30万元免税会计分录
  • 免税农产品包括烟叶吗
  • 小规模不报税会怎么样
  • 出口企业免抵税额要作进项转出吗
  • 无偿赠送货物怎么做账
  • 离退休人员的返乡政策
  • 应收账款计提坏账比例
  • 企业所得税怎么征收几个点
  • 收到借款是承兑付款吗
  • 有哪些方法可以判断乳剂的类型
  • 归还法人前期垫付款项
  • 工程业务提成协议合法吗
  • 融资租入固定资产改建支出计入
  • 如何免费获取网页文字
  • 普通发票多久之后还可以红冲
  • 公司一般账户不用了会怎么样
  • 进销存功能
  • win10下载软件被阻止安装怎么办
  • php string
  • php获取ftp文件目录
  • 应交增值税视频讲解
  • 员工宿舍的物业费要交个税吗
  • 应付账款讲解
  • 跨年度坏账准备转回账务处理
  • echarts引入地图
  • 如何确定合伙企业的利润
  • 生产成本二级科目会计分录
  • vue项目创建流程
  • php找零
  • php十进制转二进制算法
  • ghostnet改进
  • axure rp 9视频教程
  • audit.exe
  • 长期待摊费用属于调整账户吗
  • 缴纳印花税需要带公章吗
  • mysql集群三种方式
  • 织梦官网倒闭了吗
  • 公司股东和自然人的关系
  • mysql存储过程语句
  • 施工企业期间费用 企业管理费会计分录
  • 专项附加可以随便填吗
  • 费用月结怎么记账
  • 库存商品转成本意味着什么
  • 小规模企业所得税怎么征收
  • 罚款支出算费用吗
  • 工资挂账怎样做账
  • 关联的公司
  • 公司为小规模纳税人
  • 房地产企业收到政府补助
  • 总公司可以开发票给分公司吗
  • java程序怎么直接运行
  • 编写高质量代码改善JAVA程序的151个建议
  • mac中mysql应该怎么运行
  • XP系统无法安装软件
  • 如何重设路由器密码怎么办
  • fedora使用
  • pull current
  • 安装双系统后无法进入原来的系统
  • 磁盘空间不足怎么弄
  • Win10 Mobile RS1预览版14267.1004升级过程截图
  • js里的this指向
  • python生成器详解
  • dos批命令
  • CSSvista可同时在IE和Fifrefox调试的CSS编辑提供下载
  • js复制对象的方法有哪几种
  • 容易混淆的词汇
  • android数据存储总结
  • 辽宁省社保系统操作
  • 湖北税票真伪查询
  • 宿州税务总局
  • 发票在地税能查到,但是国税查不到
  • 美丽重生李晓晓免费阅读
  • 对外销售产品
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设