位置: 编程技术 - 正文

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)

  • 小规模增值税免征额
  • 小规模 季度
  • 公司收到劳务发票
  • 退回以前年度教育附加费
  • 行政单位设计费计入哪个科目
  • 电子发票如何发给用截图发送可以吗?
  • 印花税小于1元显示无需申报
  • 预算外资金收入政府会计
  • 如何设置处理器个数如何设置显示器超频
  • 无法确认退货率时,差错更正为啥不反转增值税
  • 企业的其他账簿怎么做
  • 小规模纳税人变成一般纳税人的条件
  • 外地建安个人所得税标准
  • 报销发票财务一旦作废报销人可以收回吗?
  • 公司成立后一直没有收入
  • 季报资产负债表和利润表的勾稽关系
  • 分公司注销总公司会计分录
  • 资产负债表用来调节利润的负债
  • 核定征收的企业不能弥补亏损
  • 会计凭证丢失补违规么
  • 暂存款借方余额
  • 公司债务转移的法律规定
  • ntfs文件夹权限高于文件权限
  • 工会捐款计入什么科目
  • 董事费如何计算个人所得税
  • 折旧的计提
  • 利润表的营业收入是开票金额吗
  • php创建视图
  • php数组实现原理
  • 员工旅游是什么意思
  • 人工智能rl
  • phpcms邀请注册送积分
  • 现金流量表的填列方法
  • 当月增加的固定资产当月不计提折旧
  • 个人以不动产投资入股土地增值税
  • 开源 okr
  • 海关双抬头发票公司名可以更改吗
  • 公司内控制度由谁制定
  • 城建税要计入税金及附加吗
  • 债务豁免涉税
  • mysql卡住了
  • 长期股权投资会计准则2021修订
  • 公司两个股东变更为一个股东,需要交税么
  • 兼职收入用缴纳增值税吗
  • 母子公司关联交易规定
  • 差旅费补助无发票的文件依据
  • 建筑业跨区域预缴税款的计算
  • 哪些合同不用计提印花税
  • 合并抵消分录影响母公司总分类账吗
  • 带息票据贴现账务处理
  • 日后事项中所得税的处理方法
  • 转让土地及地上建筑物涉及的税金
  • 电子银行承兑汇票
  • 机票行程单如何看座位等级
  • 2023最新税收优惠政策有哪些
  • 采用现销方式销售商品的会计分录
  • 利润表怎么没有本月数
  • 申报表应纳税额和财务账金额不一致可以不改申报表吗
  • 什么企业属于小型微利企业
  • windows无法启动wlanautoconfig服务
  • linux 文件管理命令
  • Linux下使用quota命令管理磁盘空间的实例教程
  • sqlmangr.exe - sqlmangr是什么进程 有什么用
  • win7系统出现问题怎么修复
  • win10系统误删文件怎么恢复
  • won7系统优化
  • unity绘制曲线
  • 新手学做ppt
  • android加载dex
  • html图像元素
  • Node.js中的事件循环是什么
  • 分析天平
  • qrcode怎么生成
  • jq动态设置css
  • 公路局有钱吗
  • 浙江国税qzzn
  • 医院要交税吗
  • 深圳买新房契税一般什么时候交比较好
  • 集体土地征收应该有哪些文件
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设