project-imas / encrypted-core-data

v2.0 - iOS Core Data encrypted SQLite store using SQLCipher
Other
785 stars 236 forks source link

Use keys in dictionary if value for IN operator #301

Open jeffdgr8 opened 6 years ago

jeffdgr8 commented 6 years ago

This is the way the default NSSQLiteStoreType behaves. Iterating over an NSDictionary iterates over its keys as well.

Currently, if a dictionary is used as the value for IN in a predicate, it creates SQL: SELECT ... FROM ... WHERE (... IN ?); and produces the error could not prepare statement: near "?": syntax error.

With these changes, the SQL is: SELECT ... FROM ... WHERE (... IN (?, ?, ...));, where the bindings for ?, ?, ... are the dictionary's keys.