FMDB query isn't acting right with LIKE

前端 未结 1 1004
不思量自难忘°
不思量自难忘° 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)
提交回复
热议问题