批处理持久时出错

时间:2013-04-30 14:16:28

标签: mysql doctrine

我正在尝试使用Doctrine执行看似简单的过程,但是我一直收到错误

带有消息'SQLSTATE [42000]的未捕获异常'PDOException':语法错误或访问冲突:1064 SQL语法中有错误;检查与MySQL服务器版本对应的手册,以便在'column(column_label)VALUES('Asset')附近使用正确的语法

我没有看到我出错的地方,有人能指出我吗

$columnLabels[0] = "Asset";
$columnLabels[1] = "Number Of Unit";
$columnLabels[2] = "Uptime";
$columnLabels[3] = "Standby";
$columnLabels[4] = "Downtime";
$columnLabels[5] = "Consumption";
$columnLabels[6] = "Co2 Emissions";
$columnLabels[7] = "Total Cost";

for( $i = 0; $i < count($columnLabels); $i++ ){
    $column = new Column();
    $column->setColumnLabel( $columnLabels[$i] );
    $entityManager->persist($column);
}

$entityManager->flush();
$entityManager->clear();

$entityManager->getConfiguration()->setSQLLogger(new \Doctrine\DBAL\Logging\EchoSQLLogger());

谢谢,Caius。

1 个答案:

答案 0 :(得分:0)

列不能用作SQL

中的表名