How do I query the value of SQLITE_MAX_ATTACHED from the CLI?
sqlite> pragma compile_options; ... MAX_ATTACHED=20 ...
Beware that this pragma only prints build-time overrides, so if you left the value at its default, you won't get a line for it at all.
I am using the Windows 32-bit pre-compiled binary & had tried what you suggest - it does not include that property.
Any other way of finding out?
As I said, if you didn't override it, then you get the default.
The SQLite CLI is an SQLite Application designed and maintained by the author of the SQLite database engine for performing the rudimentary task of passing SQL commands to the SQLite3 database engine and processing them in a known and deterministic manner independent of the feelings and failings (if they exist) of others who may write other applications which pass SQL commands to the SQLite database engine for processing, for the purpose of allowing diagnostics on the SQLite database engine.
As such it has RUDIMENTARY application features which are designed to allow this goal to be met and is not a "full featured" application for doing anything at all.
The way to determine or change the limit with respect to the number of attached databases permitted by a specific implementation of the SQLite database engine is for the application to use the sqlite3_limit(...) C-API for this purpose.
The current SQLite CLI application has no need to manipulate these limits and therefore does not provide a user interface to do so.
If your application needs to manipulate or determine the operational limits which the SQLite engine was compiled, your application should have recourse to the applicable API for carrying out that task.
Here is a suggestion:
Set a counter to 0. Keep on attaching databases to a connection until you get an error, incrementing the counter by 1 each time you do not get an error. Stop when you get an error that you cannot attach more databases to the connection. The number in the counter is the number of databases, aside from the main database (#0) that can be attached to a connection.
If you have no automated way of doing this you can do it manually by stokes on a piece of scrap paper, or using fingers (and maybe toes as well).
The number you obtain will not "magically change" by itself without outside influence.