SQLite Forum

SQLITE_MAX_ATTACHED;
Login

SQLITE_MAX_ATTACHED;

(1) By AAsk (aa2e72e) on 2020-09-04 13:32:40 [source]

How do I query the value of SQLITE_MAX_ATTACHED from the CLI?

(2) By Warren Young (wyoung) on 2020-09-04 14:37:50 in reply to 1 [link] [source]

Say:

  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.

(3) By AAsk (aa2e72e) on 2020-09-04 15:17:27 in reply to 2 [link] [source]

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?

(4) By Warren Young (wyoung) on 2020-09-04 15:39:26 in reply to 3 [link] [source]

As I said, if you didn't override it, then you get the default.

(5) By Keith Medcalf (kmedcalf) on 2020-09-04 21:50:01 in reply to 3 [link] [source]

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.

https://sqlite.org/c3ref/limit.html

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.

(6) By Keith Medcalf (kmedcalf) on 2020-09-04 21:57:01 in reply to 3 [link] [source]

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.