Swift ';比如';FMDB中sqlite查询中的运算符

Swift ';比如';FMDB中sqlite查询中的运算符,swift,sqlite,sql-like,fmdb,Swift,Sqlite,Sql Like,Fmdb,请解释我如何为这样的代码编写LIKE操作符?我在下面编写了代码,但它似乎不适用于FMDB func getsearchStudentData(word:String) -> NSMutableArray { sharedinstance.database!.open() let resultSet: FMResultSet! = sharedinstance.database!.executeQuery("SELECT * FROM student_info WHERE name LIKE

请解释我如何为这样的代码编写
LIKE
操作符?我在下面编写了代码,但它似乎不适用于FMDB

func getsearchStudentData(word:String) -> NSMutableArray {
sharedinstance.database!.open()
let resultSet: FMResultSet! = sharedinstance.database!.executeQuery("SELECT * FROM student_info WHERE name LIKE '%?' ",  withArgumentsInArray: [word])
let sarrStudentInfo : NSMutableArray = NSMutableArray()
if (resultSet != nil) {
    while resultSet.next() {
        let studentInfo : student_info = student_info()
        studentInfo.RollNo = resultSet.stringForColumn("RollNo")
        studentInfo.Name = resultSet.stringForColumn("Name")
        studentInfo.Marks = resultSet.stringForColumn("Mark")
        sarrStudentInfo.addObject(studentInfo)
    }
}
sharedinstance.database!.close()
return sarrStudentInfo           }
斯威夫特3

试试这个

let query = "select \(field_ImageID) from \(imageTag_tableName) where \(field_ImageTag) LIKE ?;"


它的“不工作”是相当模糊的。请提供一些详细信息,描述发生了什么(r没有发生),包括记录的输出的任何错误消息。没有错误,我调试了,但查询刚刚结束,studentInfo没有值,关闭数据库,似乎找不到任何可提供给studentInfo的内容(但我现在有一些数据与我搜索的值一起存在),一切正常,但FMDB似乎对swift语言上的LIKE运算符有一些更改。请使用适当的格式,并解释您发布的代码的作用以及解决问题的原因。这有助于OP和其他人理解您提出的解决方案。
let results = try database.executeQuery(query, values: ["%\(tag)%"])