Join SQLite.swift(swift 2.0)联接未显示所有字段

Join SQLite.swift(swift 2.0)联接未显示所有字段,join,swift2,sqlite.swift,Join,Swift2,Sqlite.swift,在将应用程序迁移到swift2时,我在创建与SQLite.swift的联接时遇到问题 在这种情况下,在1.2中运行完美的东西在2.0中不起作用。可能是一个bug,也可能只是更新语法的问题,但无法解决 我正在执行几个表的联接: // Prep tables let equipment = Table("Equipment") let equ_id = Expression<Int>("Equipment_ID") let equ_type = Expre

在将应用程序迁移到swift2时,我在创建与SQLite.swift的联接时遇到问题

在这种情况下,在1.2中运行完美的东西在2.0中不起作用。可能是一个bug,也可能只是更新语法的问题,但无法解决

我正在执行几个表的联接:

    // Prep tables
    let equipment = Table("Equipment")
    let equ_id = Expression<Int>("Equipment_ID")
    let equ_type = Expression<Int>("EquipmentType_ID")
    let equ_owner = Expression<Int>("Equipment_Owner_ID")
    let equ_manufacturer = Expression<String>("Manufacturer")
    let equ_model = Expression<String>("Model")
    let equ_serial = Expression<String>("Serial")
    let equ_notes = Expression<String>("Notes")
    let equ_facid = Expression<Int>("Facility_ID")
    let equ_depid = Expression<Int>("Department_ID")
    let equ_cctid = Expression<Int>("CostCenter_ID")
    let equ_location = Expression<String>("Location_Details")
    let equ_status = Expression<Int>("Status")
    let equ_esttime = Expression<Int>("Planned_Maint_Est_Time")

    let facilities = Table("Facilities")
    let fac_id = Expression<Int>("Facility_ID")
    let fac_name = Expression<String>("Facility_Name")

    let equipment_type = Table("EquipmentTypes")
    let eqt_id = Expression<Int>("EquipmentType_ID")
    let eqt_type = Expression<String>("Equipment_Type")

    let preUsers = Table("PreUsers")
    let Worker_ID = Expression<Int>("Worker_ID")
    let First_Name = Expression<String>("First_Name")
    let Last_Name = Expression<String>("Last_Name")
    let Login = Expression<String>("Login")
    let Client_ID = Expression<Int>("Client_ID")
    let Company_ID = Expression<Int>("Company_ID")
    let Date_LastLogin = Expression<NSDate>("Date_LastLogin")

    // Load Initial Equipment Table

    let ext_equipment = equipment.join(equipment_type, on: equipment_type[eqt_id] == equipment[equ_type])
        .join(facilities, on: facilities[fac_id] == equipment[equ_facid])
        .join(preUsers, on: preUsers[Worker_ID] == equipment[equ_owner])
        .order(equ_model)
        .filter(equ_status >= 0)
我还尝试将语法修改为:

        eqTemp.eq_FacilityID = item.get(facilities[fac_id])
        eqTemp.eq_Facility = item.get(facilities[fac_name])
但还是没有运气

抛出一个致命错误:

fatal error: no such column '"Facilities"."Facility_ID"' in columns:

[
"Expression<()>(template: \"\\\"EquipmentTypes\\\"\", bindings: []).\"Client_ID\"", 
"Expression<()>(template: \"\\\"EquipmentTypes\\\"\", bindings: []).\"EquipmentType_ID\"", 
"Expression<()>(template: \"\\\"EquipmentTypes\\\"\", bindings: []).\"Equipment_Type\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Client_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"CostCenter_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_Created\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_Decomisioned\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_LastMaintenance\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_NextMaintenance\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_of_First_Use\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Date_of_Purchase\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Default_Priority\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Department_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"EquipmentType_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Equipment_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Equipment_Owner_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Facility_ID\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Location_Details\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Maintenance_Peridicity\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Manufacturer\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Model\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Notes\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Planned_Maint_Est_Time\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Purchase_Price\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Safety_Inspection_Only\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Serial\"", 
"Expression<()>(template: \"\\\"Equipment\\\"\", bindings: []).\"Status\"", 
"Expression<()>(template: \"\\\"Facilities\\\"\", bindings: []).\"Facility_ID\"", 
"Expression<()>(template: \"\\\"Facilities\\\"\", bindings: []).\"Facility_Name\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Client_ID\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Client_Identify\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Company_ID\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Date_LastLogin\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"First_Name\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Last_Name\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Login\"", 
"Expression<()>(template: \"\\\"PreUsers\\\"\", bindings: []).\"Worker_ID\""
]: 
返回:

SELECT * FROM "Equipment" INNER JOIN "EquipmentTypes" ON ("EquipmentTypes"."EquipmentType_ID" = "Equipment"."EquipmentType_ID") INNER JOIN "Facilities" ON ("Facilities"."Facility_ID" = "Equipment"."Facility_ID") INNER JOIN "PreUsers" ON ("PreUsers"."Worker_ID" = "Equipment"."Equipment_Owner_ID") WHERE ("Status" >= 0) ORDER BY "Model"

任何帮助都将不胜感激

这是一个bug,应该修复@stephencelis它是固定的,工作起来像个符咒。谢谢你这么好的周转时间
[...]
"Expression<()>(template: \"\\\"Facilities\\\"\", bindings: []).\"Facility_ID\"", 
"Expression<()>(template: \"\\\"Facilities\\\"\", bindings: []).\"Facility_Name\"",
[...]
print(ext_equipment.asSQL())
SELECT * FROM "Equipment" INNER JOIN "EquipmentTypes" ON ("EquipmentTypes"."EquipmentType_ID" = "Equipment"."EquipmentType_ID") INNER JOIN "Facilities" ON ("Facilities"."Facility_ID" = "Equipment"."Facility_ID") INNER JOIN "PreUsers" ON ("PreUsers"."Worker_ID" = "Equipment"."Equipment_Owner_ID") WHERE ("Status" >= 0) ORDER BY "Model"