位置: 编程技术 - 正文

PHP:oci_close()的用法_Oracle函数(php occ)

编辑:rootadmin
oci_close

推荐整理分享PHP:oci_close()的用法_Oracle函数(php occ),希望有所帮助,仅作参考,欢迎阅读内容。

文章相关热门搜索词:php close,php opache,php close,php oci8,php opache,php oci,php oci_connect,php close,内容如对您有帮助,希望把文章链接给更多的朋友!

(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 occ)

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_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:oci_fetch_all()的用法_Oracle函数 oci_fetch_all(PHP5,PECLOCI8=1.1.0)oci_fetch_all获取结果数据的所有行到一个数组说明intoci_fetch_all(resource$statement,array&$output[,int$skip[,int$maxrows[,int$flags]]])oci_fetch_all()

PHP:oci_execute()的用法_Oracle函数 oci_execute(PHP5,PECLOCI8=1.1.0)oci_execute执行一条语句说明booloci_execute(resource$stmt[,int$mode])oci_execute()执行一条之前被解析过的语句(见oci_parse())。可选参数mode

标签: php occ

本文链接地址:https://www.jiuchutong.com/biancheng/281115.html 转载请保留说明!

上一篇:PHP:oci_commit()的用法_Oracle函数

下一篇:PHP:oci_connect()的用法_Oracle函数(php odbc)

  • 老板自己出钱买股票
  • 购买金税盘维护费会计分录
  • 怎么看运费
  • 买烟草可以开发票吗
  • 文化建设费征收依据
  • 备用金支出怎么记账
  • 人员处于银行代扣报盘期间什么意思
  • 短期借款可以按币种设置明细核算
  • 个人开技术服务费税率是多少
  • 营改增的会计处理及其对财务的影响
  • 用公户付了一笔款怎么办
  • 广告费用的增值税税率
  • 该纳税人不属于经备案的二手车企业
  • 证券公司期货业务管理办法
  • 残疾人保障金怎么计提
  • 公允价值变动损益转入其他业务成本
  • 床垫增值税税率是多少
  • 租金税率9%和5
  • 哪些项目可以在城镇开发边界外
  • 盘盈现金计入当期损益
  • 我想看一下这个月几日
  • 为什么我的win10
  • 在线测网速准吗
  • 信用卡扣手续费怎么算的
  • 增值税发票的进项和出项要一致吗
  • 财务差旅费报销制度
  • 种植业土地租赁计入哪个科目
  • 小规模纳税人如何申报增值税
  • PHP:mb_ereg_search_getregs()的用法_mbstring函数
  • AquariumDesktop.exe进程危险吗 AquariumDesktop是什么进程
  • js时间格式转换时间戳
  • 给客户赠送的礼物叫什么
  • 公积金托收怎么变更
  • php ftp函数
  • 经济业务原始凭证分录
  • laravel基础
  • 马拉喀什的历史背景
  • 小规模纳税人免税政策2023年
  • 现在用yii框架的人还多么
  • php数组分为哪两种
  • ubuntu端口不能远程访问
  • 补缴去年的税款会计分录
  • 工程施工企业的增值税税率是多少
  • 代发工资的账务处理需要什么资料
  • python的用途
  • 存货资产减值损失借贷方向
  • 处置子公司如何纳税
  • 关于sqlserver2000中的sql账号,角色
  • macos添加用户
  • 高新企业奖励金怎么开票
  • 电子承兑汇票承兑后几天到账
  • 企业进项是什么意思
  • 符合规定的国内旅客运输发票可以作为扣税凭证吗
  • 预收账款挂账多长时间必须确认收入
  • 销售退货和销售换货的区别
  • 收到设计费分录怎么写
  • 周转材料怎么做分录
  • 广告被罚
  • 国外佣金算什么费用比较好
  • 车辆保险费算什么费用
  • 出售固定资产已开票未收款账务处理
  • 发票联遗失的证明怎么开
  • 登记现金日记账收入栏的依据有
  • 工厂用的工具放计入哪个科目
  • 管理费用中的水电费怎么记账
  • 房地产企业房屋私售,银行怎么处理
  • sqlserver批量备份数据库
  • 安装win8.1系统步骤
  • centos配置kdump
  • linuxvim编辑器的用法
  • win8系统怎么样
  • onetouch.exe - onetouch是什么进程 有什么用
  • Win10年度升级版将正式提供暗黑主题 未自定义颜色都会变暗
  • computed缓存
  • node.js连接数据库的代码
  • python处理文本文件代码优化
  • Android SQLite, KopDB 框架学习1——使用
  • 如何将位置信息生成二维码
  • javascript面向对象编程指南
  • 土地税源编码怎么填
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设