位置: 编程技术 - 正文

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函数

  • 金税盘的会计科目
  • 资金账簿印花税减半政策
  • 城镇土地使用税纳税义务发生时间
  • 注册资本没有全额怎么办
  • 农村合作社怎么挣钱
  • 小规模纳税人月超10万季度不超30万
  • 委托加工物资属于企业资产吗
  • 收到退所得税款的会计分录
  • 重型开输机属于固定资产什么类别
  • 境内公司取得境外收入
  • 在建工程账务处理流程
  • 企业所得税收益计算公式
  • 个人账户作为公司私账
  • 物业公司销售门禁卡属于什么收入
  • 预付租金就要交增值税吗
  • 委托加工物资贷方
  • 2018年企业所得税政策变化
  • 电子发票一定要入账吗
  • 怎么在电子税务局变更财务负责人
  • 小微企业所得税税率多少
  • 自行建造厂房一座,现已完工,经验收后交付费用
  • 今年交上年税审核要多久
  • 红字冲回上月收入
  • 财务内账外账的优缺点
  • 修理时换下的废品配件怎么处理?
  • 开发阶段包括
  • 事业单位本年度工作小结
  • 房地产增值税结转收入的条件是什么
  • 查账征收的个体户注销流程
  • 如何修改mac系统密码
  • 屏幕乱跳广告解决办法
  • mac如何编译c语言
  • 经营性支出属于哪个科目
  • PHP:pg_field_table()的用法_PostgreSQL函数
  • mp3最早什么年代流行
  • 汇兑应计入哪个科目
  • 增值税专票怎么作废
  • 前端资源浏览器下载
  • 托盘账务处理
  • python中series的用法
  • 企业其他应付款余额非常大的原因
  • 预缴增值税附加税
  • 管理费用借贷方不平
  • 自然人股东原价转让股权
  • 合并报表抵消分录
  • 长期待摊费用的摊销方法
  • 企业长期借款的渠道有哪些
  • 住房公积金中的钱可以当首付吗?
  • 关联方交易的税收问题
  • 房地产行业概况
  • 资源税计税依据是开采量还是销售量
  • 一般纳税人的招待费会计分录
  • 交增值税怎么做帐
  • 固定资产的后续支出应如何进行会计处理
  • 已开票未收款怎么报税
  • 事业单位发放生育津贴从哪年执行的
  • 所有者权益的概念和特征
  • sql 重复记录
  • win升级失败 导致无法启动
  • 怎么修改注册表的权限
  • xp系统安装版如何安装
  • windowsxp自带播放器
  • centos如何查询ip
  • win8怎么提高网速
  • window10光驱
  • win10怎么用ios上网
  • 四步制作的花
  • linux制作
  • fetch怎么用
  • python数据结构与算法分析 第2版(图灵出品)
  • Unity3D游戏开发(第2版)pdf
  • android内存泄露 工具
  • js鼠标点击事件监听
  • 详解各种汽油一吨等于多少升
  • unity3d知乎
  • js基础知识
  • jquery跨域请求有哪些方式
  • 北京办理税务登记的地方
  • 完税证明可以自己在官网打印吗
  • 金税盘和uk
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设