位置: 编程技术 - 正文

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")

  • 金税盘老是重复更新进不去
  • 补缴以前年度附加税如何入账
  • 一般纳税人材料销售税率
  • 税务ukey使用教程视频
  • 城镇土地使用税的征税范围有哪些
  • 个体户核定征收需要做账吗
  • 工程结算是含税还是不含税
  • 总分机构 分总机构
  • 讲师培训费开票税点是?
  • 所得税申报更正申报怎么报?
  • 销售金额计算抵增值税吗
  • 应付税费包括
  • 月末本年利润余额怎么算
  • 一般纳税人税种认定有几个增值税要怎么申报呀
  • 交强险发票备注的车船税怎么报销
  • 汇算清缴残保金填哪里
  • 一般纳税人没有开票要交税吗
  • 清包工程增值税税率
  • 附加税没有计提会计分录
  • 对公账户每个月
  • 农产品普通发票抵扣怎么申报
  • 小微企业所得税税率2.5% 10% 25%
  • 冲抵货款销售返利会计分录怎么写?
  • 小规模企业转为一般纳税人怎么做会计分录
  • 活动策划费开票在哪个项目下面
  • 当月凭证做完怎么结转?
  • 汇算清缴时研发费用加计扣除怎么做账
  • 其他流动负债包含
  • 电脑管家使用教程
  • 怎么获得2021
  • php字符串定义
  • nomoreporn.exe - nomoreporn是什么进程 有什么用
  • 股东以债权出资,公司怎么处理
  • 出口收汇可以收人民币吗
  • 应付票据抵付应付账款
  • 企业租用个人房屋
  • 集团公司内部结构是什么
  • 截取字符串php
  • 进口应税消费品所支付的金额不包括
  • 货物运输业增值税发票样本
  • phpexcel读取excel
  • 应收账款占用资金的应计利息变动额
  • 2022年如何在股室工作中落实党风见证
  • 自建厂房流程
  • 房屋出租 交税
  • 其它应付款核算项目
  • 开票提示未安装控件
  • 事业结余期末余额在借方
  • 无偿提供建筑服务缴纳增值税
  • 其他应付款需要结转损益吗
  • 印花税减征比例
  • 费用科目什么意思
  • 待报解预算收入是什么
  • 专利权的入账价值包括资本化支出吗
  • 管理费用是怎么计算的
  • 子公司注销如何注销
  • 公司破产账务处理
  • 去年多计提的费用
  • 人力成本费用率和人工成本利润率
  • 对公账户进出账常识
  • 什么费用可以列入研发费用
  • 支票小写金额可以涂改吗
  • 医院体检收入计入什么科目
  • 普通发票怎么开?
  • 预付账款怎么做账务处理
  • 建账基本要求
  • mysql 行转列 列转行
  • fedora7
  • windows xp玩lol
  • windows10 预览
  • [置顶]电影名字《收件人不详》
  • opengl 缓存
  • androidstudio手机编程软件
  • css不需要编译
  • jquery怎么判断复选框选中
  • 数据结构 二叉树什么是孩子数
  • javascript如何
  • offset function
  • 专家费缴税标准
  • 船员工资是否需交税
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设