位置: 编程技术 - 正文

PHP:oci_close()的用法_Oracle函数(php options)

编辑:rootadmin
oci_close

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

文章相关热门搜索词:php ob_start,php options,php occ,php oci,php opache,php close,php oci8,php oci,内容如对您有帮助,希望把文章链接给更多的朋友!

(PHP 5, PECL OCI8 >= 1.1.0)

oci_close — 关闭 Oracle 连接

说明 bool oci_close ( resource $connection )

oci_close() 将 Oracle 连接 connection 关闭。

Note:

自版本 1.1 起 oci_close() 正确关闭 Oracle 连接。使用 oci8.old_oci_close_semantics 选项来恢复本函数的旧行为。

成功时返回 TRUE, 或者在失败时返回 FALSE。

Note:

在 PHP 5.0.0 之前的版本必须使用 ocilogoff() 替代本函数。该函数名仍然可用,为向下兼容作为 oci_close() 的别名。不过其已被废弃,不推荐使用。

参数

connection

An Oracle connection identifier returned by oci_connect(), oci_pconnect(), or oci_new_connect().

返回值

成功时返回 TRUE, 或者在失败时返回 FALSE。

范例

Example #1 Closing a connection

Resources associated with a connection should be closed to ensure the underlying database connection is properly terminated and the database resources are released.

<?php$conn=oci_connect('hr','welcome','localhost/XE');if(!$conn){$e=oci_error();trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);}$stid=oci_parse($conn,'SELECT*FROMdepartments');$r=oci_execute($stid);oci_fetch_all($stid,$res);var_dump($res);//Freethestatementidentifierwhenclosingtheconnectionoci_free_statement($stid);oci_close($conn);?> PHP:oci_close()的用法_Oracle函数(php options)

Example #2 Database connections are not closed until all references are closed

The internal refcount of a connection identifier must be zero before the underlying connection to the database is closed.

<?php$conn=oci_connect('hr','welcome','localhost/XE');if(!$conn){$e=oci_error();trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);}$stid=oci_parse($conn,'SELECT*FROMdepartments');//thisincreasestherefcounton$connoci_execute($stid);oci_fetch_all($stid,$res);var_dump($res);oci_close($conn);//$connisnolongusableinthescriptbuttheunderlyingdatabase//connectionisstillheldopenuntil$stidisfreed.var_dump($conn);//printsNULL//WhilePHPsleeps,queryingtheOracleV$SESSIONviewina//terminalwindowwillshowthatthedatabaseuserisstillconnected.sleep();//When$stidisfreed,thedatabaseconnectionisphysicallyclosedoci_free_statement($stid);//WhilePHPsleeps,queryingtheOracleV$SESSIONviewina//terminalwindowwillshowthatthedatabaseuserhasdisconnected.sleep();?>

Example #3 Closing a connection opened more than once

When database credentials are reused, both connections must be closed before the underlying database connection is closed.

<?php$conn1=oci_connect('hr','welcome','localhost/XE');//Usingthesamecredentialsreusesthesameunderlyingdatabaseconnection//Anyuncommittedchangesdoneon$conn1willbevisiblein$conn2$conn2=oci_connect('hr','welcome','localhost/XE');//WhilePHPsleeps,queryingtheOracleV$SESSIONviewina//terminalwindowwillshowthatonlyonedatabaseuserisconnected.sleep();oci_close($conn1);//doesn'tclosetheunderlyingdatabaseconnectionvar_dump($conn1);//printsNULLbecausethevariable$conn1isnolongerusablevar_dump($conn2);//displaysthat$conn2isstillavalidconnectionresource?>

Example #4 Connections are closed when variables go out of scope

When all variables referencing a connection go out of scope and are freed by PHP, a rollback occurs (if necessary) and the underlying connection to the database is closed.

<?phpfunctionmyfunc(){$conn=oci_connect('hr','hrpwd','localhost/XE');if(!$conn){$e=oci_error();trigger_error(htmlentities($e['message'],ENT_QUOTES),E_USER_ERROR);}$stid=oci_parse($conn,'UPDATEmytabSETid=');oci_execute($stid,OCI_NO_AUTO_COMMIT);return"Finished";}$r=myfunc();//Atthispointarollbackoccurredandtheunderlyingdatabaseconnectionwasreleased.print$r;//displaysthefunctionreturnvalue"Finished"?> 注释

Note:

Variables that have a dependency on the connection identifier, such as statement identifiers returned by oci_parse(), must also be freed before the underlying database connection is closed.

Note:

