简体   繁体   English

Swift FMDB修改器

[英]Swift FMDB modifiers

where are the modifiers for SQL FMDB described ? SQL FMDB的修饰符在哪里描述? In particular, how do I place a quote within a string I wish to insert. 特别是,如何在要插入的字符串中放置引号。 Such as I wish to insert name "Mac's Place" into the database ? 例如我希望在数据库中插入名称“ Mac's Place”? thanks 谢谢

If you use executeUpdate with ? 如果将executeUpdate? placeholders in the SQL and then supply the parameters as arguments in the array, you don't have to quote the special characters in the string. SQL中的占位符,然后将参数作为数组中的参数提供,您不必在字符串中引用特殊字符。 For example, you can: 例如,您可以:

if !db.executeUpdate("insert into restaurants (name) values (?)", withArgumentsInArray: ["Mac's Place"]) {
    println(db.lastErrorMessage())
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM