位置: 编程技术 - 正文

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

  • 正常工资薪金包括年终奖吗
  • 工业企业取得土地使用权专用发票可以抵扣吗?
  • 高新技术企业三级领域
  • 个体工商户网上注销
  • 申报时入库税款怎么入账
  • 科技型中小企业条件
  • 在建工程预转固申请表
  • 出租不动产房屋交什么税
  • 税控软件维护
  • 外请人员所发生的费用怎么做账
  • 品牌使用费的账务处理
  • 财产租赁所得个人所得税计算方法2020
  • 三证合一后新老税号不符合
  • 高新技术企业研发费
  • 进项不够怎么避税
  • 建安企业劳务成本怎么入账
  • 环评费用计入哪个会计科目
  • 发放的离职补偿金怎么做账
  • 房地产税开征的利弊分析
  • 工商注销债务承担
  • 做内账收入含税吗
  • 拍卖的物品
  • 文件的类型可以通过什么来区分
  • 财政拨款收入属什么科目
  • 企业违章行为
  • 当期费用包括哪些科目
  • 公司租的宿舍记什么科目
  • 营改增后甲供材的账务处理
  • 普通发票丢了如何入账
  • 视同销售计税价格如何确定
  • php addslashes函数
  • 存货的原材料分析
  • 在Windowsserver2019环境下,配置IP地址使用
  • 深度学习实战10-数学公式识别-将图片转换为Latex(img2Latex)
  • 下列项目的进项税额可从销项税
  • ChatGPT遭禁用、抵制后又停止Plus付费发生了?
  • 材料明细帐
  • 帝国cms模板文件在哪
  • 支付银行手续费等直接收费金融服务
  • 织梦怎么样
  • MYSQL数据库设计与应用第二版
  • 代开专票的个税减免吗?
  • 承兑汇票大回头是什么意思
  • 小企业的固定资产的折旧方法可以根据需要
  • 淘宝电子发票怎么申请
  • 业务招待费的所得税扣除
  • 小型微利企业免税销售额是多少
  • 融资租赁缴纳什么税
  • 固定资产入账怎么做凭证和入资产卡片?
  • 应付账款抹零摘要怎么写
  • 工资走公账有什么好处
  • 增值税多缴税款可以抵缴以后
  • 差额事业单位的工资是由财政开支吗
  • 建筑施工企业如何预缴增值税税款
  • 什么税能计入税额
  • 收款人是否应当承担还款责任
  • 土地使用权属于无形资产吗
  • 对公账户可以转让吗
  • 退回多交的所得税怎么退
  • 倒卖承兑汇票被判刑
  • 应付职工薪酬的会计科目
  • 加计扣除要交企业所得税吗
  • 企业公司制改建的有关规定
  • 猛料高手
  • 删除了c盘文件
  • 如何修改windows注册表
  • 主板bios无法重置
  • windows 8.1更新
  • paytime.exe - paytime是什么进程 有什么用
  • win8切换到桌面
  • python中myf
  • java script教程
  • nodejs内置的包管理器
  • nodejs 异步任务队列
  • javascript开发app教程
  • Nodejs之http的表单提交
  • 下午税务局几点上班
  • 农业部利剑行动
  • 怎么使用企业级app
  • 国家税务总局2011年34号公告
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设