位置: 编程技术 - 正文

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

  • 非居民企业享受协定待遇
  • 计提税费会计分录怎么填
  • 个体工商户营业执照年检网上申报
  • 企业裁员补偿金标准是多少
  • 城市生活垃圾费是业主出还是物业出
  • 财付通转账手续费多少
  • 哪些产品计算消费税时可以扣除
  • 购进原材料验收入库,贷款商业汇票结算
  • 企业店铺开发票可以要求补税点吗?
  • 利润表中所得税费用为负数是什么意思
  • 年底自查
  • 城市生活垃圾处理与资源化利用工艺设计
  • 公司买的食用油会计分录
  • 汇总记账凭证账务处理程序的优点包括
  • 辅导期纳税人预缴增值税
  • 公司给员工定任务合法吗
  • 小规模纳税人专票如何申报
  • 企业债券投资利息怎么算
  • 建筑业一般纳税人简易计税和一般计税
  • 两家企业共用一个厂区
  • apple mac 系统
  • 天猫魔合
  • win10开机强制进入安全模式重置
  • 滞纳金不得超过税款
  • 华盛顿州帕卢斯心雕塑
  • 建筑企业取得发票难
  • 预付装修款账务处理
  • phppublic function
  • 经营租入的设备为什么不属于资产
  • yii2整合百度编辑器umeditor及umeditor图片上传问题的解决办法
  • 房地产公司活动方案
  • 劳保用品会计科目进什么科目
  • python导入其他文件的函数
  • php时间戳转换成时间
  • mysql分表数量取决于什么
  • 企业转让应收账款分录
  • python3 zipfile模块
  • mongodb使用场景 简书
  • 金税盘发票报送失败怎么办
  • 差旅费适用税率
  • sql server 2005安装失败
  • 建筑公司收到劳务发票会计分录
  • 建筑附加税税率
  • 企业接受捐赠固定资产的运费怎么做账
  • 银行的存单丢失了可以补办吗
  • 最新减免税申报表填写举例
  • 残疾人就业保障金怎么计算
  • 计提租金如何做账务处理
  • 进项大于销项月末怎么处理
  • 买车能不交税吗
  • 农产品成本包含所消耗的物资费用
  • 公司购买的打印机附赠给客户进项税可以抵扣吗
  • 发票认证完了该怎么取消
  • 新开公司没有领失业金
  • 公司利润太高了怎么办
  • 民办幼儿园如何生存
  • 工业企业外购材料采购成本包括
  • ubuntu16.04终端在哪
  • 不小心修改了注册表怎么还原
  • 怎样设置禁
  • linux系统中的一切都归结为
  • win7如何设置电脑输入法
  • 无法打开文件exe
  • win10更新到win11
  • win7怎么设置最佳性能
  • win7小技巧
  • 安卓注入工具
  • python import同一目录的其他文件
  • js domcontentloaded
  • 安卓wifimanager详解
  • shell脚本怎么导出
  • nodejs quic
  • 简述javascript
  • js md5加密方法
  • 网络很强大
  • 第二章,动态添加按钮(Android)
  • 进项税额转出应交税费吗
  • 杭州市税务局副局长
  • 增值税专用发票电子版
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设