位置: 编程技术 - 正文

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)

  • 餐饮发票不是增值发票吗
  • 商品房价格居高不下的原因
  • 非居民纳税人是小规模纳税人
  • 非居民个人如何认定
  • 出售技术所有权的会计分录
  • 2020年小规模纳税人增值税起征点
  • 个人所得税扣缴申报表
  • 申报增值税无附表怎么填写
  • 购进农产品取得专用发票
  • 转让房产的单位和个人都需要缴纳契税吗?
  • 电子承兑没到期如何贴现
  • 产权转移书据印花税计入什么科目
  • 旧设备变现损失抵减所得税怎么算
  • 建筑工程属于开票项目吗
  • 绿化工程上税多少
  • 小规模纳税人是小微企业吗
  • 员工社保异地缴纳
  • 电子普通发票入账规则
  • 报关单出口退税联模板
  • 一般纳税人选择简易计税进项税可以抵扣吗
  • 偷税罪立案标准最新
  • 个人所得税申报错误如何更正申报
  • 税控盘怎么使用
  • 季初是什么意思
  • 赠送的商品怎么入账
  • 简易计税开票开成了一般计税的税率会比对不通过吗
  • 无形资产有哪些摊销方法
  • 跨年退税怎么处理
  • kb5000908打印问题
  • php加号
  • php字符串函数大全
  • 小规模企业有收入吗
  • 购买农产品没有承担增值税为什么还要计算抵扣
  • php静态页面生成
  • php tr td
  • 网上打印企业征信报告
  • yarn安装路径
  • php 文件系统
  • uname命令详解
  • php面试题目100及最佳答案
  • 小规模纳税人征收方式
  • js方案
  • mongodb cond
  • mongodb快速入门
  • 待处理财产损益期末余额在哪方
  • 离职员工个税申诉企业怎么处理
  • 年报中的资产总额怎么计算
  • 企业重组后的债权怎么处理
  • 收到股东的投资款现金流量表
  • 补助是工资以外的吗
  • 制造费用的明细账应当按照什么设置
  • 事业单位对外投资
  • 开具发票的单位名称与实际收款不一致?
  • 本年利润到年末还有余额吗
  • 电信收据模板
  • 银行存款利息的结算方式
  • 等额本金还款计算公式
  • 开票信息中电话怎么填
  • 深入浅出了解啥意思
  • win8系统怎么重置
  • windows10 硬件
  • 在Vista、Windows7下玩英雄无敌3绿色版
  • 简述操作系统更新设置方法
  • win8.1进不了系统
  • win8激活windows
  • win8怎样恢复系统
  • linux如何用
  • win7系统添加右键菜单在哪里设置
  • win8.1怎么关闭防火墙
  • win8怎么设置桌面图标
  • 一系列优秀的Android开发资料
  • 批处理常用命令总结
  • bat修改注册表数值
  • unity 2d 3d混合
  • 发布python程序
  • 领导班子和领导干部年度考核
  • 曲靖市税务局领导班子
  • 宁波税务总局官网
  • 江西省企业社会保险费缴费指南
  • 养老机构范畴
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设