位置: 编程技术 - 正文

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)

  • 增值税留抵税务处理办法
  • 工资社保缴纳计算器
  • 库存商品在贷方怎么调整
  • 劳务派遣的开票规范
  • 个税app显示退税已完成,怎么没收到钱呢???
  • 社保基数变更上限怎么办
  • 融资租赁和经营性租赁区别
  • 办公室空调维修报告
  • 房屋租赁个人所得税缴纳标准是多少
  • 供应商发出货物,将发货单提交给
  • 增值税普通发票需要交税吗
  • 单品毛利计算公式怎么算
  • 未认证的进项税账务处理
  • 实收资本不到账如何做凭证
  • 施工企业确认收入的方法有哪两种
  • 公司贷款直接打供应商账户还需要发票吗
  • 外币报表折算差额在会计报表中应作为
  • 新三板公司股东人数
  • 个人汽车租给公司租金需多少钱?
  • 企业所得税看哪里
  • 收到银行承兑汇票计入什么科目
  • 固定成本与变动成本的区别
  • 同一控制下企业合并商誉
  • 加计抵减是什么时候开始的
  • 发票认证的三种方式
  • 实物捐赠怎么避免多缴企业所得税?
  • 设置戴尔笔记本锁屏时间
  • deepin切换系统
  • 银行承兑汇票背书会计分录
  • 固定资产减值准备影响折旧吗
  • 进项大于销项会计分录
  • 包装物押金收入含税吗
  • 支付人工费会计科目
  • 调整系统保留带宽的命令
  • 建筑业开具发票
  • 存货出租的会计分录
  • 所得税和应交所得税
  • thinkphp curl
  • vue3 element-plus
  • 【小沐学C++】C++ MFC中嵌入web网页控件(WebBrowser、WebView2、CEF3)
  • 随机梯度下降算法优缺点
  • php读取xml接口数据
  • cpu spread spectrum
  • 民间非盈利组织会计要素组成
  • 什么是企业的应付账款
  • java泛型的定义和使用
  • tempdb数据库能删么
  • 销售商品尚未发出会计分录
  • 增值税专用发票查询系统官方网站
  • 分公司员工在总公司缴纳社保
  • 行政事业单位资产报废账务处理
  • 异地房产税如何收
  • 费用发票可以不抵扣进项税吗
  • 房租已支付未收到发票可以做费用吗
  • 房地产开发企业土地增值税怎么计算
  • MySQL 5.6 (Win7 64位)下载、安装与配置图文教程
  • sql语句大全实例教程
  • vista电脑密码忘了怎么解除
  • centos安装ntfs 3g
  • calctool
  • 简介linux系统中的10个常用命令及功能
  • centos中netspeeder网络加速/优化器的安装方法
  • 英文xp系统中文语言包
  • win10系统怎样卸载程序
  • win7系统谷歌浏览器错误代码a00a0017
  • linux操作系统主要用来干嘛?
  • linux 11
  • css对象
  • javascript基础编程
  • 详解九章算法
  • node.js介绍
  • ssm vue
  • ssh执行远程命令 参数
  • shell中setenv
  • 基于python语言
  • django forms.py
  • jquery 表格插件
  • android 打包
  • 工会经费征收范围规定
  • 一般纳税人附加税减半征收政策
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设