Android sqlite3_limit?

I would like to use the sqlite3_limit function to set the maximum number of attached databases.

sqlite3_limit(db, SQLITE_LIMIT_ATTACHED, 62); 

Question 1 - How (if at all) can I perform this operation in Android?


I read here http://sqlite.org/limits.html - paragraph 11.

By default, there is a soft limit of 10 attached databases, however I just connected 11 databases successfully.

Question 2 - What is the default behavior for Max Attached Databases on Android? - Is it set by the hard limit imposed by SQlite3 62? If so, that’s all I need.

Thanks y'all

+4
source share
1 answer

sqlite3_limit can only be used to limit:

Runtime limits are intended for use in applications that manage both their own internal database and databases that are controlled by unreliable external sources. [...] Internal databases may be subject to large default restrictions. Databases managed by external sources can be provided with much less restrictions designed to prevent a denial of service attack.

The hard limit is set by the SQLITE_MAX_ATTACHED symbol when compiling SQLite:

For each SQLITE_LIMIT_NAME limit category, there is a complex upper bound set at compile time by a C preprocessor macro called SQLITE_MAX_NAME. [...] Attempts to increase the limit above its rigid upper boundary are silently truncated to a rigid upper boundary.

It looks like the provider has really increased the hard limit on your Android device, but you have no guarantee that this is the case on all other devices.

+4
source

All Articles