位置: 编程技术 - 正文

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)

  • 土地增值税的扣除项目包括哪几项
  • 施工单位缴税实例
  • 工会经费的应税项是什么
  • 符合简易征收的条件
  • 没有参加会计继续教育会怎样
  • 税金及附加和应交税费的关系
  • 免交城建税的会计分录
  • 用友t3普及版价格
  • etc预付发票可以抵税吗
  • 一般纳税人每个月几号报税
  • 其他应收款是否要收利息
  • 营改增举例说明
  • 离职未收回货款要我承担
  • 亏损企业研发费加计扣除可以递延吗
  • 购买办公楼支付相关手续费
  • 结转周转材料成本差异会计分录
  • 购买座机计入哪个科目?
  • 只有增值税进项怎么抵扣
  • 获赠或继承来的房屋以后再转让
  • 固定资产可以一次性计入成本费用吗
  • 发票数量能开0.0几吗
  • 跨年度主营业务收入错账调整
  • 未分配利润清算如何处理
  • 发放福利视同销售进项税要转出吗?
  • 长期闲置的机器叫什么
  • 预付账款可以为负吗
  • win11任务栏全部显示
  • qqbak文件怎么打开
  • 房地产企业将开什么发票
  • 微软的机会
  • 金融工具减值会影响什么
  • call for conference paper
  • php多图片上传到数据库
  • 工会经费是如何计提的
  • 基于个人同意处理个人信息的个人什么撤回其同意
  • torch测定
  • lvm命令详解
  • 财政拨款结转的二级科目有哪些
  • 利息收入包括
  • 公司账户转私账违法吗
  • 一般纳税人都是按月申报吗
  • dedecms安装及配置
  • 织梦相关文章调用
  • 企业所得税成本核定
  • 核定征收可以不用申报吗
  • Mysql存储过程中的如何遍历一个查询结果集
  • 存货的期末余额是账面余额吗
  • 别人公司过账用自己的银行卡会查吗
  • 银行汇票背书
  • 其他综合收益的概念
  • 物流货损怎样处理
  • 公司缴纳残保金查询怎么查
  • 企业申报纳税都交什么税
  • 当月购进原材料取得税控专用发票
  • 先开发票钱后进怎样做帐?
  • 补缴的增值税可以抵扣吗
  • 固定资产包括哪些东西
  • 工业企业应通过其他应付款科目核算的有
  • 微软软件安装
  • dcs是什么文件
  • 在windows中如何设置行间距
  • win7系统开启无线服务
  • 定制xp系统
  • linux内核和根文件系统的关系
  • executor进程
  • win7怎么查看电池信息
  • ExtJS TabPanel beforeremove beforeclose使用说明
  • jquery操作
  • unity资源包怎么用
  • Intent and Intent Filters
  • shell定时删除指定目录下的文件夹
  • python操作db2数据库
  • Python的二维列表存储
  • 绿化项目利润
  • 国家税务网上办税
  • 国家税务总局查发票
  • 上海市国家税务局官网网站
  • 浙江省个体工商户税收政策
  • 黄金消费税如何征收
  • 一般纳税人申请流程
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设