Thereisnoactive transaction的异常 DB::table('users')->delete(); DB::table('users')->truncate(); 我使用delete的表,才没有问题,我就好奇deletetruncate的区别TRUNCATETABLE在功能上与不带WHERE子句的DELETE语句相同:二者均删除表中的全部行。但TRUNCATETABLE比DELETE速度快,且使用的系统和事务日志资源少。DELET...
令龙小道10 声望
最近有个项目用到了最新的TP3.2.5,发现有个报错:There is no active transaction,后来定位分析到是TP代码bug,由于官方已经不维护且无法提交issue,故做此记录。 测试代码: 1try{2$uModel= M('Users');3$uModel->startTrans();4$userInfo=$uModel->where(['user_id' => 0])->find();5if(empty($user...
ERR: There is no active transaction 刚开始以为是数据表引擎不对造成的,因为 有几张表的引擎是 MyISAM,后来调整过来了,改为 InnoDB,还是报错。应该是TP 底层连数据库时,切换数据库连接时出了点问题,解决方案如下: 打开文件 ThinkPHP/Library/Think/Db/Driver.class.php,调整内容如下: /** * 启动事务 * *...
There is no active transaction,这个问题出现在一个update方法里,大致是 function update() { $this->db->beginTrans(); try { dosomething(); $this->db->commitTrans(); } catch (\Exception $ex) { this->db->rollBackTrans(); throw $ex; } }...
类型问题 现象php8 在事务中使用dbexecute 执行sql 时报错 “There is no active transaction”添加内容时,在模型中使用了事件,事件的内容是添加内容...
Here's my seeder from Laravel 10 the idea of it is to auto-fill a list to the DB, and when I add more items to it, it will replace the old list, simple as that, but obviously a transaction makes sense. DB::transaction(function (){
thinkPHP 出现route不起作用提示No input file specified. 2019-12-19 16:34 −修改.htaccess文件 原因在于使用的PHP是fast_cgi模式,而在某些情况下,不能正确识别path_info所造成的错误。 打开.htaccess 在RewriteRule 后面的index.php教程后面添加一个“?” 如下: <IfModule mod_r... ...
Problem When performing migrations, the process ends with "There is no active transaction" thrown in Connection.php on line 1761. The migrations themselves are performed successfully: the database schema appears to be altered as expected...
Under PHP 8 there is Exception thrown, when transaction was autocommited. PDOException: There is no active transaction This is the change in PHP sources: php/php-src@990bb34 Ideal would be not to throw the exception if transaction was al...