Prior to version PHP 5.1.2 (PECL OCI8 1.1) oci_close() was a no-op. In more recent versions it correctly closes the Oracle connection. Use oci8.old_oci_close_semantics option to restore old behavior of this function.

Note:

The oci_close() function does not close the underlying database connections created with oci_pconnect().

Note:

In PHP versions before 5.0.0 you must use ocilogoff() instead. 在当前版本中,旧的函数名还可以被使用,但已经被废弃并不建议使用。

参见

oci_connect() - 建立一个到 Oracle 服务器的连接 oci_free_statement() - 释放关联于语句或游标的所有资源

PHP:oci_commit()的用法_Oracle函数 oci_commit(PHP5,PECLOCI8=1.1.0)oci_commit提交未执行的事务处理说明booloci_commit(resource$connection)oci_commit()将Oracle连接connection上正在运行的事务中所有未执行的语句

PHP:oci_close()的用法_Oracle函数 oci_close(PHP5,PECLOCI8=1.1.0)oci_close关闭Oracle连接说明booloci_close(resource$connection)oci_close()将Oracle连接connection关闭。Note:自版本1.1起oci_close()正确关闭Oracle连接。

PHP:oci_connect()的用法_Oracle函数 oci_connect(PHP5,PECLOCI8=1.1.0)oci_connect建立一个到Oracle服务器的连接说明resourceoci_connect(string$username,string$password[,string$db[,string$charset[,int$session_mode]]])oci_connect(

标签: php options

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

上一篇:PHP:oci_fetch_assoc()的用法_Oracle函数

下一篇:PHP:oci_commit()的用法_Oracle函数

  • 缴纳汇算清缴所得税怎么做账
  • 航天金税财务软件使用说明
  • 本年利润怎么结转分录
  • 工会经费的会计核算方法
  • 工资表只显示一个人的其他看不见
  • 以不动产投资入股增值税
  • 核定征收需要什么条件
  • 银行代发工资户允许有余额吗
  • 代开增值税票普票专票税点一样吗
  • 发票认证延期抵扣啥意思
  • 实收资本印花税税率多少
  • 一年内到期的非流动负债包括哪些科目
  • 购进二手办公设备如何进行入账?
  • 没有开通对公账户
  • 发票联给错怎么办?
  • 企业的资金怎么使用
  • 农民专业合作社属于什么企业类型
  • 商业企业成本核算内容包括
  • 研发费用的会计和税法的不同
  • 按揭购入固定资产怎么算
  • 已开票不确认收入未收款怎么做账
  • win10右键没有打印
  • 如何解决浏览器禁止访问
  • 待清算专户
  • 被投资企业所在地什么意思
  • 腾讯电脑管家中蓝牙在哪
  • 个人所得税专项扣除子女教育标准
  • jQuery+Ajax+PHP“喜欢”评级功能实现代码
  • 收到人才引进补助会计分录
  • mac系统安装出错
  • 打印机疑难解答显示打印机问题
  • PHP:clearstatcache()的用法_Filesystem函数
  • 代理业如何交增值税
  • 劳务报酬已扣税是否需报个税
  • 年度总产值等于营业收入
  • 装修费用一次性计入成本
  • 企业的资产必须符合哪些条件
  • 发票遗失要如何补办
  • 税额和税率一样吗
  • 矿产资源补偿费计入管理费用吗
  • 基本账户的定义
  • 发票开具流程是?
  • 生产过程中产品质量问题
  • 员工工资怎么核算
  • 借款怎么收回来
  • 年报审计调整
  • 单位购牙膏牙刷卫生纸怎么做账?
  • 汇算清缴帐务处理
  • 小规模纳税人能抵扣进项税额吗
  • 金蝶暂存凭证怎样转正常凭证
  • 投入产出比的计算依据
  • 银行承兑汇票如何背书转让
  • 压缩sql数据库
  • solaris syslog
  • window组策略
  • win7清理系统垃圾的方法
  • 利用ipy做ip地址的管理
  • xp系统文件损坏怎么修复
  • rtc resume
  • centos安装软件教程
  • win8装机教程
  • js中sort排序
  • 怎么配置nodejs
  • python shape用法
  • python生成随机
  • android新手入门
  • [android] listView解析
  • pygame如何加载图片
  • android采用什么软件架构?
  • node.js使用教程
  • JavaScript基础语法
  • js的实现原理
  • jquery隐藏和显示div
  • Python中的字典用法
  • 常用的截图方法有哪些
  • flask框架下使用scrapy框架
  • 企业购车需要交消费税吗
  • 稽查查补税款享受增值税免税优惠吗
  • 税务局追缴社保流程及办理期限
  • 机关工勤人员2022工资套改表
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设