当表已经存在时,Ionic-Orm没有这样的列

时间:2018-10-15 14:26:37

标签: typescript ionic-framework orm ionic3 typeorm

我正在尝试使用创建查询生成器功能来创建查询,但是每当我尝试搜索未找到的列时,它都会一直告诉我,而且我很确定该列存在,因为当我打印表格时控制台的实体,该列中有我要搜索的值,但它一直告诉我没有这样的列

我正在使用ionic-orm连接到手机存储上的sqlite离线数据库

TS:

onShowFilter(event: MouseEvent){
const popover = this.popOver.create(SearchFilterPage);
popover.present({ev: event});
popover.onDidDismiss((searchObj) => {
  let connection = getConnection();
  let equipmentRepository = connection.getRepository(Equipments);
  console.log(searchObj);
 let searchResult = equipmentRepository.createQueryBuilder('equipment')
 .where('equipment._id='+searchObj._id)
 .andWhere('equipment.serial_number='+searchObj.serial_number)
 .andWhere('equipment.standard='+searchObj.standard)
 .andWhere('equipment.inspection_location='+searchObj.inspection_location)
 .andWhere('equipment.equipment_type='+searchObj.test_type)
 .andWhere('equipment.created_at='+searchObj.created_at)
 .andWhere('equipment.authenticator='+searchObj.authenticator)
 .andWhere('equipment.due_date='+searchObj.due_date)
 .andWhere('equipment.inspection_date='+searchObj.inspection_date)
 .getResults();
 console.log(searchResult);
 searchResult.then(res => {
  console.log(res);
  this.equipments = res;

searchObj数据正确,我可以通过搜索过滤器组件成功获取它,我可以使用_id,standard和serial_number进行搜索,但是当我尝试其他任何列时,它都告诉我没有这样的列!

我打开了数据库,发现我要搜索的列存在并且具有我要搜索的值。

我尝试从一开始就删除数据库并创建表,但是我可以看到相同的东西,相同的错误。

有任何疑问或信息可随时询问。

0 个答案:

没有答案
相关问题