位置: 编程技术 - 正文

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)

  • 小规模纳税人所得税优惠政策2023
  • 定期定额户个人所得税怎么申报
  • 用于职工住宿的会计科目
  • 企业公益性捐赠支出税前扣除标准
  • 酒店里的水电费怎么收
  • 收到进项专用发票怎么做
  • 公司过桥贷款怎么贷
  • 销售时无法确认发票
  • 三代税款手续费申请流程
  • 0申报的清算所得税申报表怎么填
  • 普通发票费用会计分录
  • 经营终止前企业资质变更
  • 应交增值税怎么做账务处理
  • 公司所得税汇算清缴退税流程
  • 年所得12万元以上的纳税人,在纳税年度终了后
  • 银行承兑汇票承兑手续费是多少
  • 递延收益在现金流量表体现吗
  • 实收资本的期初余额在借方还是贷方
  • 无法设置面容id怎么办
  • 鸿蒙智能充电模式怎么用
  • 华为鸿蒙系统怎么样
  • 支付境外特许权许可使用费资料
  • 刷信用卡没手续费
  • 出售提完折旧的固定资产怎么记账
  • 怎样提取word中的图片
  • hp是什么代码
  • cda是什么文件格式
  • 从对公账户取现金有什么影响
  • 增值税发票月末怎么账务处理
  • 增值税纳税人兼营免税减税项目的
  • php模板引擎语法
  • php字符串在另一个字符串出现
  • 设计部工资计入什么费用
  • 增值税报税后多久缴纳期限
  • 小规模纳税人的企业所得税怎么算
  • 电子发票冲红后对方能查到吗
  • 租赁房产税如何交税
  • pythonsorted函数的作用
  • dedecms官网
  • 企业单方面调整员工的工作岗位
  • python怎么运行程序
  • 百度 编辑器
  • 一般纳税人零申报怎么报税步骤
  • 当月没有发放工资是不是就不用申报个税
  • 银行主账户和子账户能独立使用吗
  • 全年一次性奖金单独计税还是并入
  • 负债类会计科目新增科目包括
  • 委托代销业务的会计分录
  • 零售商品收入
  • 应付账款的账务怎么处理
  • 小规模30万含专票吗
  • 换工作后个税app单位会自动更改吗
  • 让渡是什么
  • 土地发票可以抵扣吗
  • 小微企业免征增值税优惠
  • mysql存文章的字段设置为多大?
  • mac电脑双系统
  • freebsd12安装
  • 微软mission
  • centosuuid
  • centos5.4 安装
  • 32.exe 什么病毒
  • xp系统下载文件没有出现下载对话框让你选择保存的位置
  • 无法安装osx
  • centos7取消挂载硬盘
  • 优化linux系统的方法
  • win10一周年版本
  • window10 弹窗广告
  • perl cgi
  • Shell脚本监控日志 出现关键字 grep提醒
  • jquery窗口
  • javascript基础笔记
  • html读书笔记
  • 全屏沉浸式
  • django返回json数据
  • css图片渐变效果
  • node express 路由
  • 电子税务局增值税申报表下载
  • 企业的财务是什么
  • steam充值码生成
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设