位置: 编程技术 - 正文

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

  • 应交增值税一般纳税人的账怎么做
  • 调整增值税误差的方法
  • 一般纳税人如何注销
  • 个体户转一般纳税人怎么做账
  • 应纳税额关于进项和销项的计算公式
  • 购销合同印花税最新政策2023
  • 超市送现金券怎么做账
  • 缴纳城建税会计分录怎么做账
  • 调增收入的会计分录
  • 集团内部资产划转需要交增值税吗
  • 施工费增值税税率是9%
  • 什么叫含税级距和不含税级距
  • 小规模印花税减免性质代码和项目名称
  • 个人公益性捐赠全额还是限额
  • 净利润和毛利润的计算公式
  • 远程清卡失败怎么办
  • 增值税普通发票有什么用
  • 企业购买固定资产要交印花税吗
  • 改造工程完工会计分录
  • 钱已确定收不回怎么办
  • 建筑业总产值的统计执法检查内容
  • mac老款设备怎样升级os14
  • 企业所得税汇算清缴补缴税款分录
  • win7安装netframework4.5
  • 安置房项目需要环评吗
  • 抵债资产的账务处理
  • 企业代扣代缴个人所得税会计分录
  • yolov1网络结构图详解
  • 在草地上吃零食叫什么
  • yolo xml转txt
  • grid-column
  • uniapp components
  • flink从入门到实战
  • pythonjson文件存储
  • 冲掉应收账款
  • 房屋出租 交税
  • 销售折让的会计科目
  • 哪些无票费用能够抵扣所得税
  • 算税负是含税还是不含税
  • 购销合同印花税税率表
  • 原材料的帐务处理
  • 火车票报销抵扣比例是多少
  • 固定资产清理是什么账户
  • 企业稳岗补贴计算公式
  • 会计凭证借贷方哪个是收入
  • 扇贝的储存方式
  • etc插卡成功有什么反应
  • 收回多发工资需要什么附件入账
  • 工程施工借贷方向
  • 内账价税分离如何做账
  • MySQL 4.1/5.0/5.1/5.5/5.6各版本的主要区别整理
  • 简单基是什么
  • ubuntu 管理软件
  • 服务主机windows错误报告
  • 虚拟机ubuntu20.04
  • 硬盘安装好了显示不出来怎么办
  • centos下netconfig 的安装方法
  • win10怎么打开语言设置
  • winxp网络设置在哪
  • Mac系统中pr插件汉化
  • 进程 cmd
  • proflwiz.exe - proflwiz是什么进程 有什么用
  • win10系统开机蓝屏得重启后才能开机
  • win7如何更改欢迎界面
  • win7系统命令大全
  • qat开发
  • Android OnTouchEvent, onClick, onLongClick调用机制
  • jQuery实现ajax调用WCF服务的方法(附带demo下载)
  • 很好的资源学习入口_android
  • 播放一个灵异电影
  • 详解九章算法
  • Python爬取网易云音乐歌单内歌曲歌手封面播放地址
  • js表单事件有哪些
  • javascript入门书
  • android刷题
  • 发票上的税务号
  • 国家税务局关于印花税若干具体问题的规定
  • 如何查询企业税务评级
  • 给派出所写情况说明房屋情况怎么写啊
  • 增值税检查调整的账务处理
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设