位置: 编程技术 - 正文

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)

  • 一般纳税人资格证明
  • 税务安全组件初审流程
  • 递延所得税费用在资产负债表哪一项
  • 税收契子怎么算
  • 申报社保不报个人账户
  • 工商股权转让费用怎么算
  • 收到发票冲红怎么做分录
  • 公司出售旧汽车要交什么税
  • 工程项目估算收入要缴税吗
  • 赠送客户的产品计入销售费用的二级科目
  • 工商银行特色贷款
  • 物业公司是小规模纳税人税率是多少
  • 买一手房需要交哪些税费
  • 公司贷款买车是公司还款吗
  • 超市预付款应做在哪个会计科目?
  • 公司成立初期费用入账
  • 采购发票几个点的税
  • 增值税不征税收入的三个条件
  • 车船税不开票吗?
  • 购买商品成本要支付哪些成本
  • 工程未结算能主张工程款吗
  • 注册资本与利息的税前扣除
  • 存货抵偿债务账务处理
  • 捐赠计提管理费的账务处理?
  • 出口退免税的基本政策包括
  • ubuntu系统u盘安装
  • windows update更新错误
  • linux系统备份整个硬盘的命令
  • 如何计算经营性负债
  • PHP:class_parents()的用法_spl函数
  • csinsmnt.exe进程的作用介绍 csinsmnt是什么进程
  • php播放本地音乐
  • 利息费用可扣除什么
  • 蒙特勒和日内瓦的关系
  • php 随机数
  • 部署文档
  • vue-router
  • php操作mysql数据库的扩展有哪三个
  • 前端 自动化脚本 怎么写
  • cssschool
  • php查询数据是否存在
  • php和python结合
  • 没有什么盈利的公司应该进吗
  • 企业商业负债包括哪些
  • 预计负债初始计量的最佳估计数的确定是会计估计变更吗
  • 通用发票如何缴销
  • 没有原始凭证可以记账吗
  • 费用支出要求
  • 核定征收和查账征收报税有区别吗
  • 报销电话费计入什么科目
  • 未分配利润是不是净利润的意思
  • 出口退税没有及时申报
  • 现金日记账要如何做账
  • 委外加工半成品入库的会计分录
  • 专票和普票的区别税点差多少
  • 案例分析以前年龄的变化
  • mysql指定查询
  • xp系统怎么取消开机登录界面
  • mac远程桌面mac
  • win8触摸板失灵怎么办
  • 安全账户管理器或本地安全机构服务器
  • windows局域网共享文件用的什么协议
  • windows自动启动设置
  • windows打开
  • 升级win10系统后安装谷歌打不开
  • opengl 旋转矩阵
  • 超大安卓游戏
  • 批处理文件是脚本吗
  • OpenGL图元管理
  • javascript代码写在哪个标签里
  • bat批处理if命令
  • bootstrap要学吗
  • javascript高级程序设计电子版
  • 安卓 截图
  • [置顶]bilinovel
  • 引用jquery后没反应
  • 江苏税务个人所得税app下载
  • 上海市税务局发票怎么开
  • 杭州国税电话
  • 房地产契税2023年最新政策
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设