FMDB query isn't acting right with LIKE

前端 未结 1 1007
不思量自难忘°
不思量自难忘° 2021-01-04 07:20

I am using FMDB, which is a wrapper for SQLite. http://github.com/ccgus/fmdb

Here is my query line:

FMResultSet *athlete = [db executeQuery:@\"SELECT         


        
相关标签:
1条回答
  • 2021-01-04 07:39

    The wildcard characters (%) have to be part of the substituted variable, not the query string:

    FMResultSet *rs = [db executeQuery:@"SELECT * FROM athletes WHERE athlete_name LIKE ?",
                      [NSString stringWithFormat:@"%%%@%%", search_text]];
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题