位置: 编程技术 - 正文

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)

  • 同一商品税收分类编码不一样
  • 允许税前扣除的项目
  • 国税税务登记号查询
  • 机动车销售统一专票图片
  • 一般纳税人没有进项怎么交税
  • 计提工资和实际发放工资必须一致吗
  • 企业所得税不超过300万怎么算
  • 小规模纳税人残保金
  • 预付账款借方怎么处理
  • 在建工程无发票怎么说明原因
  • 个人缴纳工会会费比例
  • 无发生额有没有对账单
  • 什么时候计提资本成本
  • 旅游业税率是多少,企业税是按季度缴纳吗
  • 公车私用情形有哪些
  • 防伪开票系统税票如何抵扣
  • 开票软件安装6位地区编号填什么
  • 企业出售已使用过的固定资产税率
  • 季度申报财务报表如何更改
  • 企业上月份销售收入在本月份发生销售折让时
  • 原材料销售出库会计分录
  • 如何在虚拟机上下载软件
  • 如何在excel中添加多行空白
  • 人力成本费用率和人工成本利润率
  • win11预览版更新界面
  • linux grub
  • linux测验
  • linux删除文本文件命令
  • 免抵退税的账务处理
  • 买二手房避税
  • 企业所得税的征税范围是什么
  • codelite怎么进行编译
  • 土地价款扣除会计分录
  • 经销商会议流程安排
  • css基础实验报告
  • Apsara Clouder云计算技能认证
  • 程序员 cr
  • 利润表所得税费用怎么算
  • 应付账款会计分录大全
  • php获取参数值的三种方式
  • 其他收益结转到什么账户
  • 银行会计核算方法的特点
  • mysql数据类型char
  • 母公司子公司下面的子公司怎么称呼
  • 固定资产费用化有什么影响
  • 减免的企业所得税怎么做账
  • 小型微利企业免税销售额是多少
  • 结转和结算
  • 应发工资计入什么科目
  • 报表的应付账款怎么算
  • 冲减成本费用
  • 社保申报工伤怎么操作
  • 注销股本对所有股票影响
  • 如何设置银行存款日记账
  • mysql语句性能优化
  • 使用灭火器人要站在上风口还是下风口
  • win10每次开机都假死机
  • centos的命令行界面输入
  • win8蓝屏解决方法
  • mac修改用户名称
  • 虚拟机linux使用
  • Red Hat Enterprise Linux 4+Nginx 0.7.47+PHP5.2+MYSQL5.0+Memcache+eAccelerator收
  • SymSPort.exe - SymSPort是什么进程 有何作用
  • linux程序死机
  • win7系统怎么看wi-fi密码
  • win7找回删除的文件
  • linux备份的文件bak如何恢复
  • win10系统字体不清晰
  • css控制html
  • python文法
  • 刚开始学java的心得体会
  • Using Django with GAE Python 后台抓取多个网站的页面全文
  • 置顶聊天折叠怎么关闭
  • 电子税务局怎么添加银行账户信息
  • 电子税务局的社保不能扣款怎么办
  • 税务局大厅咨询台
  • 三方协议开票流程
  • 陕西省国家税务局
  • 发票真伪查询国税官网12366
  • 郑州广电地址
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设