Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift2 SQLite.swift 2-在联接表中选择带有*from的表的所有列_Swift2_Sqlite.swift - Fatal编程技术网

Swift2 SQLite.swift 2-在联接表中选择带有*from的表的所有列

Swift2 SQLite.swift 2-在联接表中选择带有*from的表的所有列,swift2,sqlite.swift,Swift2,Sqlite.swift,我试图在select函数的帮助下,从联接的SQLite.swift table语句中的表中选择所有列,但我总是遇到以下错误: Cannot invoke 'select' with an argument list of type '(Expression<Void>)' 无法使用类型为“(表达式)”的参数列表调用“选择” 下面是产生错误的演示代码: let messageId = Expression<String>("id") let messageContent

我试图在select函数的帮助下,从联接的SQLite.swift table语句中的表中选择所有列,但我总是遇到以下错误:

Cannot invoke 'select' with an argument list of type '(Expression<Void>)'
无法使用类型为“(表达式)”的参数列表调用“选择”
下面是产生错误的演示代码:

let messageId = Expression<String>("id")
let messageContent = Expression<String>("content")
let messageGroupId = Expression<String>("group_id")

let groupId = Expression<String>("id")
let groupName = Expression<String>("name")

if let db = try? Connection()
{
    let messageTable = Table("message")
    let groupTable = Table("group")


    try! db.run(messageTable.create() { t in
        t.column(messageId, primaryKey: true)
        t.column(messageContent)
        t.column(messageGroupId)
    })

    try! db.run(groupTable.create() { t in
        t.column(groupId, primaryKey: true)
        t.column(groupName)
    })


    let query = messageTable
        .join(groupTable, on: messageTable[messageGroupId] == groupTable[groupId])
        .filter(messageTable[messageGroupId] == "SOME GROUP ID")
        .select(messageTable[*])    // THIS SELECT IS CAUSING AN ERROR - WHAT IS WRONG?
}
let messageId=表达式(“id”)
让messageContent=表达式(“内容”)
让messageGroupId=表达式(“组id”)
设groupId=表达式(“id”)
让groupName=表达式(“名称”)
如果让db=try?连接()
{
让messageTable=Table(“消息”)
设groupTable=表(“组”)
试试!db.run(messageTable.create(){t in
t、 列(messageId,primaryKey:true)
t、 列(messageContent)
t、 列(messageGroupId)
})
try!db.run(groupTable.create(){t in
t、 列(groupId,primaryKey:true)
t、 列(组名)
})
let query=messageTable
.join(groupTable,on:messageTable[messageGroupId]==groupTable[groupId])
.filter(messageTable[messageGroupId]=“某些组ID”)
.select(messageTable[*])//此选择导致错误-发生了什么错误?
}
当我尝试使用星号(表的所有字段)时,选择函数的最后一次调用总是导致错误。有没有什么方法可以使用星形运算符而不单独列出所有字段

我使用的是Xcode 7.0.1,也许这在swift 2.1的7.1中得到了修复