dm_db_set_cache_size Function

public function dm_db_set_cache_size(db, pages) result(rc)

Sets database cache size PRAGMA and changes the suggested maximum number of database disk pages that SQLite will hold in memory at once per open database file. Whether or not this suggestion is honored is at the discretion of the Application Defined Page Cache. The default page cache that is built into SQLite honors the request, however alternative application-defined page cache implementations may choose to interpret the suggested cache size in different ways or to ignore it altogether. The default suggested cache size is -2000, which means the cache size is limited to 2048000 bytes of memory. The default suggested cache size can be altered using the SQLITE_DEFAULT_CACHE_SIZE compile-time options. The TEMP database has a default suggested cache size of 0 pages.

If the argument pages is positive then the suggested cache size is set to pages. If the argument is negative, then the number of cache pages is adjusted to be a number of pages that would use approximately abs(pages * 1024) bytes of memory based on the current page size. SQLite remembers the number of pages in the page cache, not the amount of memory used. So if you set the cache size using a negative number and subsequently change the page size (using the PRAGMA page_size command) then the maximum amount of cache memory will go up or down in proportion to the change in page size.

The function returns the following error codes:

  • E_DB_PREPARE if statement preparation failed.
  • E_DB_STEP if step execution failed or no write permission.

Arguments

Type IntentOptional Attributes Name
type(db_type), intent(inout) :: db

Database.

integer(kind=i8), intent(in) :: pages

Disk pages [none] or size if negative [byte].

Return Value integer


Calls

proc~~dm_db_set_cache_size~~CallsGraph proc~dm_db_set_cache_size dm_db_set_cache_size interface~dm_db_pragma_set dm_db_pragma_set proc~dm_db_set_cache_size->interface~dm_db_pragma_set

Called by

proc~~dm_db_set_cache_size~~CalledByGraph proc~dm_db_set_cache_size dm_db_set_cache_size proc~dm_db_open dm_db_open proc~dm_db_open->proc~dm_db_set_cache_size proc~dm_db_backup dm_db_backup proc~dm_db_backup->proc~dm_db_open