project-imas / encrypted-core-data

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

SQL variable count too low #274

Open jcavar opened 7 years ago

jcavar commented 7 years ago

Hi, We have recently discovered issue with NSFetchRequest failing because of reaching SQL variable count limit. This can happen when using request in format identifier IN %@, array. Since this library uses sqlcipher, the number is 999: https://github.com/sqlcipher/sqlcipher/blob/master/src/sqliteLimit.h#L136

It seems that is much lower number then used in actual CoreData sqlite. That number seems to be 500000: http://sqlite.1065341.n5.nabble.com/SQLITE-MAX-VARIABLE-NUMBER-td43457.html https://github.com/Yalantis/FastEasyMapping/issues/80

Would it be possible for this library to increase this to some reasonable number (i guess 500000)? This can be done by recompiling or by using: sqlite3_limit(database, SQLITE_LIMIT_VARIABLE_NUMBER, 500000);

jcavar commented 7 years ago

It seems that I was wrong about sqlite3_limit. Limit defined in constant is upper bound limit so there are safety checks to make sure that limit is not exceeded.

jcavar commented 7 years ago

So this needs to be added in podspec I think with GCC_PREPROCESSOR_DEFINITIONS which is better anyway I guess.