_错误字段错误:未知列';表';在';字段列表';有异议。js+;mysql
我使用mysql数据库和Objective.js来处理我的数据库操作。当我尝试插入值时,我得到了R_BAD_FIELD_ERROR:“FIELD list”中的未知列“table”。这是我用于插入数据的代码_错误字段错误:未知列';表';在';字段列表';有异议。js+;mysql,mysql,node.js,knex.js,objection.js,Mysql,Node.js,Knex.js,Objection.js,我使用mysql数据库和Objective.js来处理我的数据库操作。当我尝试插入值时,我得到了R_BAD_FIELD_ERROR:“FIELD list”中的未知列“table”。这是我用于插入数据的代码 Modelclass.query() .insert( { storeId: xxxxxx, itemLocalName: 'LSストレ', itemCode: xxxxxx, itemType: '', skus: xxxxxx, itemLevel: 'L2', colorCod
Modelclass.query()
.insert( { storeId: xxxxxx,
itemLocalName: 'LSストレ',
itemCode: xxxxxx,
itemType: '',
skus: xxxxxx,
itemLevel: 'L2',
colorCode: '99',
colorName: 'Other',
regionCode: 'jqs' } )
.then(function () {
console.log( 'inserted' );
}).catch( function( err ) {
console.log( 'error while inserting, error : ' + err );
});
生成的查询是:
insert into `sampleTable` (`colorCode`, `colorName`, `itemCode`, `itemLevel`,
`itemLocalName`, `itemType`, `regionCode`, `skus`, `storeId`, `table`)
values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )'
}
插入时出错:
insert into `sampleTable` (`colorCode`, `colorName`, `itemCode`, `itemLevel`,
`itemLocalName`, `itemType`, `regionCode`, `skus`, `storeId`, `table`)
values ('99', 'Other', 'xxxxxx', 'L2', 'LSストレ', '','jqs', 'xxxxxx', 'xxxxxx', 'sampleTable')
表字段包含在objective.js中,它不在我的sampleTable中
请帮助我解决此问题。您的模型定义中添加了
表
列。反对并不能做到这一点。不看模型就不可能告诉你它是什么,但我有几个想法:
$formatDatabaseJson
方法,则可能是意外地添加了该列