位置: 编程技术 - 正文

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
  • 进口增值税未抵扣怎么办
  • 会计人员必备的知识和技能
  • 分公司背书给总公司
  • 发票的审核之真假发票的查验
  • 提供餐饮服务的税率
  • 烟草企业发生的广告和宣传费在当年营业收入15
  • 定期定额户需要自己申报吗
  • 母公司并购子公司需要股东会决议吗
  • 科研机构进口直接用于科学研究的仪器免征增值税吗
  • 联营企业分得的利润应计入什么科目
  • 少交的增值税如何记账
  • 因有减免税款不退怎么办
  • thinkphp3.2 layui
  • windows7旗舰版好用吗?
  • win10系统修改密码
  • php-cp
  • 所得税季报填报说明
  • win11 build 22000.65
  • 最高跑分纪录的显卡是什么
  • 销售退回的处理方法
  • 违约罚款的会计分录
  • 国家纪念品
  • php中数据库怎么设计
  • 计提折旧事考虑了残值净值怎么算
  • thinkphp3.2框架
  • ai复制命令
  • php支付宝现实支付要收费吗
  • 支付兼职工资账务处理
  • 税控盘抵税的会计分录
  • 扣税免除项
  • 运输服务属于生活服务吗
  • 结转生产成本是不是成品入库
  • 工程结算编制收费标准
  • 预收账款是负债增加还是减少
  • 写个电影剧本多少钱
  • 建筑业 分包
  • 税控技术维护费普通发票可以抵扣吗
  • 增值税一般纳税人登记表在哪里找
  • 小规模纳税人计税销售额为不含税销售额
  • 在建工程前期投标流程
  • 开具红字发票如何做账?
  • 承兑汇票贴现计算器下载
  • 销售商品成本核算
  • 银行账跨年一直没做怎么补
  • 主营业务成本和管理费用的区别
  • 收到一笔财政局的付款
  • 购买办公软件的进项发票可以抵扣吗
  • 仲裁是什么意思举个例子
  • 商品流通企业流程
  • winxp和win7共享
  • 苹果mac怎么下载英雄联盟
  • mac打不了字什么原因
  • 在bois如何设置C盘启动
  • win10的打开方式
  • ezulumain.exe是病毒进程吗 ezulumain进程安全吗
  • 进程aissca.exe
  • 半自动化系统
  • android studio ndk开发教程
  • 利用python进行
  • css设置表格隔行换色
  • cmd读取d盘
  • 计算天数的excel公式
  • python 钉钉打卡定位
  • 小微企业契税政策
  • 地方税务局属于地市级还是副省级
  • 我国税收征收机关包括
  • 开票有什么好处吗
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设