位置: 编程技术 - 正文

PHP:pg_query_params()的用法_PostgreSQL函数

编辑:rootadmin
pg_query_params

推荐整理分享PHP:pg_query_params()的用法_PostgreSQL函数,希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5 >= 5.1.0)

pg_query_params — Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.

说明 resource pg_query_params ([ resource $connection ], string $query , array $params )

Submits a command to the server and waits for the result, with the ability to pass parameters separately from the SQL command text.

pg_query_params() is like pg_query(), but offers additional functionality: parameter values can be specified separately from the command string proper. pg_query_params() is supported only against PostgreSQL 7.4 or higher connections; it will fail when using earlier versions.

If parameters are used, they are referred to in the query string as $1, $2, etc. The same parameter may appear more than once in the query; the same value will be used in that case. params specifies the actual values of the parameters. A NULL value in this array means the corresponding parameter is SQL NULL.

The primary advantage of pg_query_params() over pg_query() is that parameter values may be separated from the query string, thus avoiding the need for tedious and error-prone quoting and escaping. Unlike pg_query(), pg_query_params() allows at most one SQL command in the given string. (There can be semicolons in it, but not more than one nonempty command.)

参数

connection PHP:pg_query_params()的用法_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().

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.

User-supplied values should always be passed as parameters, not interpolated into the query string, where they form possible SQL injection attack vectors and introduce bugs when handling data containing quotes. If for some reason you cannot use a parameter, ensure that interpolated values are properly escaped.

params

An array of parameter values to substitute for the $1, $2, etc. placeholders in the original prepared query string. The number of elements in the array must match the number of placeholders.

Values intended for bytea fields are not supported as parameters. Use pg_escape_bytea() instead, or use the large object functions.

返回值

A query result resource on success 或者在失败时返回 FALSE.

范例

Example #1 Using pg_query_params()

<?php//Connecttoadatabasenamed"mary"$dbconn=pg_connect("dbname=mary");//FindallshopsnamedJoe'sWidgets.Notethatitisnotnecessaryto//escape"Joe'sWidgets"$result=pg_query_params($dbconn,'SELECT*FROMshopsWHEREname=$1',array("Joe'sWidgets"));//Compareagainstjustusingpg_query$str=pg_escape_string("Joe'sWidgets");$result=pg_query($dbconn,"SELECT*FROMshopsWHEREname='{$str}'");?>

参见

pg_query() - 执行查询

PHP:pg_put_line()的用法_PostgreSQL函数 pg_put_line(PHP4=4.0.3,PHP5)pg_put_line向PostgreSQL后端发送以NULL结尾的字符串说明boolpg_put_line([resource$connection],string$data)pg_put_line()向PostgreSQL后端服务器发送以NULL

PHP:pg_prepare()的用法_PostgreSQL函数 pg_prepare(PHP5=5.1.0)pg_prepareSubmitsarequesttocreateapreparedstatementwiththegivenparameters,andwaitsforcompletion.说明resourcepg_prepare([resource$connection],string$stmtname,string$query)pg_pre

PHP:pg_port()的用法_PostgreSQL函数 pg_port(PHP4,PHP5)pg_port返回该连接的端口号说明intpg_port(resource$connection)pg_port()返回给定的PostgreSQLconnection资源所连接的端口号。

标签: PHP:pg_query_params()的用法_PostgreSQL函数

本文链接地址:https://www.jiuchutong.com/biancheng/281455.html 转载请保留说明!

上一篇:PHP:pg_query()的用法_PostgreSQL函数

下一篇:PHP:pg_put_line()的用法_PostgreSQL函数("php")

  • 销售财务软件的公司怎么做账
  • 应交税费会计分录怎么做明细科目
  • 印花税会计分录怎么做
  • 小规模纳税人做账要做增值税吗
  • 个体工商户装修经营范围
  • 出售投资性房地产的会计处理
  • 公司注销时长期投资怎么处理
  • 建筑行业未收款先开发票如何做账?
  • 两个其他应收款的区别
  • 预付款发票未到如何入成本
  • 什么是差额增收
  • 延期付款利息是多少钱
  • 收到的财政补贴如何做账
  • 广告制作费有哪些项目
  • 税务局锁了开票系统票已领出还可以开出来吗
  • 建筑合同通用条款
  • 土地增值税按什么面积征收
  • 发票没有存根联怎么办
  • 建筑工程确认收入条件
  • 滞纳金由财务人员承担
  • 客户少付货款怎么做账
  • 工资薪金所得税率表2023
  • mac host is down
  • 电脑隐藏软件图标快捷键
  • 幼儿园资金收支管理财务制度
  • 损益类科目反映企业在一定期间内利润或亏损,可以分为
  • 预收款退回怎么写分录
  • win10专业版下载教程
  • php如何使用session
  • 个税这个月多交了下个月减回来
  • 绿萝 用什么土
  • 企业支付银行的贷款利息可以税前扣除吗为什么
  • php 生成缩略图
  • 商品削价要本着既能使企业什么又能使商品扩销的原则
  • 企业预付工程车租赁费
  • electron 打包
  • vue.js前端开发快速入门与专业应用
  • php生成验证码代码
  • 日落之前是什么时辰
  • 浅析论文题目
  • vuex iframe
  • sap abap入门
  • 医学图像处理的步骤一是设计
  • lincom命令
  • nodejs基础知识
  • 企业如何利用期货对冲风险怎么操作
  • 应交税费下的科目设置
  • 当月未付款算在次月吗
  • 涉税金额是指金额还是税额
  • 不需要开发票的现金收入怎么做内账?
  • 增值税专用发票和普通发票的区别
  • 申请专利的费用主要包括
  • 可以采用
  • 蔬菜批发成本怎么核算
  • 农村土地征用补偿价格
  • 预计负债转回对所得税费用的影响
  • 发票金额与付款金额不一致情况说明
  • 服装公司的会计怎么做账
  • 收到增值税专用发票会计科目
  • 无形资产的项目有哪些
  • 应收其他应收区别
  • 其他应收款待抵扣税金
  • 服务费的进项发票怎么做分录
  • 账面价值,账面净值,账面余额三者的区别存货
  • 银行对账单怎么修改
  • 新手会计做账怎么做账
  • xp系统开机按什么还原
  • freebsd书籍
  • 连接远程mq
  • centos 终端
  • 鲁大师完全卸载
  • centos 7安装教程(图文详解)
  • iphone手机文件怎么传到电脑
  • WIN10补丁白屏
  • jquery图片轮播无缝连接
  • ASP小贴士/ASP Tips javascript tips可以当桌面
  • jquery插件免费下载
  • adb shell命令
  • Android android.support.v4.widget.SlidingPaneLayout 侧滑示例
  • 供电企业向电厂收取的并网服务费
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设