位置: 编程技术 - 正文

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)

  • 山西省税务申报网站
  • 出差补贴需要纳税吗
  • 公司主营销售墓地合法吗
  • 现金存银行会计分录
  • 所得税申报表收入
  • 废机油处理多少钱一吨
  • 小规模纳税人普票和专票怎么交税
  • 一般纳税人加计抵减申报表怎么填
  • 农产品收购发票可以跨区域开吗
  • 出版产品
  • 购销合同印花税优惠政策
  • 哪些企业可以享受加计抵减政策
  • 将自产产品赠送他人
  • 租地协调费没发票怎么入账?
  • 股东投入固定资产进来怎么做账
  • 借款合同印花税纳税期限
  • 保费收入包含
  • 备用金 退款
  • 旧房转让土地增值税核定
  • 税前金额是不含税金额
  • 城市维护建设税属于什么科目
  • 暂估固定资产原值减少
  • 以现金收回已核销的不良贷款分录?
  • 苹果14如何强制关机重启
  • linux耳机插拔检测
  • 小规模纳税人减免增值税的优惠政策
  • pcas service进程可以关闭么
  • 大金中央空调面板图解
  • 禁止input标签输入
  • 收到业绩补偿会扣税吗
  • 应收账款需要计提损失准备吗
  • ssm算前后端分离吗
  • 今日清明节的下一句是什么
  • reactz
  • 基训包括哪些
  • 自产赠送视同销售的成本怎么确定
  • 公司股权转移怎么办理
  • 每个季度30万免增值税
  • 社保基数怎么申请下调
  • 办理银行承兑汇票保证金比例
  • 公司租个人房屋交什么税
  • 汇票收入会计分录
  • 企业送员工礼品怎么分享给团队
  • 加计抵减会计分录其他收益
  • sql server自动生成行号
  • 购入房产会计记账凭证怎么做
  • 从内地到香港坐飞机到国内
  • 计提税金用什么附件
  • 印花税的计算公式应纳税所得额包含增值税吗
  • 跨年度未开发票第二年如何做确认收入?
  • 应交税费借方余额填列资产负债表
  • 怎么查企业适用的会计准则
  • 签劳动合同的员工有哪些
  • 直接费用的定义
  • sql server触发器实验
  • win10小娜语音激活
  • linux共享
  • 怎么解决xp不能安装软件
  • ubuntu无线网卡驱动离线安装
  • ubuntu命令行调节音量
  • Win7系统启动密码
  • linux手动设置ip指令
  • win10系统资源管理器怎么重新安装
  • windows7怎么禁用网络
  • window10显示重启提示
  • Screen.sleepTimeout=SleepTimeOut.NeverSleep 禁止屏幕锁屏
  • 教你怎样用竹子搭棚子
  • 批处理文件.bat
  • ajax读取json
  • shell线程操作命令
  • JavaScript function函数种类详解
  • 粒子特效优化
  • 简述javascript中的函数
  • python守护线程与非守护线程
  • 税务局 章
  • 税务上成品油换算
  • 汽车购车发票开完票能更改名字吗?
  • 河北保定地税局官网
  • 车辆整备质量怎么填
  • 税务主管机关有哪些
  • 免责声明:网站部分图片文字素材来源于网络,如有侵权,请及时告知,我们会第一时间删除,谢谢! 邮箱:opceo@qq.com

    鄂ICP备2023003026号

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

    友情链接: 武汉网站建设