如何关闭PDO手柄 [英] How to close a PDO handle

查看:60
本文介绍了如何关闭PDO手柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用PDO来访问PHP中的两个SQLite 3数据库.我想在查询过程中通过重命名来切换数据库文件,但是在打开文件时无法执行此操作,因为它给出了文件正在被另一个进程使用的错误.我尝试关闭持久连接并将句柄设置为null,但均无效.

I'm using PDO to access two SQLite 3 databases in PHP. I want to switch the database files during a query by renaming them but I can't do that while the files are open as it gives an error that the file is being used by another process. I've tried turning off persistent connections and setting the handles to null but neither work.

真的没有办法关闭PDO句柄并释放数据库文件上的锁吗?

Is there really no way to close a PDO handle and release the lock on the database file?

推荐答案

我相信unset($var)可以做到这一点,我在pdo sqlite项目上使用了它,并且它的工作方式就像我想要的那样:)

I believe unset($var) does that, I use it on my pdo sqlite project and it works like I want it to :)

这篇关于如何关闭PDO手柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