位置: 编程技术 - 正文

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)

  • 小规模纳税人报税时间
  • 企业的其他业务收入包括哪些
  • 如何查询企业税务状态
  • 汇算清缴是不是按照审计报告
  • 业务活动成本和业务活动费用的区别
  • 网银发工资怎么增员的
  • 水利基金应税项和减除项
  • 营业收入就是开票不含税么
  • 小规模自开专票怎么交税
  • 纯外贸企业进项要转出吗为啥
  • 销售收入冲红如何入账
  • 调增教育经费如何做账
  • 工程技术服务费和技术服务费
  • 购买脚手架报价单
  • 费用一定计入当期损益吗
  • 债券利息收入的增值税
  • 建筑工程属于开票项目吗
  • 职工福利费进项税转出怎样做账务处理
  • 资产总额从业人数
  • 小规模纳税人亏损要交税吗
  • 外购无形资产如何摊销
  • 苹果mac怎么禁止百度搜索
  • mac u盘
  • 开办费属于什么科目类别
  • 上个月多计提的费用怎么调整
  • 保证合同的担保范围包括
  • 关闭windows defender实时防护
  • window11正式版什么时候出来
  • 房地产企业按揭款到账后增值税
  • php模式
  • php file_get_contents smb
  • netbeans ide 8.1
  • 会计申报需要哪些数据
  • php文件夹在哪
  • golang和php
  • 浅析Laravel5中队列的配置及使用
  • 销售货款无法收到怎么办
  • java 泛型方法
  • 购入的机器设备
  • 帝国cms伪静态规则
  • 餐饮服务规定
  • 印花税每个月都要申报吗
  • 用于维修安装服务的工具
  • 一般纳税人税务的比例
  • 不同企业可以开专票吗
  • 小规模纳税人指的是谁
  • 城建税的征收范围不包括农村
  • 结转的制造费用
  • 什么叫递延收益和其他收益
  • 现金日记账退款怎么记账
  • 总公司费用能分摊到分公司吗
  • 公司缴纳社保如何转为个人缴纳
  • 公司向法人借款需要交税吗
  • 以前年度的亏损
  • 会计结转是什么意思
  • mysqldump导出csv文件
  • 电脑更新win10系统软件
  • 同一个用户
  • mac快捷功能
  • linux切换到指定目录
  • mmc.exe是什么
  • win7系统更新补丁会解决游戏卡顿的问题吗
  • win7系统升级win10系统方法
  • linux安装linux
  • javascript中的闭包
  • emulator: ERROR: no search paths found in this AVD's configuration. Weird, the AVD's config.ini file
  • linux中tar命令
  • 安卓手机管家怎么关闭
  • js传参是什么意思
  • android开发吧
  • python3的urllib
  • 小米电脑安装ubuntu
  • 税务电子发票怎么开
  • 贵州税务举报
  • 远程办税系统
  • 新入职税务干部工作心得
  • 税务机关对核准类减免税的审核
  • 深圳龙华区税务局大浪税务所电话
  • 综合所得税包括哪些内容
  • 个人所得税优惠政策最新2023年度
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设