位置: 编程技术 - 正文

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)

  • 小型微利企业税率2023
  • 预期信用损失率计算公式
  • 无形资产的摊销会计科目
  • 一般纳税人条件要求
  • 电子承兑背书失败是怎么回事
  • 以前年度少计提折旧怎么做分录
  • 商品已发出未开票未收款怎么做账
  • 住宿费可以抵扣吗?
  • 买车购置税为什么除11.3
  • 手撕税票去哪可以弄到
  • 速达财务软件使用说明
  • 附加税退税如何做账
  • 金融企业不良资产批量收购处置业务
  • 固定资产报废账目
  • 回购股票时的会计分录
  • 材料发票清单
  • 企业债券投资利息怎么算
  • 员工交通费报销标准
  • 什么是应收
  • 误删的文件怎么撤回
  • vue 高德地图 窗体
  • 出纳借方
  • 多交的增值税可以做营业外支出吗?
  • 索尼体积最小的微单
  • php关键字的意思
  • 政府搬迁补偿款怎么算
  • 实现php框架系列功能
  • 安博塞利国家公园简介
  • 业务招待费个税账务处理办法
  • php中的类
  • 残疾人就业保障金怎么申报
  • 异地提供建筑服务预缴企业所得税
  • vue router 路由参数
  • 融资租赁固定资产不属于筹资活动
  • 金税盘全额抵扣政策
  • 移动平均法适用范围
  • 销售返利账务处理及注意事项
  • 车票增值税抵扣怎么操作
  • 公司的违约金
  • 非盈利机构怎么说
  • 发票行业税目怎么选
  • 小规模公司的做账要求
  • 上年多交的增值税怎么调整
  • 企业银行流水可以不给税务吗
  • 递延所得税资产账务处理
  • 总公司下的分公司破产怎么赔偿
  • 盈余公积提取多了
  • 以前年度损益调整是什么意思
  • 股权转让如何缴纳个人所得税举例说明
  • 其他收益和其他综合收益属于什么科目
  • 年度的汇算清缴
  • 小规模纳税人购进税控设备如何抵扣
  • sqlgun
  • 安装好sql2000后安装sp4
  • innodb update 锁
  • 电脑开机显示xp后无反应
  • 怎样打开windows设置页面
  • win10预览体验三个选项
  • LINUX系统管理员维护招聘
  • win8换win10系统步骤
  • rundull32.exe
  • 深度技术win10怎么样
  • centos7如何进入命令行
  • win10系统如何
  • 三分钟教你学会骑女式摩托车,连菜鸟都能学会
  • windows常用命令操作
  • Android 摄像头预览卡顿
  • 批处理文件是将需要连续使用的可多次重复使用的
  • jQuery中$.ajax()方法参数解析
  • nodejs的流处理模块
  • 各类扩展名
  • unity加密代码
  • javascript教程chm
  • unity脚本api
  • android 图片视频轮播框架
  • 曲剧全场戏双玉蝉
  • jquery实现图片放大
  • python,多线程
  • 甘肃税务局电子税务局官网电子发票怎么查询
  • 云南省税务局召开的会议
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设