位置: 编程技术 - 正文

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

编辑:rootadmin
oci_close

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

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

(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 occ)

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_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:oci_fetch_all()的用法_Oracle函数 oci_fetch_all(PHP5,PECLOCI8=1.1.0)oci_fetch_all获取结果数据的所有行到一个数组说明intoci_fetch_all(resource$statement,array&$output[,int$skip[,int$maxrows[,int$flags]]])oci_fetch_all()

PHP:oci_execute()的用法_Oracle函数 oci_execute(PHP5,PECLOCI8=1.1.0)oci_execute执行一条语句说明booloci_execute(resource$stmt[,int$mode])oci_execute()执行一条之前被解析过的语句(见oci_parse())。可选参数mode

标签: php occ

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

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

下一篇:PHP:oci_connect()的用法_Oracle函数(php odbc)

  • 金融债券的利息收入
  • 支付的检测费计入什么科目
  • 免抵退税额为什么等于出口价乘以退税率
  • 一般企业需要缴纳的税种
  • 企业税收标准是多少
  • 预收账款开票怎么做账
  • 土地出让金进项税税率
  • 企业购买预付卡怎么做账
  • 打官司败诉承担的费用
  • 商品流通企业会计心得体会3000字
  • 房产税税率和应纳税额
  • 广告服务差额征税
  • 高技术制造企业
  • 包工包料装修
  • 代扣税款手续费管理办法
  • 如何安装os x
  • win11如何更改开始菜单位置
  • 如何把操作系统转移到固态硬盘
  • 抵押物转让的法律规定
  • 股票属于以下哪一类金融工具
  • 建筑劳务公司一年挣多少钱
  • 圣海伦斯山国家火山纪念区
  • 境外服务包括哪些内容
  • 什么样的企业是好企业,什么样的员工是好员工
  • 工程审计的目的包括哪些
  • 按下电源按钮时锁定计算机怎么弄
  • 支付离退休人员退休金可以用现金结算吗
  • 企业安置残疾人如何残联备案
  • 公司为员工缴纳社保的法律规定
  • 企业付给个人工资怎么做
  • vue调用后端接口的方法
  • 可以跨城租车吗
  • JavaScript charCodeAt() 方法
  • chat gpt 国内版免费手机
  • 处置子公司账务处理
  • 社会保险基数怎么办
  • 结转结余的概念
  • 无发生额有没有对账单
  • sql server 2008 安装文件
  • sql服务无法启动 3417
  • 固定资产清理科目有余额吗
  • 作废发票清单要回收吗
  • 营业收入是指从全部营业收入中扣除
  • 减免税款属于政府补助利得吗
  • 个人所得税能说明什么
  • 公司注销清算时个人股东如何计算个人所得税
  • 发票的种类有哪些?存在哪些区别
  • 出口货物备案单证目录怎么填
  • 税控设备抵减税款分录
  • 保证金计算器
  • 房地产企业怎么交房产税
  • 可供出售金融资产的会计处理
  • 发生了销售交易但没有在销售日记
  • 材料折扣会计分录
  • 销售返利如何做账
  • 待摊费用取消了怎么做账
  • 建账是不是只需要科目余额表
  • 房地产企业会计科目
  • 详谈是什么意思
  • WIN7中的一个库最多可以包含多少个文件夹
  • windows xp搜索功能在哪里
  • 虚拟机怎么手动设置ip地址
  • win7系统自动更新在哪里关闭啊
  • Win8系统网络SSID怎么设置?Win8设置网络SSID的方法
  • linux批量处理文件
  • win7如何设置屏幕不黑屏
  • 系统相机打不开
  • win8.1开始菜单怎么改成win7那样
  • 批量装win7
  • jQuery ajax读取本地json文件的实例
  • 最新推荐美剧
  • js绑定函数
  • python程序员必读书籍
  • [置顶]游戏名:chivalry2
  • HttpClient通过Post上传文件
  • Android之fill_parent和wrap_content
  • 怎么打印历史发票
  • 辽宁省财政局会计网
  • 江苏单位医保如何查询
  • 全国初中应用物理知识竞赛获奖名单
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设