Tectrendz
Tectrendz

Reputation: 1454

Do we have a way to limit database size in sqllite?

Below is some code that creates a sqlite database. Is there a way to limit the maximum size this database can grow to ?

int i, r;
sqlfs_t *sql_fs = calloc(1, sizeof(*sql_fs));
assert(sql_fs);
for (i = 0; i < (int)(sizeof(sql_fs->stmts) / sizeof(sql_fs->stmts[0])); i++)
{
    sql_fs->stmts[i] = 0;
}
r = sqlite3_open(db_file, &(sql_fs->db));
if (r != SQLITE_OK)
{
    fprintf(stderr, "Cannot open the database file %s\n", db_file);
    return 0;
}

Upvotes: 1

Views: 84

Answers (1)

CL.
CL.

Reputation: 180080

The documentation says:

PRAGMA max_page_count = N;

set the maximum number of pages in the database file.

(This setting applies to the connection; it is not permanent.)

Upvotes: 1

Related Questions