SQlite Swift意外结果组

时间:2016-06-29 09:26:12

标签: swift sqlite sqlite.swift

我正在使用Swift SQLite。我想要检索航班'在小组中切换他们的离开日期'

    if let flightQuery = self.flightQuery, let dataBase = self.db {

        let flightGroupByDepartureDate = flightQuery.group(self.departureDate)

        do {

            let flightFromDB = try dataBase.prepare(flightGroupByDepartureDate)

            let flightGroups = Array(flightFromDB)

            AppLog.i("flightGroups count \(flightGroups.count)")
            // print 2 : Good

            // So we have 2 groups of Flight
            // Each group got 2 flights
            // I simulate the result with static values

            for flighGroup  in flightGroups  {

                AppLog.i("flightGroups count \(Array(arrayLiteral: flighGroup).count)")
                // print 1 : Wrong !
            }

        }catch{

            AppLog.e("fail findFlightByDepartureDate" )
        }
    }

当我打印flightGroups时,我发现只有2个航班而不是2个航班阵列

0 个答案:

没有答案