位置: 编程技术 - 正文

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

  • 营改增后房地产会计账务处理
  • 有形资产租赁服务的税率
  • 收不回来的装修钱怎么办
  • 小规模纳税人申报时间
  • 电汇凭证的日期为什么必须是当天
  • 超市购物卡购物刷卡显帐号吗
  • 什么情况下做暂估
  • 房租租金收入都缴纳什么税金
  • 应收票据主要包括
  • 将外购的货物赠送给儿童福利院,进项税
  • 销售额负数 如何填报报表
  • 企业安全防护措施有哪些
  • 电子发票报销后还能冲红么
  • 应返还财政额度是什么科目
  • 开完发票业务没收入需要确认收入入账吗?
  • 企业所得税税收优惠方式有哪些
  • 创可贴属于什么费用科目
  • 福利能开专票吗
  • 个人租车给公司租金多少合适
  • 什么是工会经费返还
  • 认缴制的期限是多久
  • 以前年度已经缴纳的税
  • 红字发票不小心点了暂存怎么办
  • 开具增值税专用发票和普通发票的区别
  • 公司注销过程中如果有纠纷怎么办
  • 季度财务报表怎么打印
  • 苗木免税票能随便开吗
  • 给子公司拨款怎么记账
  • 委托代销商品会计分录按成本还是售价
  • 劳务公司代发劳务费合法吗
  • 建筑公司收到预收款要交税吗?
  • 软件开发怎么做会计分录
  • 成品油属于什么费用
  • 缴纳印花税怎么算
  • 临时工工资的会计处理和税务处理
  • wordpress建网站详细教程
  • 微信小程序和web端的交互
  • 计提折旧事考虑了残值净值怎么算
  • Linux | 将SpringBoot+Vue项目部署到服务器上
  • vue国际化解决方案
  • 新版本idea怎么创建javaweb
  • ssh非交互式登录
  • thinkphp百万级数据查询
  • phpstudy命令行
  • 工会经费没有交能买发票吗
  • 开票资料需要哪些东西
  • 累计折旧在资产负债表中填在哪里
  • 2021年股权变更要怎么办理?
  • 回购股票不注销如何发可转债
  • 交易性金融资产属于流动资产
  • 计提坏账准备金是什么意思
  • 电商账务怎么做
  • 押金抵货款怎样写协议
  • 被代持股份的股东需要负责吗
  • 已经认证的进项发票在哪里查询
  • 会计科目费用类
  • 长期待摊费用是非流动资产吗
  • 税收会计记账方法
  • 探讨探讨
  • sql数据库口令
  • mysql忽略大小写设置
  • win10预览版选哪个
  • win8.0下载
  • iis安装步骤 windows server 2008
  • 5.2光源
  • jquery教程
  • jquery轮播代码
  • winrar指令
  • unity开发用macbook怎么样
  • 脚本被删除
  • js编程中要使用到函数,分为哪几步?
  • 一起学ap
  • nodejs cgi
  • 使用JQuery中的trim()方法去掉前后空格
  • jquery Deferred 快速解决异步回调的问题
  • 河北税务怎么看自己绑定的银行卡号
  • 重庆税筹公司
  • 陕西省电子税务局
  • 基层税收工作的建议意见
  • 累计计税金额是怎么得出
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设