位置: 编程技术 - 正文

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

  • 出口退免税管理工作规范2.0
  • 借款利息税前扣除标准例题
  • 如何分析成本费用偏高
  • 高档化妆品增值税税率是13%
  • 全资收购企业需要交税吗
  • 外经证到期如何填写最新有效期限
  • 个体工商户生产经营所得税率
  • 场外货币基金赎回利息
  • 固定资产暂估折旧能税前扣除吗
  • 结转增值税销项的账务处理
  • 退货款现金流量表填经营活动的什么科目
  • 收到联营单位投入的设备一台
  • 物业费增值税收入的确认最新政策
  • 出售无形资产是收入吗
  • 水电费没有票怎么做账
  • 销售商品会计凭证
  • 普通发票收款方账号信息错了可以正常报销吗
  • 填制和审核凭证是什么意思
  • 资本公积转增的股票可以转让吗
  • 结转开发产品
  • 投入资本属于净资产吗
  • 个税专项扣除有几项
  • 私募股权投资基金管理办法最新
  • 房地产销售广告是要约还是要约邀请?原因是什么?
  • win11进入黑屏
  • mac怎么安装dmg软件
  • 如何在Excel中进行单元格格式化?
  • 研发支出和研发费用是一个吗
  • 季节性停工是什么
  • 发票金额大于报销金额可以吗
  • mac废纸篓立即删除和清倒
  • 如何让windows8.1更流畅
  • 原材料废料怎么做账
  • 一般合同怎么写才有效
  • 本季度企业所得税
  • 会计学中借和贷怎么区分
  • css 宽度 自适应 占满
  • 数据挖掘 实战
  • echarts中国地图代码
  • 购建或者生产符合资本化条件的资产
  • 增值税专用发票和普通发票的区别
  • 残保金季报要填上年职工人数
  • python 覆盖
  • 间接费用允许调整吗
  • 银行日记账跨月登记方法
  • 未达起征点销售额
  • 速达建账套期初数据
  • 收到天使投资账务处理
  • 公司购买劳保用品可以抵扣吗
  • 对公账户收钱要手续费吗
  • 简易计税通过哪个科目核算
  • 将借款存入银行会计分录
  • 垫付的资金
  • 复利年金终值计算器
  • 记账凭证先写借方还是贷方
  • 其他应收款待抵扣税金
  • 特许权使用费税前扣除
  • 会计信息质量特征哪个最重要
  • mysql的基本介绍
  • win8无internet访问权限怎么解决
  • Ubuntu操作系统安全维护
  • Linux /bin, /sbin, /usr/bin, /usr/sbin 区别
  • xwizard.exe是什么
  • 计算机图形学考研院校
  • js判断数组是否相等
  • 浅析Javascript ES6中的原生Promise
  • 需要牢记的号码
  • 初识年岁尚温柔 小说 免费
  • 常用标准化布局标签有哪些?
  • 在一个批处理系统中
  • career和calling的区别
  • Android: AudioFlinger中AudioPolicy的简单介绍
  • hover在jquery中的用法
  • 深入理解python特性 pdf
  • javascript中用于声明变量的关键字
  • jquery的checkbox,radio,select等方法小结
  • 道路运输业属于工贸行业吗
  • 美容行业增值税率是多少
  • 个人所得税是哪种税率
  • 国际税收对经济活动的影响
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设