我尝试在Yii应用程序中执行多个SQL插入:
INSERT INTO take_lf (data, start, end)
VALUES ('take1.csv', '0', '0'), ('take2.csv', '0', '0'), ('take3.csv', '0', '0')
执行查询(我可以在PhpMyAdmin上看到结果)但我在Yii上收到错误:
CDbCommand failed to execute the SQL statement: SQLSTATE[HY000]: General error
有谁知道可能是什么问题?我在Status->监视器上查找了PhpMyAdmin日志,但我找不到任何内容。
编辑:跟踪如下。
#0 /volume1/web/yii/framework/db/CDbCommand.php(395): CDbCommand->queryInternal("fetchAll", array(2), array())
#1 /volume1/web/dbcremona/protected/controllers/TakeLF.php(253): CDbCommand->queryAll()
251 }
252 $sql = substr($sql, 0, -1); //tolgo ultima virgola
253 $r = Yii::app()->db->createCommand($sql)->queryAll();**
254 echo $r;
255 }
256
257 /**
258 * Returns the data model based on the primary key given in the GET variable.
#2 /volume1/web/yii/framework/web/actions/CInlineAction.php(49): TakeLFController->actionInsert_multiple()
#3 /volume1/web/yii/framework/web/CController.php(308): CInlineAction->runWithParams(array("r" => "takeLF/insert_multiple"))
#4 /volume1/web/yii/framework/web/filters/CFilterChain.php(133): CController->runAction(CInlineAction)
#5 /volume1/web/yii/framework/web/filters/CFilter.php(40): CFilterChain->run()
#6 /volume1/web/yii/framework/web/CController.php(1145): CFilter->filter(CFilterChain)
#7 /volume1/web/yii/framework/web/filters/CInlineFilter.php(58): CController->filterAccessControl(CFilterChain)
#8 /volume1/web/yii/framework/web/filters/CFilterChain.php(130): CInlineFilter->filter(CFilterChain)
#9 /volume1/web/yii/framework/web/CController.php(291): CFilterChain->run()
#10 /volume1/web/yii/framework/web/CController.php(265): CController->runActionWithFilters(CInlineAction, array("accessControl", "postOnly + delete"))
#11 /volume1/web/yii/framework/web/CWebApplication.php(282): CController->run("insert_multiple")
#12 /volume1/web/yii/framework/web/CWebApplication.php(141): CWebApplication->runController("takeLowFeature/insert_multiple")
#13 /volume1/web/yii/framework/base/CApplication.php(169): CWebApplication->processRequest()