位置: 编程技术 - 正文

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

  • 个税返还奖励财务人员流程
  • 未交增值税和应交增值税科目怎么调整
  • 企业清算所得税申报
  • 物业公司车位出租能开具什么发票
  • 企业自产的产品转为自用
  • 暂估成本跨年后收到票汇算清缴
  • 税务异常有哪些类型
  • 成本核算需要哪些基础工作
  • 企业新增固定资产流程图
  • 固定资产缩水
  • 赠品的会计核算内容
  • 酒店怎么合理规划管理
  • 工会经费怎样申报
  • 应付账款周转率分析
  • 工程按量计价什么意思
  • 应缴纳的所得税税额
  • 取得增值税专用发票
  • 冲减留抵税额
  • 申请增值税一般纳税人登记在办理手续
  • 金税盘怎么做账务处理
  • 电子发票无法预览怎么弄
  • 个人出租房屋给公司可以开专票吗
  • 免抵退免抵额何时申报附加税?
  • 自然人独资企业交什么税
  • 国库年终总结
  • 股东之间转让股权需要股东会决议吗
  • 其他综合收益属于什么类
  • 前端解决方案
  • 一次性支付一年租金怎么做账
  • 固定资产减值判断标准
  • it最高工资
  • php追加写入
  • 解决的英文
  • php7安装教程详解
  • 前端 原生
  • uniapp官方教程
  • 因果推断的常用标准
  • gcn时间序列
  • nodejs基础知识
  • 开票软件是什么名字
  • 循环logo
  • 公司租个人房屋交什么税
  • java 代码简洁
  • 业务招待费汇算清缴怎么填表
  • 房地产城建税计税依据
  • 企业投资一个小时多少钱
  • 制造费用结转本年利润吗
  • 省市县三级联动工作机制
  • 利息收入交税不
  • 预提费用多提了怎么办
  • 借别人钱收据怎么写
  • 销售退回的账务处理会计分录
  • 应收账款多出来的钱记到什么科目
  • 纳税人去税务局办什么
  • 收到促销服务费会计分录
  • 冲减坏账准备的金额怎么计算
  • 应收账款转让会计分录 未实际收到对价
  • sqlserver存储过程返回多个结果集
  • win2008r2下载
  • centos7+
  • 怎么快速隐藏电脑下方一排
  • 电脑winxp系统
  • vista sp2 旗舰版 key
  • 纸嫁衣6第四章攻略全文图解
  • centos搭建lamp环境
  • windows xp能装微信吗
  • 查找临时文件的命令
  • linux curl命令使用
  • cocos2d安装
  • 关于月亮的诗句
  • relative absolute无法冲破的等级问题解决第1/3页
  • php和mysql的结合是目前web开发中的黄金组合
  • kill某个进程
  • android Lollipop(5.0)--touch feedback(触摸反馈)
  • django应用开发实战
  • 安卓动态图标怎么实现
  • python爬取三国演义前六章
  • 福建省国税局电话号码
  • 临时搭建的活动叫什么
  • 化妆品关税怎么算
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设