Lines Matching full:database
120 ** The hard upper limit here is 32676. Most database people will
121 ** tell you that in a well-normalized database, you usually should
183 ** The maximum number of in-memory pages to use for the main database
195 ** checkpointing the database in WAL mode.
224 ** compiled with a different limit. If a process operating on a database
227 ** the aborted transaction. This could lead to database corruption.
236 ** The default size of a database page.
263 ** Maximum number of pages in one database file.
362 ** database connection at the same time.
758 ** CAPI3REF: Database Connection Handle
759 ** KEYWORDS: {database connection} {database connections}
761 ** Each open SQLite database is represented by a pointer to an instance of
810 ** CAPI3REF: Closing A Database Connection
819 ** sqlite3_close() is called on a [database connection] that still has
852 ** in the context of the [database connection] passed in as its 1st
889 ** SQL comments, then no SQL statements are evaluated and the database
896 ** is a valid and open [database connection].
897 ** <li> The application must not close [database connection] specified by
904 sqlite3*, /* An open database */
925 #define SQLITE_ERROR 1 /* SQL error or missing database */
929 #define SQLITE_BUSY 5 /* The database file is locked */
930 #define SQLITE_LOCKED 6 /* A table in the database is locked */
932 #define SQLITE_READONLY 8 /* Attempt to write a readonly database */
935 #define SQLITE_CORRUPT 11 /* The database disk image is malformed */
937 #define SQLITE_FULL 13 /* Insertion failed because database is full */
938 #define SQLITE_CANTOPEN 14 /* Unable to open the database file */
939 #define SQLITE_PROTOCOL 15 /* Database lock protocol error */
940 #define SQLITE_EMPTY 16 /* Database is empty */
941 #define SQLITE_SCHEMA 17 /* The database schema changed */
948 #define SQLITE_FORMAT 24 /* Auxiliary database format error */
950 #define SQLITE_NOTADB 26 /* File opened that is not a database file */
967 ** on a per database connection basis using the
1151 ** The xCheckReservedLock() method checks whether any database connection,
1206 ** database corruption.
1248 ** layer a hint of how large the database file will grow to be during the
1250 ** is often close. The underlying VFS might choose to preallocate database
1251 ** file space based on this hint in order to help writes to the database
1255 ** extends and truncates the database file in chunks of a size specified
1258 ** for the nominated database. Allocating database file space in large
1359 ** SQLITE_IOERR. Or the implementation might recognize that a database
1544 ** single thread. All open [database connections] must be closed and all
1632 ** CAPI3REF: Configure database connections
1635 ** changes to a [database connection]. The interface is similar to
1637 ** [database connection] (specified in the first argument). The
1639 ** the database connection is created using [sqlite3_open()],
1644 ** aspect of the [database connection] is being configured.
1763 ** mutexing on [database connection] and [prepared statement] objects.
1765 ** [database connections] and [prepared statements]. But other mutexes
1768 ** [database connection] at the same time. ^If SQLite is compiled with
1778 ** mutexes on [database connection] and [prepared statement] objects.
1781 ** to [database connections] and [prepared statements] so that the
1782 ** application is free to use the same [database connection] or the
1834 ** times the database page size. ^If SQLite needs needs additional
1840 ** the database page cache with the default page cache implemenation.
1845 ** The sz argument should be the size of the largest database page
1902 ** [database connection]. The first argument is the
1904 ** slots allocated to each database connection.)^ ^(This option sets the
1958 ** CAPI3REF: Database Connection Configuration Options
1973 ** [lookaside memory allocator] configuration for the [database connection].
1985 ** configuration for a database connection can only be changed when that
2018 ** successful [INSERT] into the database from the [database connection]
2020 ** have ever occurred on that database connection, zero is returned.
2044 ** database connection while the [sqlite3_last_insert_rowid()]
2055 ** ^This function returns the number of database rows that were changed
2057 ** on the [database connection] specified by the first parameter.
2100 ** If a separate thread makes changes on the same database connection
2110 ** [UPDATE] or [DELETE] statements since the [database connection] was opened.
2126 ** If a separate thread makes changes on the same database connection
2135 ** ^This function causes any pending database operation to abort and
2142 ** thread that is currently running the database operation. But it
2143 ** is not safe to call this routine with a [database connection] that
2156 ** SQL statements on [database connection] D complete. ^Any new SQL statements
2166 ** If the database connection closes while [sqlite3_interrupt()]
2211 ** an attempt is made to open a database table that another thread
2223 ** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned.
2225 ** is made to open the database for reading and the cycle repeats.
2247 ** already hold a RESERVED lock on the database file, but it needs
2249 ** pages into the database file without harm to concurrent
2260 ** [database connection]. Setting a new busy handler clears any
2265 ** database connection that invoked the busy handler. Any such actions
2268 ** A busy handler must not close the database connection
2287 ** [database connection] any any given moment. If another busy handler
2366 sqlite3 *db, /* An open database */
2595 ** [database connection], supplied in the first argument.
2637 ** try to execute malicious statements that damage the database. For
2639 ** SQL queries for evaluation by a database. But the application does
2641 ** database. An authorizer could then be put in place while the
2647 ** and limiting database size using the [max_page_count] [PRAGMA]
2650 ** ^(Only a single authorizer can be in place on a database connection
2656 ** the database connection that invoked the authorizer callback.
2658 ** database connections for the meaning of "modify" in this paragraph.
2702 ** authorizer callback is the name of the database ("main", "temp",
2733 #define SQLITE_DETACH 25 /* Database Name NULL */
2734 #define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */
2778 ** database connection D. An example use for this
2787 ** [database connection]; setting a new progress handler cancels the
2797 ** the database connection that invoked the progress handler.
2799 ** database connections for the meaning of "modify" in this paragraph.
2805 ** CAPI3REF: Opening A New Database Connection
2807 ** ^These routines open an SQLite database file whose name is given by the
2810 ** order for sqlite3_open16(). ^(A [database connection] handle is usually
2814 ** object.)^ ^(If the database is opened (and/or created) successfully, then
2820 ** ^The default encoding for the database will be UTF-8 if
2825 ** associated with the [database connection] handle should be released by
2830 ** over the new database connection. ^(The flags parameter to
2838 ** <dd>The database is opened in read-only mode. If the database does not
2842 ** <dd>The database is opened for reading and writing if possible, or reading
2844 ** case the database must already exist, otherwise an error is returned.</dd>)^
2847 ** <dd>The database is opened for reading and writing, and is creates it if
2858 ** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection
2861 ** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens
2864 ** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be
2867 ** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not
2870 ** ^If the filename is ":memory:", then a private, temporary in-memory database
2871 ** is created for the connection. ^This in-memory database will vanish when
2872 ** the database connection is closed. Future versions of SQLite might
2874 ** It is recommended that when a database filename actually does begin with
2879 ** on-disk database will be created. ^This private database will be
2880 ** automatically deleted as soon as the database connection is closed.
2884 ** the new database connection should use. ^If the fourth parameter is
2894 const char *filename, /* Database filename (UTF-8) */
2898 const void *filename, /* Database filename (UTF-16) */
2902 const char *filename, /* Database filename (UTF-8) */
2913 ** associated with a [database connection]. If a prior API call failed
2932 ** this, each thread can obtain exclusive use of the [database connection] D
2977 ** [database connection] whose limit is to be set or queried. The
2997 ** both their own internal database and also databases that are controlled
3005 ** interface to further control untrusted SQL. The size of the database
3082 ** The first argument, "db", is a [database connection] obtained from a
3084 ** [sqlite3_open16()]. The database connection must not have been closed.
3127 ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
3156 sqlite3 *db, /* Database handle */
3163 sqlite3 *db, /* Database handle */
3170 sqlite3 *db, /* Database handle */
3177 sqlite3 *db, /* Database handle */
3194 ** CAPI3REF: Determine If An SQL Statement Writes The Database
3212 ** that can be stored in a database
3465 ** ^These routines provide a means to determine the database, table, and
3468 ** ^The name of the database or table or column can be returned as
3470 ** the database name, the _table_ routines return the table name, and
3477 ** database, table, and column.
3487 ** occurs. ^Otherwise, they return the name of the attached database, table,
3523 ** ^(For example, given the database schema:
3564 ** ^[SQLITE_BUSY] means that the database engine was unable to acquire the
3565 ** database locks it needs to do its job. ^If the statement is a [COMMIT]
3594 ** be the case that the same database connection is being used by two or
3905 ** ^The first parameter is the [database connection] to which the SQL
3906 ** function is to be added. ^If an application uses more than one database
3908 ** to each database connection separately.
3952 ** overloaded or when the database connection closes.)^
3966 ** matches the database encoding is a better
3976 ** close the database connection nor finalize or reset the prepared
4157 ** CAPI3REF: Database Connection For Functions
4160 ** the pointer to the [database connection] (the 1st parameter)
4357 ** with the [database connection] specified as the first argument.
4419 ** [database connection] is closed using [sqlite3_close()].
4458 ** ^To avoid having to register all collation sequences before a database
4460 ** [database connection] to be invoked whenever an undefined collation
4471 ** sqlite3_collation_needed16(). The second argument is the database
4494 ** Specify the key for an encrypted database. This routine should be
4501 sqlite3 *db, /* Database to be rekeyed */
4506 ** Change the key on an open database. If the current database is not
4508 ** database is decrypted.
4514 sqlite3 *db, /* Database to be rekeyed */
4519 ** Specify the activation key for a SEE database. Unless
4529 ** Specify the activation key for a CEROD database. Unless
4568 ** if a [database connection] is being used at the same time in a separate
4592 ** zero if the given database connection is or is not in autocommit mode,
4604 ** If another thread changes the autocommit status of the database
4611 ** CAPI3REF: Find The Database Handle Of A Prepared Statement
4613 ** ^The sqlite3_db_handle interface returns the [database connection] handle
4614 database connection]
4615 ** returned by sqlite3_db_handle is the same [database connection]
4626 ** pStmt associated with the [database connection] pDb. ^If pStmt is NULL
4628 ** associated with the database connection pDb. ^If no prepared statement
4631 ** The [database connection] pointer D in a call to
4632 ** [sqlite3_next_stmt(D,S)] must refer to an open database
4643 ** for the same database connection is overridden.
4647 ** for the same database connection is overridden.
4654 ** on the same [database connection] D, or NULL for
4658 ** the database connection that invoked the callback. Any actions
4659 ** to modify the database connection must be deferred until after the
4663 ** database connections for the meaning of "modify" in this paragraph.
4677 ** automatically rolled back because the database connection is closed.
4688 ** with the [database connection] identified by the first argument
4691 ** for the same database connection is overridden.
4701 ** database and table name containing the affected row.
4716 ** the database connection that invoked the update hook. Any actions
4717 ** to modify the database connection must be deferred until after the
4720 ** database connections for the meaning of "modify" in this paragraph.
4724 ** on the same [database connection] D, or NULL for
4740 ** ^(This routine enables or disables the sharing of the database cache
4741 ** and schema data structures between [database connection | connections]
4742 ** to the same database. Sharing is enabled if the argument is true
4751 ** Existing database connections continue use the sharing mode
4770 ** held by the database library. Memory used to cache database
4846 ** database table accessible using the [database connection] handle
4850 ** this function. ^The second parameter is either the name of the database
4851 ** (i.e. "main", "temp", or an attached database) containing the specified
4853 ** for the table using the same algorithm used by the database engine to
4896 ** ^(This function may load one or more schemas from database files. If an
4899 ** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^
4906 const char *zDbName, /* Database name or NULL */
4942 sqlite3 *db, /* Load the extension into this database connection */
4967 ** each new [database connection] that is created. The idea here is that
4969 ** that is to be automatically loaded into all new database connections.
4994 ** will be called more than once for each database connection that is opened.
5037 ** module or until the [database connection] closes. The content
5039 ** any database connection.
5173 ** ^The module name is registered on the [database connection] specified
5307 ** in row iRow, column zColumn, table zTable in database zDb;
5320 ** ^Note that the database name is not the filename that contains
5321 ** the database but rather the symbolic name of the database that
5322 ** appears after the AS keyword when the database is connected using [ATTACH].
5323 ** ^For the main database file, the database name is "main".
5324 ** ^For TEMP tables, the database name is "temp".
5329 ** ^This function sets the [database connection] error code and message
5373 ** to a different row of the same database table. ^The new row is identified
5375 ** changed. ^The database, table and column on which the blob handle is open
5389 ** ^This function sets the database handle error code and message.
5400 ** database connection is in [autocommit mode].
5784 ** CAPI3REF: Retrieve the mutex for a database connection
5787 ** serializes access to the [database connection] given in the argument
5795 ** CAPI3REF: Low-Level Control Of Database Files
5799 ** with a particular database identified by the second argument. ^The
5800 ** name of the database is "main" for the main database or "temp" for the
5801 ** TEMP database, or the name that appears after the AS keyword for
5804 ** main database file.
5817 ** open database file, then SQLITE_ERROR is returned. ^This error
5998 ** CAPI3REF: Database Connection Status
6001 ** about a single [database connection]. ^The first argument is the
6002 ** database connection object to be interrogated. ^The second argument
6022 ** CAPI3REF: Status Parameters for database connections
6040 ** memory used by all pager caches associated with the database connection.)^
6048 ** schema memory is shared with other database
6055 ** the database connection.)^
6150 ** determine exactly which parts of a database file are cached and for
6187 ** SQLite will typically create one cache instance for each open database file,
6191 ** will the page size of the database file that is to be cached plus an
6194 ** database page on disk. The value of R depends
6198 ** be used to cache database pages of a file stored on disk, or
6199 ** false if it is used for an in-memory database. The cache implementation
6306 ** The backup API copies the content of one database into another.
6312 ** ^Exclusive access is required to the destination database for the
6313 ** duration of the operation. ^However the source database is only
6316 ** performed on a live source database without preventing other users from
6317 ** reading or writing to the source database while the backup is underway.
6334 ** [database connection] associated with the destination database
6335 ** and the database name, respectively.
6336 ** ^The database name is "main" for the main database, "temp" for the
6337 ** temporary database, or the name specified after the AS keyword in
6338 ** an [ATTACH] statement for an attached database.
6340 ** sqlite3_backup_init(D,N,S,M) identify the [database connection]
6341 ** and database name of the source database, respectively.
6342 ** ^The source and destination [database connections] (parameters S and D)
6348 ** destination [database connection] D.
6375 ** <li> the destination database was opened read-only, or
6376 ** <li> the destination database is using write-ahead-log journaling
6378 ** <li> The destination database is an in-memory database and the
6388 ** [database connection]
6389 ** is being used to write to the source database when sqlite3_backup_step()
6403 ** sqlite3_backup_step() obtains a [shared lock] on the source database that
6405 ** ^Because the source database is not locked between calls to
6406 ** sqlite3_backup_step(), the source database may be modified mid-way
6407 ** through the backup process. ^If the source database is modified by an
6408 ** external process or via a database connection other than the one being
6411 ** database is modified by the using the same database connection as is used
6412 ** by the backup operation, then the backup database is automatically
6423 ** active write-transaction on the destination database is rolled back.
6442 ** up and the total number of pages in the source database file.
6447 ** sqlite3_backup_step(). ^If the source database is modified during a backup
6449 ** pages that need to be updated or the size of the source database file
6452 ** <b>Concurrent Usage of Database Handles</b>
6454 ** ^The source [database connection] may be used by the application for other
6456 ** ^If SQLite is compiled and configured to support threadsafe database
6457 ** connections, then the source database connection may be used concurrently
6461 ** [database connection] is not passed to any other API (by any thread) after
6464 ** if the application incorrectly accesses the destination [database connection]
6466 ** nevertheless. Use of the destination database connection while a
6470 ** guarantee that the shared cache used by the destination database
6484 sqlite3 *pDest, /* Destination database handle */
6485 const char *zDestName, /* Destination database name */
6486 sqlite3 *pSource, /* Source database handle */
6487 const char *zSourceName /* Source database name */
6497 ** ^When running in shared-cache mode, a database operation may fail with
6508 ** ^Shared-cache locks are released when a database connection concludes
6513 ** identity of the database connection (the blocking connection) that
6565 ** related to the set of unblocked database connections.
6570 ** database waits for the callback to be issued before taking any further
6652 ** will be invoked each time a database connection commits data to a
6657 ** the associated write-lock on the database released, so the implementation
6658 ** may read, write or [checkpoint] the database as required.
6662 ** registering the callback. ^The second is a copy of the database handle.
6663 ** ^The third parameter is the name of the database that was written to -
6664 ** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter
6676 ** A single database handle may have at most a single write-ahead log callback
6693 ** [sqlite3_wal_hook()] that causes any database on [database connection] D
6708 ** ^Every new [database connection] defaults to having the auto-checkpoint
6716 ** CAPI3REF: Checkpoint a database
6718 ** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X
6719 ** on [database connection] D to be [checkpointed]. ^If X is NULL or an
6721 ** connection D. ^If the database connection D is not in
7269 ** callback for the database handle. Each pager opened via the sqlite
7281 ** Name of the master database table. The master database table
7289 ** The root-page of the master database table.
7433 ** it must be turned on for each database using "PRAGMA auto_vacuum = 1".
7464 const char *zFilename, /* Name of database file to open */
7465 sqlite3 *db, /* Associated database connection */
7540 ** SQLite database header may be found using the following formula:
7545 ** the database file header. The incr-vacuum-flag field is located at
7678 ** Header file for the Virtual DataBase Engine (VDBE)
7680 ** This header defines the interface to the virtual database engine
7682 ** simple program to access and modify the underlying database.
8132 ** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is
8148 #define PAGER_MEMORY 0x0004 /* In-memory database */
8245 /* Functions used to truncate the database file. */
8322 ** writing this page to the database */
8795 ** Each database file to be accessed by the system is an instance
8797 ** in the sqlite.aDb[] array. aDb[0] is the main database file and
8798 ** aDb[1] is the database file used to hold temporary tables. Additional
8802 char *zName; /* Name of this database */
8803 Btree *pBt; /* The B*Tree structure for this database file */
8806 Schema *pSchema; /* Pointer to database schema (possibly shared) */
8810 ** An instance of the following structure stores a database schema.
8813 int schema_cookie; /* Database schema version number for this file */
8820 u8 enc; /* Text encoding used by this database */
8837 ** The DB_SchemaLoaded flag is set after the database schema has been
8857 ** associated with a particular database connection. The use of
8868 ** with a particular database connection. Hence, schema information cannot
8870 ** is shared by multiple database connections. Therefore, while parsing
8899 ** Each database connection is an instance of the following structure.
8939 int nTable; /* Number of tables in the database */
9032 ** A macro to discover the encoding of a database.
9085 #define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */
9086 #define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */
9088 #define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */
9312 ** the database schema.
9314 ** If the database schema is shared, then there is one instance of this
9315 ** structure for each database connection (sqlite3*) that uses the shared
9316 ** schema. This is because each database connection requires its own unique
9319 ** database connections, even when the rest of the in-memory database
9320 ** schema is shared, as the implementation often stores the database
9322 ** during initialization internally. This database connection handle may
9324 ** within the database. So that they appear as part of the callers
9325 ** transaction, these accesses need to be made via the same database
9329 ** database schema are initially stored in a linked-list pointed to by
9333 ** database connection doing the preparing so as to use the correct
9353 sqlite3 *db; /* Database connection associated with this table */
9380 ** database file. If Table.iDb is the index of the database table backend
9381 ** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that
9492 ** is returned. REPLACE means that preexisting database rows that caused
9527 sqlite3 *db; /* The database connection */
9598 int tnum; /* Page containing root of this index in database file */
9745 ** Expr objects can use a lot of memory space in database schema. To
9940 ** With the addition of multiple database support, the following structure
9944 ** now be identified by a database name, a dot, then the table name: ID.ID.
9958 char *zDatabase; /* Name of database holding this table */
10227 int iDb; /* Index in sqlite3.aDb[] of database holding pTab */
10281 sqlite3 *db; /* The main database structure */
10284 Vdbe *pVdbe; /* An engine for executing database bytecode */
10397 * Each trigger present in the database schema is stored as an instance of
10402 * database). This allows Trigger structures to be retrieved by name.
10488 ** routines as they walk the parse tree to make database references
10494 const char *zDb; /* Make sure all objects are contained in this database */
10504 sqlite3 *db; /* Optional database for lookaside. Can be NULL */
10520 sqlite3 *db; /* The database being initialized */
10521 int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */
11509 ** database connections. After initialization, this table is
11525 ** 1-gibabyte boundary) in a compatible database. SQLite never uses
11526 ** the database page that contains the pending byte. It never attempts
11537 ** 0x40000000 results in an incompatible database file format!
11997 ** A cursor is a pointer into a single BTree within a database file.
12013 int iDb; /* Index of cursor database in db->aDb[] (or -1) */
12120 sqlite3 *db; /* The associated database connection */
12142 ** database (see below for exceptions). If the MEM_Term flag is also
12258 sqlite3 *db; /* The database connection that owns this statement */
12288 u8 minWriteFileFormat; /* Minimum file format for writable database files */
12491 ** Query status information for a single database connection
12494 sqlite3 *db, /* The database connection whose status is desired */
12514 ** by all pagers associated with the given database connection. The
13810 sqlite3_file *id, /* Database file handle */
17475 ** cache database pages that are not currently in use.
17935 ** Free memory that might be associated with a particular database
18050 ** failure on the same database connection) then always return 0.
18051 ** Hence for a particular database connection, once malloc starts
18136 ** and set the mallocFailed flag in the database connection.
19262 ** Random numbers are used by some of the database backends in order
20098 ** stored by this function into the database handle using sqlite3Error().
20872 /* We can only reach this point when reading a corrupt database
20966 "API call with %s database connection pointer",
22202 ** a database and its journal file) that the sector size will be the
22851 ** where the database is located.
23011 ** transaction counter in bytes 24-27 of database files are updated
23012 ** whenever any part of the database changes. An assertion fault will
23018 unsigned char dbUpdate; /* True if any part of database file changed */
23634 ** on its own. Whenever a new database is opened, we have to find the
23635 ** specific inode of the database file (the inode is determined by the
23692 ** per database file in the same process and (2) database connections
23913 ** in the header of every SQLite database. In this way, if there
23915 ** the first page of the database, no damage is done.
24039 ** accessing the same database file, in case that is ever required.
24065 ** database.
24315 ** reading the database file again, make sure that the
24316 ** transaction counter was updated if any part of the database
24320 ** cache. The use of a stale cache can lead to database corruption.
24543 ** simplest: locking is ignored. No attempt is made to lock the database
24549 ** prevent simultaneous access of the same database by two or more
24550 ** database connections. But there is a serious risk of database
24552 ** database connections are accessing the same database file at the same
24584 ** files in order to control access to the database. This works on just
24588 ** connections from reading or writing the database.
24597 ** database and with the same name but with a ".lock" extension added.
24744 /* To fully unlock the database, delete the lock file */
24787 ** only a single process can be reading the database at a time.
25002 ** the database file at a time. This reduces potential concurrency, but
25538 ** reading the database file again, make sure that the
25539 ** transaction counter was updated if any part of the database
25543 ** cache. The use of a stale cache can lead to database corruption.
25738 /* If this is a database file (not a journal, master-journal or temp
25815 /* If this is a database file (not a journal, master-journal or temp
25825 /* If we are doing a normal write to a database file (as opposed to
25827 ** normal database file) then record the fact that the database
25832 pFile->dbUpdate = 1; /* The database has been modified */
25907 ** or power failure will likely corrupt the database file.
26003 ** will not roll back - possibly leading to database corruption.
26085 /* If we are doing a normal write to a database file (as opposed to
26087 ** normal database file) and we truncate the file to zero length,
26089 ** when restoring a database using the backup API from a zero-length
26116 /* When opening a zero-size database, the findInodeInfo() procedure
26209 ** a rollback and that the database is therefore unchanged and
26235 ** a database and its journal file) that the sector size will be the
26427 ** Open a shared-memory area associated with open database file pDbFd.
26431 ** as the open database file and has the same name as the open database
26432 ** file with the "-shm" suffix added. For example, if the database file
26438 ** from the database file is used, then differing access permissions
26440 ** database to end up using different files for shared memory -
26442 ** in database corruption. Nevertheless, this tmpfs file usage
26447 ** same database file at the same time, database corruption will likely
26476 struct stat sStat; /* fstat() info for database file */
26478 /* Call fstat() to figure out the permissions on the database file. If
26569 ** shared-memory associated with the database file fd. Shared-memory regions
26587 sqlite3_file *fd, /* Handle open on database file */
26680 sqlite3_file *fd, /* Database file holding the shared memory */
26790 sqlite3_file *fd /* Database file holding the shared memory */
26805 sqlite3_file *fd, /* The underlying database file */
26811 unixFile *pDbFd; /* The underlying database file */
26864 ** sqlite3_io_methods object for a particular database file. The pAppData
27031 ** for the database file "filePath". It then returns the sqlite3_io_methods
27037 const char *filePath, /* name of the database file */
27038 unixFile *pNew /* open file object for the database file */
27097 ** for the database file "filePath". It then returns the sqlite3_io_methods
27103 const char *filePath, /* name of the database file */
27436 ** Search for an unused file descriptor that was opened on the database
27441 ** Such a file descriptor may exist if a database connection was closed
27502 ** is a database or master journal file, it is created with the permissions
27507 ** corresponding database file and sets *pMode to this value. Whenever
27509 ** as the associated database file.
27518 char zDb[MAX_PATHNAME+1]; /* Database file path */
27520 struct stat sStat; /* Output of stat() on database file */
27523 ** the path to the associated database file from zPath. This block handles
27725 ** to be open on a database file. If it were open on a database file,
27770 ** with fd is a database file, and there are other connections open
28157 ** database file to coordinate safe, concurrent access by multiple readers
28178 ** address the requirements for concurrent database access by multiple
28183 ** changes the way database access is controlled by limiting access to a
28184 ** single host at a time and moving file locks off of the database file
28200 ** PRAGMA [database.]lock_proxy_file=<proxy_path> | :auto:
28201 ** PRAGMA [database.]lock_proxy_file
28208 ** database file. For example:
28210 ** For database path "/Users/me/foo.db"
28213 ** Once a lock proxy is configured for a database connection, it can not
28224 ** * conch file to limit access to the database file to a single host
28228 ** taken on the database
28234 ** stored in the same directory as the database file and the file name
28235 ** is patterned after the database file name as ".<databasename>-conch".
28244 ** normally taken on the database file. This allows for safe sharing
28245 ** of the database file for multiple readers and writers on the same
28249 ** only taken when the first request to lock database file is made.
28251 ** opening a connection to a database file does not take a lock on it.
28253 ** the connection to the database is closed.
28263 ** Database files accessed on non-local file systems are
28286 ** force proxy locking to be used for every database file opened, and 0
28287 ** will force automatic proxy locking to be disabled for all database
28314 ** The proxy lock file path for the database at dbPath is written into lPath,
28794 ** valid conch file), try to match the permissions of the database
28803 /* try to match the database file R/W permissions, ignore failure */
28916 ** Given the name of a database file, compute the name of its conch file.
28928 int len = (int)strlen(dbPath); /* Length of database filename - dbPath */
28932 ** the name of the original database file. */
29031 char dbPath[MAXPATHLEN+1]; /* Name of the database file */
29348 ** database file and tries to choose an locking method appropriate for
30826 ** a database and its journal file) that the sector size will be the
31057 ** Open the shared-memory area associated with database file pDbFd.
31176 sqlite3_file *fd, /* Database holding shared memory */
31179 winFile *pDbFd; /* Database holding shared-memory */
31217 sqlite3_file *fd, /* Database file holding the shared memory */
31326 sqlite3_file *fd /* Database holding the shared memory */
31336 ** shared-memory associated with the database file fd. Shared-memory regions
31354 sqlite3_file *fd, /* Handle open on database file */
32428 ** A bitmap is used to record which pages of a database file have been
32433 ** or all of the pages in a database can get journalled. In those cases,
32446 ** Bitvec object is the number of pages in the database file at the
32448 ** but can be as large as 2 billion for a really big database.
32948 ** being used for an in-memory database, this function is a no-op.
33305 ** Since there cannot be more than 2^31 distinct pages in a database,
33438 ** open database file (including each in-memory database and each
33439 ** temporary or transient database) has a single page cache which
33957 ** database) there is really no difference between createFlag 1 and 2. So
34368 sqlite3 *db; /* The database connection */
34428 ** The mallocFailed flag of the database connection is set if a
34703 ** The pager is used to access a database disk file. It implements
34705 ** is separate from the database file. The pager also implements file
34706 ** locking to prevent two processes from writing the same database
34707 ** file simultaneously, or one process from reading the database while
34764 ** snapshot is like a read-transaction. It is the state of the database
34776 /* If the WAL is not empty, return the size of the database. */
34797 /* Copy pages from the log to the database file */
34813 ** by the pager layer on the database file.
34841 ** Definition: A page of the database file is said to be "overwriteable" if
34851 ** the database file at the start of the transaction.
34853 ** (1) A page of the database file is never overwritten unless one of the
34863 ** both the content in the database when the rollback journal was written
34864 ** and the content in the database at the beginning of the current
34867 ** (3) Writes to the database file are an integer multiple of the page size
34870 database file are either aligned on a page boundary and
34872 ** first 100 bytes of the database file.
34874 ** (5) All writes to the database file are synced prior to the rollback journal
34877 ** (6) If a master journal file is used, then all writes to the database file
34880 ** Definition: Two databases (or the same database at two points it time)
34884 ** of the database.
34888 ** journal is rolled back, the resulting database file will be logical
34889 ** equivalent to the database file at the beginning of the transaction.
34892 ** is called to restore the database file to the same size it was at
34897 ** (9) Whenever the database file is modified, at least one bit in the range
34900 ** database to flush their caches.
34905 ** (11) A database file is well-formed at the beginning and at the conclusion
34908 ** (12) An EXCLUSIVE lock is held on the database file when writing to
34909 ** the database file.
34911 ** (13) A SHARED lock is held on the database file while reading any
34912 ** content out of the database file.
34979 ** state - the file may or may not be locked and the database size is
34980 ** unknown. The database may not be read or written.
34983 ** * Any lock, or no lock at all, may be held on the database file.
34988 ** In this state all the requirements for reading the database in
34991 ** open. The database size is known in this state.
34994 ** it opens a read-transaction on the database and returns to state
35002 ** * A SHARED or greater lock is held on the database file.
35006 ** * If the database is a WAL database, then the WAL connection is open.
35013 ** is first opened on the database. In WRITER_LOCKED state, all locks
35015 ** modifications to the cache or database have taken place.
35018 ** BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when
35021 ** in WRITER_LOCKED state, all that is required is to unlock the database
35026 ** is made to obtain an EXCLUSIVE lock on the database file.
35030 ** lock is held on the database file.
35044 ** start of it. The database file on disk has not been modified.
35047 ** * A RESERVED or greater lock is held on the database file.
35055 ** when it modifies the contents of the database file. WAL connections
35056 ** never enter this state (since they do not modify the database file,
35060 ** * An EXCLUSIVE or greater lock is held on the database file.
35072 ** database file. In this state the transaction may be committed simply
35074 ** not possible to modify the database further. At this point, the upper
35078 ** * An EXCLUSIVE or greater lock is held on the database file.
35079 ** * All writing and syncing of journal and database data has finished.
35098 ** report database corruption (due to the inconsistent cache), and if
35099 ** they upgrade to writers, they may inadvertently corrupt the database
35122 ** database file in function pagerStress() in order to free up
35166 ** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK.
35183 ** The exception is when the database file is unlocked as the pager moves
35196 ** transaction in another process, causing SQLite to read from the database
35200 ** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It
35205 ** lock on the database file before attempting to roll it back. See function
35271 ** For a real on-disk database, the current lock held on the database file -
35274 ** For a temporary or in-memory database (neither of which require any
35287 ** (the 4-byte header field at byte offset 24 of the database file) is
35291 ** can only happen if an exclusive lock is held on the database file.
35293 ** relinquished on the database file. Each time a transaction is committed,
35332 ** When doNotSpill is non-zero, writing to the database from pagerStress()
35338 ** If doNotSyncSpill is non-zero, writing to the database from pagerStress()
35341 ** the database page-size in order to prevent a journal sync from happening
35355 ** Variable dbSize is set to the number of pages in the database file.
35359 ** dbSize is set based on the size of the database file, which may be
35360 ** larger than the size of the database (the value stored at offset
35361 ** 28 of the database header by the btree). If the size of the file
35370 ** Similarly, if the database is truncated using PagerTruncateImage(),
35382 ** to write or truncate the database file on disk.
35387 ** that the database file is larger than the database image (Pager.dbSize),
35389 ** to measure the database file on disk, and then truncates it if required.
35425 u8 readOnly; /* True for a read-only database */
35438 u8 eLock; /* Current lock held on database file */
35444 Pgno dbSize; /* Number of pages in the database */
35446 Pgno dbFileSize; /* Number of pages in the database file */
35452 Bitvec *pInJournal; /* One bit for each page in the database file */
35453 sqlite3_file *fd; /* File descriptor for database */
35461 char dbFileVers[16]; /* Changes whenever database file changes */
35471 Pgno mxPgno; /* Maximum allowed size of the database */
35473 char *zFilename; /* Name of the database file */
35479 int nRead, nWrite; /* Database pages read/written */
35520 ** to roll the journal back, the database could be corrupted. The additional
35552 ** The macro MEMDB is true if we are dealing with an in-memory database.
35621 ** as if it has an exclusive lock on the database file. It never updates
35849 ** Unlock the database file to level eLock, which must be either NO_LOCK
35875 ** Lock the database file to level eLock, which must be either SHARED_LOCK,
35903 ** a database page may be written atomically, and
35909 ** database.
36136 ** - 4 bytes: Initial database page count.
36138 ** - 4 bytes: Database page size.
36200 /* The initial database size */
36229 ** database page size. Since the zHeader buffer is only Pager.pageSize
36252 ** database before the transaction began, in pages. Also, pPager->cksumInit
36265 u32 *pDbSize /* OUT: Value of original database size field */
36299 ** field, the checksum-initializer and the database size at the start
36382 ** If zMaster is a NULL pointer (occurs for a single database transaction),
36517 ** If the pager is not in exclusive-access mode, the database file is
36549 ** close the journal file when dropping the database lock. Otherwise
36565 /* If the pager is in the ERROR state and the call to unlock the database
36618 ** to be replayed to restore the contents of the database file (as if
36641 ** database transaction.
36652 ** or any other database connection. Exactly how a journal is finalized
36682 ** database then the IO error code is returned to the user. If the
36684 ** tries to unlock the database file if not in exclusive mode. If the
36737 ** the database file, it will do so using an in-memory journal.
36770 ** lock held on the database file.
36789 ** database file.
36794 ** the database file and move the pager back to OPEN state. If this
36885 ** to the database file, then the IO error code is returned. If data
36981 ** not the database file. The page is left marked dirty in this case.
36983 ** An exception to the above rule: If the database is in no-sync mode
37000 ** statement we must not write to the original database unless we know
37003 ** database file without an entry in the rollback journal that can
37004 ** restore the database to its original form. Two conditions must be
37005 ** met before writing to the database files. (1) the database must be
37010 ** 2008-04-14: When attempting to vacuum a corrupt database file, it
37011 ** is possible to fail a statement on a database that does not yet exist.
37012 ** Do not attempt to write if database file has never been opened.
37048 ** the database and the page is not in-memory, there is a potential
37050 ** will be read from the database file, which may or may not be
37076 ** database active. However such a page may be rolled back as a result
37089 ** database.
37100 ** be written out into the database file before its journal file
37102 ** database corruption may ensue.
37256 ** This function is used to change the actual size of the database
37260 ** If the main database file is not open, or the pager is not in either
37273 ** the database file, return the error code to the caller.
37305 ** of the open database file. The sector size will be used used
37336 ** Playback the journal and thus restore the database file to
37348 ** database to during a rollback.
37483 ** database file back to its original size.
37494 ** database file and/or page cache.
37511 ** case, the database should have never been written in the
37519 ** process to come along will be able to rollback the database.
37530 /* Following a rollback, the database file should be back in its original
37583 ** Read the content for page pPg out of the database file and into
37584 ** pPg->pData. A shared lock or greater must be held on the database
37588 ** the value read from the database file.
37625 ** of bytes 24..39 of the database. Bytes 28..31 should always be
37626 ** zero or the size of the database in page. Bytes 32..35 and 35..39
37630 ** For an encrypted database, the situation is more complex: bytes
37631 ** 24..39 of the database are white noise. But the probability of
37661 ** references, the page content is reloaded from the database. If the
37662 ** attempt to reload content from the database is required and fails,
37685 ** database. This is not generally possible with a WAL database, as
37697 ** This function is called to rollback a transaction on a WAL database.
37708 ** + Reload page content from the database (if refcount>0).
37757 Pgno nTruncate, /* Database size after this commit */
37798 ** makes a snapshot of the database at the current point in time and preserves
37827 ** to PAGER_READER state to determine the size of the database file
37830 ** If no error occurs, SQLITE_OK is returned and the size of the database
37837 /* Query the WAL sub-system for the database size. The WalDbsize()
37839 ** if the database size is not available. The database size is not
37847 /* If the database size was not available from the WAL sub-system,
37848 ** determine it based on the size of the database file. If the size
37849 ** of the database file is not an integer multiple of the page-size,
37882 ** Check if the *-wal file that corresponds to the database opened by pPager
37883 ** exists if the database is not empy, or verify that the *-wal file does
37884 ** not exist (by deleting it) if the database file is empty.
37886 ** If the database is not empty and the *-wal file exists, open the pager
37887 ** in WAL mode. If the database is empty or if no *-wal file exists and
37893 ** The caller must hold a SHARED lock on the database file to call this
37895 ** a WAL on a none-empty database, this ensures there is no race condition
37906 Pgno nPage; /* Size of the database file */
37984 /* Set the database size back to the value it was before the savepoint
38005 ** greater than the current database size (pPager->dbSize) but those
38083 ** Adjust the robustness of the database to damage due to OS crashes
38091 ** database. This is normally adequate protection, but
38094 database
38098 ** database (with some additional information - the nRec field
38103 ** point of causing damage to the database during rollback.
38107 ** prior to the start of checkpoint and that the database file is synced
38109 ** was written back into the database. But no sync operations occur for
38238 ** * the database is either not an in-memory database or it is
38239 ** an in-memory database that currently consists of zero pages.
38306 ** entire content of a database page. This buffer is used internally
38316 ** Attempt to set the maximum database page count if mxPage is positive.
38318 ** maximum page count below the current size of the database.
38362 ** function is used to read database headers, and a new transient or
38363 ** zero sized database has a header than consists entirely of zeroes.
38392 ** the pager. It returns the total number of pages in the database.
38405 ** Try to obtain a lock of type locktype on the database file. If
38442 ** current database image, in pages, OR
38451 ** the database file. If a savepoint transaction were rolled back after
38454 ** the database file or the portion of the rollback journal and
38456 ** database image would become corrupt. It is therefore fortunate that
38472 ** Truncate the in-memory database file image to nPage pages. This
38473 ** function does not actually modify the database file on disk. It
38541 ** file may be played back into the database. If a power failure occurs
38542 ** while this is happening, the database could become corrupt.
38546 ** database and close the journal file without attempting to roll it
38547 ** back or finalize it. The next database user will have to do hot-journal
38548 ** rollback before accessing the database file.
38646 ** that wrote to this database was operating in persistent-journal
38656 ** out-of-date data that follows it. Database corruption.
38740 ** in-memory pages in the list to the database file. The argument may
38745 ** is called. Before writing anything to the database file, this lock
38747 ** SQLITE_BUSY is returned and no data is written to the database file.
38754 ** the pages are written out to the database file in list order. Writing
38760 ** If writing out a page causes the database file to grow, Pager.dbFileSize
38763 ** the database file.
38814 /* Encode the database */
38821 ** the value now stored in the database file. If writing this
38822 ** page caused the database file to grow, update dbFileSize.
38924 ** database). The second argument is a reference to a page that is
38930 ** out to the database file, if possible. This may involve syncing the
38955 ** lead to database corruption. In the current implementaton it
38986 ** the database image, it may need to be written to the sub-journal.
38996 ** <shrink database file to Y pages>
39001 ** out to the database file, but will be dropped from the cache. Then,
39003 ** data from the database file. This will be the copy of page X as it
39018 /* Write the contents of the page out to the database file. */
39040 ** The zFilename argument is the path to the database file to open.
39045 ** This can be used to implement an in-memory database.
39068 const char *zFilename, /* Name of the database file to open */
39081 char *zPathname = 0; /* Full path to database file */
39127 ** the database being opened will be more than pVfs->mxPathname
39128 ** bytes in length. This means the database cannot be opened,
39141 ** three file descriptors, the database file name and the journal
39146 ** Database file handle (pVfs->szOsFile bytes)
39149 ** Database file name (nPathname+1 bytes)
39203 ** database file. The default page size is the maximum of:
39239 ** This branch is also run for an in-memory database. An in-memory
39240 ** database is the same as a temp-file that is never written out to
39335 ** * No process holds a RESERVED or greater lock on the database file, and
39336 ** * The database file itself is greater than 0 bytes in size, and
39339 ** If the current size of the database file is 0 but a journal file
39341 ** database with the same name. In this case the journal file is
39389 Pgno nPage; /* Number of pages in database file */
39391 /* Check the size of the database file. If it consists of 0 pages,
39408 ** or greater lock on the database file. Now check that there is
39449 ** This function is called to obtain a shared lock on the database file.
39457 ** on the database file), then an attempt is made to obtain a
39458 ** SHARED lock on the database file. Immediately after obtaining
39462 ** the 'change-counter' field of the database file header and
39472 ** occurs while locking the database, checking for a hot-journal file or
39503 ** database file, then it either needs to be played back or deleted.
39512 /* Get an EXCLUSIVE lock on the database file. At this point it is
39515 ** database file, detect the RESERVED lock, and conclude that the
39516 ** database is safe to read while this process is still rolling the
39520 ** other process attempting to access the database file will get to
39522 ** on the database file.
39563 /* Playback and delete the journal. Drop the database write
39612 /* The shared-lock has just been acquired on the database file
39614 ** read or write transaction). Check to see if the database
39615 ** has been modified. If the database has changed, flush the
39618 ** Database changes is detected by looking at 15 bytes beginning
39649 /* If there is a WAL file in the file-system, open this database in WAL
39699 ** read from the database file. In some cases, the pcache module may
39708 ** If the database image is smaller than the requested page or if a
39717 ** a) When reading a free-list leaf page from the database, and
39724 ** being read from the database. Additionally, the bits corresponding
39743 Pager *pPager, /* The pager open on the database file */
39870 ** are released, a rollback occurs and the lock on the database is
39883 ** There must already be a RESERVED or EXCLUSIVE lock on the database
39974 ** lock on the database file. If exFlag is true, then acquire at least
39983 ** sub-journal is implemented in-memory if pPager is an in-memory database,
39998 ** exclusive lock on the database is not already held, obtain it now.
40015 /* Obtain a RESERVED lock on the database file. If the exFlag parameter
40032 ** transactions may copy data from the sub-journal into the database
40078 /* Higher-level routines never call this function if database is not
40109 ** EXCLUSIVE lock on the main database file. Write the current page to
40120 ** contains the database locks. The following assert verifies
40132 ** in the database file. And if an IO error occurs while doing so,
40182 /* Update the database size and return.
40216 Pgno nPageCount; /* Total number of pages in database file */
40274 ** before any of them can be written out to the database file.
40331 ** This routine is called to increment the value of the database file
40348 ** if isDirect is non-zero, then the database file is updated directly
40423 ** Sync the database file to disk. This is a no-op for in-memory databases
40444 ** the database file, an attempt is made to obtain one.
40465 ** Sync the database file for the pager pPager. zMaster points to the name
40468 ** journal (a single database transaction).
40472 ** * The database file change-counter is updated,
40474 ** * all dirty pages are written to the database file,
40475 ** * the database file is truncated (if required), and
40476 ** * the database file synced.
40485 ** If the final parameter - noSync - is true, then the database file itself
40487 ** sync the database file before calling CommitPhaseTwo() to delete the
40507 PAGERTRACE(("DATABASE SYNC: File=%s zMaster=%s nSize=%d\n",
40510 /* If no database changes have been made, return early. */
40568 ** directly to the database file. Because of the atomic-write
40583 /* If this transaction has made the database smaller, then all pages
40591 ** reading data from the database file.
40599 const Pgno dbSize = pPager->dbSize; /* Database image size */
40622 /* Sync the journal file and write all dirty pages to the database.
40643 /* If the file on disk is not the same size as the database image,
40653 /* Finally, sync the database file. */
40670 ** When this function is called, the database file has been completely
40698 /* An optimization. If the database was not actually modified during
40705 ** to the database file. So there is no need to zero the journal
40734 ** 1) It rolls back the journal file, restoring all database file and
40746 ** their pre-transaction state by re-reading data from the database or
40782 ** Return TRUE if the database file is opened read-only. Return FALSE
40783 ** if the database is (in theory) writable.
40921 ** the transaction or unlock the database, it just restores the
40922 ** contents of the database to its original state.
40967 ** the database file, so the playback operation can be skipped.
40980 ** Return the full pathname of the database file.
40994 ** Return the file handle for the database file associated
41059 ** moved as part of a database reorganization just before the transaction
41060 ** is being committed. In this case, it is guaranteed that the database page
41078 /* In order to be able to rollback, an in-memory database must journal
41119 ** the journal needs to be sync()ed before database page pPg->pgno
41139 /* Do not discard pages from an in-memory database since we might
41151 /* For an in-memory database, make sure the original page continues
41163 ** sync()ed before any data is written to database file page needSyncPgno.
41172 ** this transaction, it may be written to the database file before
41246 ** * An in-memory database can only have its journal_mode set to _OFF
41277 /* Do allow the journalmode of an in-memory database to be set to
41312 ** database file. This ensures that the journal file is not deleted
41355 ** journalmode. Journalmode changes can only happen when the database
41416 ** Attempt to take an exclusive lock on the database file. If a PENDING lock
41436 ** lock on the database file and use heap-memory to store the wal-index
41468 ** The caller must be holding a SHARED lock on the database file to call
41471 ** If the pager passed as the first argument is open on a real database
41472 ** file (not a temp file or an in-memory database), and the WAL file
41478 ** If the pager is open on a temp-file (or in-memory database), or if
41517 ** EXCLUSIVE lock on the database file. If this cannot be obtained, an
41544 ** the database file, the log and log-summary files will be deleted.
41597 ** database file. All changes to the database are recorded by writing
41601 ** transferred back into the database file in an operation called a
41616 ** 8: Database page size. Example: 1024
41629 ** 4: For commit records, the size of the database image in pages
41667 ** WAL is transferred into the database, then the database is VFS.xSync-ed.
41679 ** To read a page from the database (call it page number P), a reader
41685 ** the database file.
41692 ** of the database from a single point in time. This technique allows
41693 ** multiple concurrent readers to view different versions of the database
41709 ** on a network filesystem. All users of the database must be able to
41717 ** Hence, unlike the database and WAL file formats which store all values
41739 ** database page number associated with each wal frame, and a hash-table
41743 ** first index-block contains the database page number corresponding to the
41882 u16 szPage; /* Database page size in bytes. 1==64K */
41884 u32 nPage; /* Size of database in pages */
41896 ** back into the database. (We call the act of moving content from WAL to
41897 ** database "backfilling".) The nBackfill number is never greater than
41910 ** directly from the database.
41917 ** The checkpointer may only transfer frames from WAL to database where
41924 ** in the WAL has been backfilled into the database) then new readers
41926 ** get all their all content directly from the database file and ignore
41931 ** written back into the database) and if no readers are using the WAL
41975 ** assuming a database page size of szPage bytes. The offset returned
41988 sqlite3_file *pDbFd; /* File handle for the database file */
41993 u32 szPage; /* Database page size */
42022 ** all frames in the WAL in database page order. Where two or more frames
42023 ** correspond to the same database page, the iterator visits only the
42220 ** 4: For commit records, the size of the database image in pages
42229 u32 iPage, /* Database page number for frame */
42256 u32 *piPage, /* OUT: Database page number for frame */
42296 ** and the new database size.
42526 ** Set an entry in the wal-index that will map database page number
42667 /* If the database page size is not a power of two, or is greater than
42716 u32 pgno; /* Database page number for frame */
42794 ** Open a connection to the WAL file zWalName. The database file must
42798 ** A SHARED lock should be held on the database file when this function
42810 sqlite3_file *pDbFd, /* The open database file */
43103 ** Copy as much content as we can from the WAL back into the database file
43106 ** The amount of information copies from WAL to database might be limited
43107 ** by active readers. This routine will never overwrite a database page
43116 ** into the database. This ensures that if the new content is persistent
43119 ** Fsync is also called on the database file if (and only if) the entire
43120 ** WAL content is copied into the database file. This second fsync makes
43122 ** database file.
43140 int szPage; /* Database page-size */
43142 u32 iDbpage = 0; /* Next database page to write */
43145 u32 mxPage; /* Max database page to write */
43169 ** safe to write into the database. Frames beyond mxSafeFrame might
43170 ** overwrite database pages that are in use by active readers and thus
43194 i64 nSize; /* Current size of database file */
43202 /* If the database file may grow as a result of this checkpoint, hint
43270 /* If an EXCLUSIVE lock can be obtained on the database file (using the
43273 ** the database. In this case checkpoint the database and unlink both
43469 ** access any database page that is modified by a WAL frame up to and
43473 ** completely and get all content directly from the database file.
43566 ** which implies that the database file contains a trustworthy
43574 ** it finished. Leaving a corrupt image in the database file.
43634 ** copied into the database by a checkpointer. If either of these things
43635 ** happened, then reading the database with the current value of
43660 ** Begin a read transaction on the database.
43668 ** If the database contents have changes since the previous read
43705 ** the WAL and needs to be read out of the database.
43709 Pgno pgno, /* Database page number to read data for */
43821 ** Return the size of the database in pages (or zero, if unknown).
43837 ** If another thread or process has written into the database since
43864 /* If another connection has written to the database file since the
43908 ** was in before the client began writing to the database.
44051 int szPage, /* Database page-size in bytes */
44053 Pgno nTruncate, /* Database size after this commit */
44219 ** we can from WAL into the database.
44242 /* Copy data from the log to the database file. */
44251 ** next time the pager opens a snapshot on this database it knows that
44288 ** lock on the main database file.
44295 ** on the main database file before invoking this operation.
44299 ** should acquire the database exclusive lock prior to invoking
44382 ** This file implements a external (disk-based) database using BTrees.
44389 ** The basic idea is that each page of the file contains N database
44408 ** fixed amount of payload can be carried directly on the database
44455 ** The file change counter is incremented when the database is changed
44592 /* The maximum number of cells on a single page of the database. This
44605 ** SQLite database in order to identify the file as a real database.
44692 ** A database connection contains a pointer to an instance of
44693 ** this object for every database file that it has open. This structure
44694 ** is opaque to the database connection. The database connection cannot
44698 ** For some database files, the same underlying database cache might be
44701 ** points to the same BtShared object. The database cache and the
44702 ** schema associated with the database file are all contained within
44712 sqlite3 *db; /* The database connection holding this btree */
44738 ** An instance of this object represents a single database file.
44740 ** A single database file can be in use as the same time by two
44741 ** or more database connections. When two or more connections are
44742 ** sharing the same database file, each connection has it own
44745 ** connections currently sharing this database file.
44756 ** If a BtShared client fails to obtain a write-lock on a database
44774 sqlite3 *db; /* Database connection currently using this Btree */
44776 MemPage *pPage1; /* First page of the database */
44780 u8 initiallyEmpty; /* Database is empty at start of transaction */
44795 u32 nPage; /* Number of pages in the database */
44831 ** maximum database size of 2^31 pages a minimum fanout of 2 for a
44835 ** assumed that the database is corrupt.
44841 ** b-tree within a database file.
44846 ** A single database file can shared by two more database connections,
44848 ** particular database connection identified BtCursor.pBtree.db.
44908 ** The database page the PENDING_BYTE occupies. This page is never used.
44914 ** database page. The first argument to each is the number of usable
44915 ** bytes on each page of the database (often 1024). The second is the
44918 ** PTRMAP_PAGENO returns the database page number of the pointer-map
44933 ** each child page in the database file. The parent page is the page that
44934 ** contains a pointer to the child. Every page in the database contains
44935 ** 0 or 1 parent pages. (In this context 'database page' refers
44945 ** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not
44948 ** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number
44951 ** PTRMAP_OVERFLOW1: The database page is the first page in a list of
44955 ** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of
44959 ** PTRMAP_BTREE: The database page is a non-root btree page. The page number
44978 ** if the database supports auto-vacuum or not. Because it is used
44998 Pgno nPage; /* Number of pages in the database */
45021 ** set BtShared.db to the database handle associated with p and the
45057 ** by all database connections. The p->pNext is a list of other
45058 ** Btrees belonging to the same database connection as the p Btree
45081 /* We should already hold a lock on the database connection */
45084 /* Unless the database is sharable and unlocked, then BtShared.db
45170 ** Enter the mutex on every Btree associated with a database
45229 ** Return true if the current thread holds the database connection
45254 ** another database connection.
45305 /* We should already hold a lock on the database connection */
45331 /* We should already hold a lock on the database connection */
45370 ** This file implements a external (disk-based) database using BTrees.
45377 ** SQLite database.
45423 ** This routine has no effect on existing database connections.
45467 ** When writing to an index that resides in a sharable database, the
45472 ** function has to search through the database schema.
45488 /* If this database is not shareable, or if the client is reading
45642 ** database (one with the BtShared.sharable flag set), and
45826 Btree *pBtree, /* The database file to check */
45857 ** a free-list leaf page, the page is not written to the database
45863 ** from the database or written to the journal file (why should it
45873 ** to restore the database to its original configuration.
46087 ** Given a page number of a regular database page, return the page
46692 ** indicates a corrupt database files:
46728 ** not contain a well-formed database page, then return
46771 /* A malformed database page might cause us to read past the end
46816 ** the free-block must lie on the database page. */
46840 ** Set up a raw page so that it looks like a database page holding
46931 ** Return the size of the database file in pages. If there is any kind of
46952 BtShared *pBt, /* The database file */
47029 ** Open a database file.
47031 ** zFilename is the name of the database file. If zFilename is NULL
47032 ** then an ephemeral database is created. The ephemeral database might
47034 ** Either way, the ephemeral database will be automatically deleted
47037 ** If zFilename is ":memory:" then an in-memory database is created
47046 ** If the database is already opened in the same database connection
47049 ** objects in the same database connection since doing so will lead
47053 const char *zFilename, /* Name of the file containing the BTree database */
47054 sqlite3 *db, /* Associated database handle */
47065 unsigned char zDbHeader[100]; /* Database header content */
47067 /* True if opening an ephemeral, temporary database */
47070 /* Set the variable isMemdb to true for an in-memory database, or
47071 ** false for a file-based database.
47084 /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */
47087 /* A BTREE_SINGLE database is always a temporary and/or ephemeral */
47207 /* If the magic name ":memory:" will create an in-memory database, then
47371 ** Close an open database and invalidate all cursors.
47436 ** and the database cannot be corrupted if this program
47438 ** an abrupt power failure when synchronous is off, the database
47440 ** Synchronous is on by default so database corruption is not
47454 ** how well the database resists damage due to OS crashes and power
47503 ** of the database file used for locking (beginning at PENDING_BYTE,
47561 ** Set the maximum page count for a database if mxPage is positive.
47592 ** Change the 'auto-vacuum' property of the database. If the 'autoVacuum'
47639 ** Get a reference to pPage1 of the database file. This will
47643 ** well-formed database file, then SQLITE_CORRUPT is returned.
47644 ** SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM
47649 MemPage *pPage1; /* Page 1 of the database file */
47650 int nPage; /* Number of pages in the database */
47651 int nPageFile = 0; /* Number of pages in the database file */
47652 int nPageHeader; /* Number of pages in the database according to hdr */
47662 ** a valid database file.
47693 /* If the write version is set to 2, this database should be accessed
47732 /* After reading the first page of the database assuming a page size
47734 ** actually pageSize. Unlock the database, leave pBt->pPage1 at
47791 ** of a transaction but there is a read lock on the database, then
47792 ** this routine unrefs the first page of the database file which
47811 ** into a new empty database by initializing the first page of
47812 ** the database.
47858 ** to access the database. A preexisting transaction may not be
47863 ** changes to the database. None of the following routines
47875 ** and the database was previously unlocked, then invoke the busy handler
47904 /* Write transactions are not possible on a read-only database */
47911 /* If another database handle has already opened a write transaction
47944 ** reading page 1 it discovers that the page-size of the database
47992 ** client has been writing the database file), update it now. Doing
47993 ** this sooner rather than later means the database size can safely
47994 ** re-read the database size from page 1 if a savepoint or transaction
48129 ** Move the open database page pDbPage to location iFreePage in the
48130 ** database. The pDbPage reference remains valid.
48133 ** the journal needs to be sync()ed before database page pDbPage->pgno
48187 /* Fix the database pointer on page iPtrPage that pointed at iDbPage so
48219 ** database so that the last page of the file currently in use
48225 ** number of pages the database file will contain after this
48362 ** is commited for an auto-vacuum database.
48365 ** the database file should be truncated to during the commit process.
48366 ** i.e. the database has been reorganized so that only the first *pnTrunc
48378 Pgno nFin; /* Number of pages in database after autovacuuming */
48383 Pgno nOrig; /* Database size before freeing */
48387 /* It is not possible to create a database for which the final page
48434 ** the database can be restored to its original state by playing back
48437 ** database are written into the database file and flushed to oxide.
48445 ** Otherwise, sync the database file for the btree pBt. zMaster points to
48448 ** (single database transaction).
48454 ** the write-transaction for this database file is to delete the journal.
48486 /* If there are other active statements that belong to this database
48488 ** may still be reading from the database. */
48525 ** This will release the write lock on the database file. If there
48596 ** to other database connections that happen to be sharing
48629 ** This will release the write lock on the database file. If there
48744 /* The database size was written into the offset 28 of the header
48758 ** on the database already. If a write-cursor is requested, then
48769 ** 2: Other database connections that share the same pager cache
48773 ** the read cursors in the other database connection.
48775 ** 3: The database must be writable (not on read-only media)
48799 ** b-tree database, the connection is holding the required table locks,
48873 ** Set the cached rowid value of every cursor in the same database file
48903 ** Close a cursor. The read lock on the database file is released
49037 ** Given the page number of an overflow page in the database (parameter
49056 BtShared *pBt, /* The database file */
49115 ** pPayload is a pointer to data stored on database page pDbPage.
49369 ** page of the database. The data might change or move the next time
49949 ** Advance the cursor to the next entry in the database. If
49951 ** was already pointing to the last entry in the database before
50018 ** Step the cursor to the back to the previous entry in the database. If
50020 ** was already pointing to the first entry in the database before
50078 ** Allocate a new page from the database file.
50091 ** attempt to keep related pages close to each other in the database file,
50092 ** which in turn can make database access faster.
50111 Pgno mxPage; /* Total size of the database file */
50189 /* Value of k is out of range. Database corruption */
50370 ** This function is used to add page iPage to the database file free-list.
50418 /* If the database supports auto-vacuum, write an entry in the pointer-map
50426 /* Now manipulate the actual database free-list structure. There are two
50536 ** file the database must be corrupt. */
50550 ** must not really be an overflow page and the database must be corrupt.
50660 /* If the database supports auto-vacuum, and the second or subsequent
50668 ** wrong pages from the database.
50960 BtShared *const pBt = pPage->pBt; /* B-Tree Database */
50990 /* If this is an auto-vacuum database, update the pointer map
51131 /* If this is an auto-vacuum database, update the pointer-map entries
51164 ** If this routine fails for any reason, it might leave the database
51165 ** in a corrupted state. So if this routine fails, the database should
51186 BtShared *pBt; /* The whole database */
51531 ** When NB==3, this one optimization makes the database
51649 database, the call to copyNodeContent()
51650 ** sets all pointer-map entries corresponding to database image pages
51655 ** is important if the parent page happens to be page 1 of the database
51761 ** debugging. This is usually disabled because a corrupt database may
51939 ** copied either into the body of a database page or into the new
51947 ** now stored either on real database pages or within the
52282 /* Creating a new table may probably require moving an existing database
52289 /* Read the value of meta[3] from the database to determine where the
52369 ** order either to increase the database filesize, or to decrement the
52405 ** Erase the given database page and all its children. Return
52454 ** Delete all information from a single table in the database. iTable is
52494 ** root page in the database file, then the last root page
52495 ** in the database file is moved into the slot formerly occupied by
52498 ** root pages are kept at the beginning of the database file, which
52514 ** database. This is because in auto-vacuum mode the backend may
52547 ** number in the database, put the root page on the free list.
52556 ** number in the database. So move the page that does into the
52580 /* Set the new 'max-root-page' value in the database header. This
52601 ** database.
52619 ** has a read or write transaction open on the database.
52621 ** Read the meta-information out of a database file. Meta[0]
52622 ** is the number of free pages currently in the database. Meta[1]
52642 ** database, mark the database as read-only. */
52651 ** Write meta-information back into the database. Meta[0] is
52684 ** Otherwise, if an error is encountered (i.e. an IO error or database
52894 /* If this database supports auto-vacuum and iPage is not the last
53219 /* If the database supports auto-vacuum, make sure no tables contain
53260 ** Return the full pathname of the underlying database file.
53271 ** Return the pathname of the journal file for this database. The return
53465 ** "write version" (single byte at byte offset 19) fields in the database
53526 sqlite3* pDestDb; /* Destination database handle */
53532 sqlite3* pSrcDb; /* Source database handle */
53554 ** backup_finish(). Both these functions obtain the source database
53560 ** the page cache associated with the source database. The mutex
53561 ** associated with the source database BtShared structure will always
53571 ** Depending on the SQLite configuration, the database handles and/or
53578 ** Return a pointer corresponding to database zDb (i.e. "main", "temp")
53579 ** in connection handle pDb. If such a database cannot be found, return
53582 ** If the "temp" database is requested, it may need to be opened by this
53611 sqlite3Error(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb);
53624 ** stored in database handle pDestDb.
53627 sqlite3* pDestDb, /* Database to write to */
53628 const char *zDestDb, /* Name of database within pDestDb */
53629 sqlite3* pSrcDb, /* Database connection to read from */
53630 const char *zSrcDb /* Name of database within pSrcDb */
53634 /* Lock the source database handle. The destination database
53639 ** database connection while a backup is in progress may cause
53700 ** page iSrcPg from the source database. Copy this data into the
53701 ** destination database.
53718 /* Catch the case where the destination is an in-memory database and the
53827 /* Lock the destination database, if it is not locked already. */
53835 /* If there is no open read-transaction on the source database, open
53844 /* Do not allow backup if the destination database is in WAL mode
53853 /* Now that there is a read-lock on the source database, query the
53854 ** source pager for the number of pages in the database.
53880 /* Update the schema version field in the destination database. This
53895 ** database. The complication here is that the destination page
53926 ** pending-byte page in the source database may need to be
53927 ** copied into the destination database.
53962 /* Finish committing the transaction to the destination database. */
53971 ** on the source database. Close the read transaction here. There is
54000 sqlite3_mutex *mutex; /* Mutex to protect source database */
54027 /* Set the error code of the destination database handle. */
54055 ** Return the total number of pages in the source database as of the most
54064 ** source database have been modified. If page iPage has already been
54065 ** copied into the destination database, then the data written to the
54071 ** corresponding to the source database is held when this function is
54094 ** detects that the database has been modified by an external database
54096 ** pages that have been copied into the destination database are still
54100 ** corresponding to the source database is held when this function is
54137 /* 0x7FFFFFFF is the hard limit for the number of pages in a database
55070 ** that both the BtShared and database handle mutexes are held. */
55173 sqlite3 *db, /* The database connection */
55341 ** Create a new virtual database engine.
56374 sqlite3 *db = p->db; /* The database connection */
56935 ** A read or write transaction may or may not be active on database handle
56937 ** write-transaction spanning more than one database file, this routine
56956 ** required, as an xSync() callback may add an attached database
56962 ** (b) how many database files have open write transactions, not
56963 ** including the temp database. (b) is important because if more than
56964 ** one database file has an open write transaction, a master journal
56987 /* The simple case - no more than one database file (not counting the
56988 ** TEMP database) has a transaction active. There is no need for the
56992 ** string, it means the main database is :memory: or a temp file. In
57059 /* Write the name of each database file in the transaction into the new
57189 ** For every Btree that in database connection db which
57194 ** cursor from other VMs in different database connections,
57260 ** database handles deferred constraint counter to the value it had when
57278 ** of all of BtShared structures accessible via the database handle
57297 ** This function is called when a transaction opened by the database
57378 ** transaction must be rolled back to restore the database to a
57383 ** occured while writing to the journal, sub-journal or database
57483 ** has been rolled back, update the database connection change-counter.
57561 ** and error message from the VDBE into the main database structure. But
57563 ** instructions yet, leave the main database error information unchanged.
57582 ** called), set the database error in this case as well.
57659 ** the database connection.
58275 ** pCur might be pointing to text obtained from a corrupt database file.
58289 ** than 2GiB are support - anything large must be database corruption.
58339 /* Jump here if database corruption is detected after m has been
58390 ** sqlite3_changes() on the database handle 'db'.
58407 ** Mark every prepared statement associated with a database connection
58424 ** Return the database associated with the Vdbe.
58902 ** caller. Set the error code in the database handle to the same value.
58919 sqlite3 *db; /* The database connection */
58935 ** into the database handle. This block copies the error message
58936 ** from the database handle into the statement and sets the statement
58970 ** returns a copy of the pointer to the database connection (the 1st
59281 ** 2 The name of the database that the column derives from
59361 ** Return the name of the database from which a result column derives.
59363 ** anything else which is not an unabiguous reference to a database column.
59379 ** anything else which is not an unabiguous reference to a database column.
59395 ** anything else which is not an unabiguous reference to a database column.
59422 ** The error code stored in database p->db is overwritten with the return
59704 ** database connections. But as this is a deprecated interface, we
59728 ** Return the sqlite3* database handle to which the prepared statement given
59729 ** in the argument belongs. This is the same database handle that was
59739 ** database.
59747 ** with database connection pDb. If pStmt is NULL, return the first
59748 ** prepared statement for the database connection. Return NULL if there
59838 sqlite3 *db; /* The database connection */
59930 ** Virtual Database Engine (VDBE). A separate file ("vdbeaux.c")
60107 int iDb, /* When database the cursor belongs to, or -1 */
60530 ** If an attempt is made to open a locked database, then this routine
60557 sqlite3 *db = p->db; /* The database */
60559 u8 encoding = ENC(db); /* The database encoding */
60788 const char *zDb; /* database name - used by the update hook */
60917 const char *zFilename; /* Name of database file for pPager */
62622 ** the database file has been corrupted externally.
62626 /* Make sure a corrupt database has not given us an oversize header.
62645 ** allocation, especially if a corrupt database file has caused u.am.offset
62651 ** not exceeded even for corrupt database files.
62706 ** with a corrupt database.
62799 ** use as a data record in a database table or as a key
63009 /* Link the new savepoint into the database handle's list. */
63088 ** constraint violations present in the database to the value stored
63108 ** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll
63185 ** P1 is the index of the database file on which the transaction is
63186 ** started. Index 0 is the main database file and index 1 is the
63191 ** obtained on the database file when a write-transaction is started. No
63195 ** database. If P2 is 2 or greater then an EXCLUSIVE lock is also obtained
63201 ** More specifically, a statement transaction is opened iff the database
63208 ** If P2 is zero, then a read-lock is obtained on the database file.
63241 /* Store the current value of the database handles deferred constraint
63252 ** Read cookie number P3 from database P1 and write it into register P2.
63253 ** P3==1 is the schema version. P3==2 is the database format.
63255 ** the main database file and P1==1 is the database file used to store
63258 ** There must be a read-lock on the database (either a transaction
63284 ** into cookie number P2 of database P1. P2==1 is the schema version.
63285 ** P2==2 is the database format. P2==3 is the recommended pager cache
63286 ** size, and so forth. P1==0 is the main database file and P1==1 is the
63287 ** database file used to store temporary tables.
63313 /* Invalidate all prepared statements whenever the TEMP database
63323 ** Check the value of global database parameter number 0 (the
63325 ** P1 is the database number which is 0 for the main database file
63329 ** The cookie changes its value whenever the database schema changes.
63352 p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
63353 /* If the schema-cookie from the database file matches the cookie
63355 ** not reload the schema from the database file.
63361 ** discard the database schema, as the user code implementing the
63378 ** Open a read-only cursor for the database table whose root page is
63379 ** P2 in a database file. The database file is determined by P3.
63380 ** P3==0 means the main database, P3==1 means the database used for
63382 ** database. Give the new cursor an identifier of P1. The P1
63389 ** There will be a read lock on the database whenever there is an
63390 ** open cursor. If the database was unlocked prior to this instruction
63392 ** lock allows other processes to read the database but prohibits
63393 ** any other process from modifying the database. The read lock is
63495 ** rooted at page 1 of a zero-byte database. */
63504 ** and report database corruption if they were not, but this check has
63515 ** the main database is read-only. The ephemeral
64110 ** The record number is not previously used as a key in the database
64221 ** largest possible integer (9223372036854775807) then the database
64312 const char *zDb; /* database name - used by the update hook */
64441 ** The value of the change counter is copied to the database handle
64457 ** it is found in the database file.
64467 ** it is found in the database file.
64609 ** will refer to the last entry in the database table or index.
64664 ** will refer to the first entry in the database table or index.
64944 ** Delete an entire database table or index whose root page in the database
64947 ** The table being destroyed is in the main database file if P3==0. If
64948 ** P3==1 then the table to be clear is in the auxiliary database file
64953 ** root pages contiguous at the beginning of the database. The former
64957 ** the last one in the database) then a zero is stored in register P2.
65002 ** Delete all contents of the database table or index whose root page
65003 ** in the database file is given by P1. But, unlike Destroy, do not
65004 ** remove the table or index from the database file.
65006 ** The table being clear is in the main database file if P2==0. If
65007 ** P2==1 then the table to be clear is in the auxiliary database file
65041 ** Allocate a new table in the main database file if P1==0 or in the
65042 ** auxiliary database file if P1==1 or in an attached database if
65054 ** Allocate a new index in the main database file if P1==0 or in the
65055 ** auxiliary database file if P1==1 or in an attached database if
65087 ** Read and parse all entries from the SQLITE_MASTER table of database P1
65116 ** database u.bu.iDb (the database containing the sqlite_master table
65124 ** schema of database u.bu.iDb before the SQL statement runs. The schema
65127 ** database schema" error being returned to the user.
65162 ** Read the sqlite_stat1 table for database P1 and load the content
65176 ** the table named P4 in database P1. This is called after a table
65188 ** the index named P4 in database P1. This is called after an index
65200 ** the trigger named P4 in database P1. This is called after a trigger
65213 ** Do an analysis of the currently open database. Store in
65222 ** The root page numbers of all tables in the database are integer
65226 ** If P5 is not zero, the check is done on the auxiliary database
65227 ** file, not the main database file.
65525 ** If P1 is non-zero, the database constraint counter is incremented
65544 ** If P1 is non-zero, then the jump is taken if the database constraint-counter
65733 ** Checkpoint database P1. This is a no-op if P1 is not currently in
65745 ** Change the journal mode of database P1 to P3. P3 must be one of the
65760 const char *zFilename; /* Name of database file for pPager */
65779 ** iDb index of the database as a parameter, and the database has not
65781 ** until runtime (now) to get the mutex on the newly attached database.
65788 ** database. */
65802 /* Do not allow a transition to journal_mode=WAL for a database
65827 ** file. An EXCLUSIVE lock may still be held on the database file
65840 /* Open a transaction on the database file. Regardless of the journal
65869 ** Vacuum the entire database. This opcode will cause other virtual
65883 ** the P1 database. If the vacuum has finished, jump to instruction
65927 ** P1 is the index of the database in sqlite3.aDb[] of the database
65946 sqlite3SetString(&p->zErrMsg, db, "database table is locked: %s", z);
65977 ** P4 is the name of a virtual table in database P1. Call the xCreate method
65989 ** P4 is the name of a virtual table in database P1. Call the xDestroy method
66313 ** Write the current number of pages in database P1 to memory cell P2.
66325 ** Try to set the maximum page count for database P1 to the value in P3.
66524 sqlite3 *db; /* The associated database */
66601 sqlite3* db, /* The database connection */
66602 const char *zDb, /* The attached database containing the blob */
66919 ** database table.
66923 ** database handle error code and message set. If this happens, then all
67651 sqlite3 *db; /* The database connection */
67701 ** pExpr->iDb Set the index in db->aDb[] of the database X
67712 ** The zDb variable is the name of the database (the "X"). This value may be
67713 ** NULL meaning that name is of the form Y.Z or Z. Any available database
67724 const char *zDb, /* Name of the database containing table, or NULL */
67733 sqlite3 *db = pParse->db; /* The database connection */
68081 ** Or a database, table and column: ID.ID.ID
68117 u8 enc = ENC(pParse->db); /* The database encoding */
68264 sqlite3 *db; /* Database connection */
68529 sqlite3 *db; /* Database connection */
68695 ** X: The name of a database. Ex: "main" or "temp" or
68696 ** the symbolic name assigned to an ATTACH-ed database.
69642 ** part of the in-memory representation of the database schema.
70182 ** The index of the cursor opened on the b-tree (database table, database index
70186 ** IN_INDEX_ROWID - The cursor was opened on a database table.
70187 ** IN_INDEX_INDEX - The cursor was opened on a database index.
70245 sqlite3 *db = pParse->db; /* Database connection */
70250 int iDb; /* Database idx for pTab */
70661 ** of a "NOT NULL" constraint in the database schema.
71069 sqlite3 *db = pParse->db; /* The database connection */
71336 u8 enc = ENC(db); /* The text encoding used by this database */
72761 ** Note that ON cannot be a database, table or column name, so
72851 ** temporary database, NULL is returned.
72881 ** pTab from the database, including triggers and temporary triggers.
72882 ** Argument zName is the name of the table in the database schema at
72890 int iDb; /* Index of database containing pTab */
72919 /* Now, if the table is not stored in the temp database, reload any temp
72937 int iDb; /* Database that contains the table */
72938 char *zDb; /* Name of database iDb */
72941 sqlite3 *db = pParse->db; /* Database connection */
72967 ** in database iDb. If so, this is an error.
73014 /* Begin a transaction and code the VerifyCookie for database iDb.
73085 /* If the sqlite_sequence table exists in this database, then update
73098 ** the temp database.
73168 int iDb; /* Database number */
73169 const char *zDb; /* Database name */
73174 sqlite3 *db; /* The database connection; */
73402 int iDb, /* The database we are looking in */
73476 sqlite3 *db = pParse->db; /* Database handle */
73485 int iDb; /* Index of database containing pTab */
73733 ** Generate code that will do an analysis of an entire database
73737 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
73756 ** a database.
73778 ** ANALYZE <database> -- 2
73779 ** ANALYZE ?<database>.?<tablename> -- 3
73782 ** Form 2 analyzes all indices the single database named.
73793 /* Read the database schema. If an error occurs, leave an error message
73804 if( i==1 ) continue; /* Do not analyze the TEMP database */
73808 /* Form 2: Analyze the database or table named */
73927 ** If the sqlite_stat1 table is not present in the database, SQLITE_ERROR
73933 ** sqlite_stat2 table is not present in the database, SQLITE_ERROR is
74082 ** ATTACH DATABASE abc AS def
74089 ** ATTACH DATABASE abc||def AS 'db2'
74114 ** ATTACH DATABASE x AS y KEY z
74145 ** * Specified database name already being used.
74154 zErrDyn = sqlite3MPrintf(db, "cannot ATTACH database within transaction");
74161 zErrDyn = sqlite3MPrintf(db, "database %s is already in use", zName);
74181 /* Open the database file. If the btree is successfully opened, use
74182 ** it to obtain the database schema. At this point the schema may
74190 zErrDyn = sqlite3MPrintf(db, "database is already attached");
74198 "attached databases must use the same text encoding as main database");
74235 /* No key specified. Use the key from the main database */
74243 /* If the file was opened successfully, read the schema for the new database.
74268 zErrDyn = sqlite3MPrintf(db, "unable to open database: %s", zFile);
74288 ** DETACH DATABASE x
74313 sqlite3_snprintf(sizeof(zErr),zErr, "no such database: %s", zName);
74317 sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName);
74322 "cannot DETACH database within transaction");
74326 sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
74349 Expr *pFilename, /* Name of database file */
74350 Expr *pDbname, /* Name of the database to use internally */
74351 Expr *pKey /* Database key for encryption extension */
74461 ** means we do need to fix the database references, FALSE means we do not.
74466 int iDb, /* This is the database that must be used */
74484 ** a specific database to all table references where the database name
74489 ** view in one database does not refer to objects in a different database.
74490 ** (Exception: indices, triggers, and views in the TEMP database are
74492 ** to an object in a different database, an error message is added to
74511 "%s %T cannot reference objects in database %s",
74525 Select *pSelect /* The SELECT statement to be fixed to one database */
74546 Expr *pExpr /* The expression to be fixed to one database */
74564 ExprList *pList /* The expression to be fixed to one database */
74581 TriggerStep *pStep /* The trigger step be fixed to one database */
74629 ** various fields of the database. The first argument to the auth function
74693 ** table zTab in database zDb. This function assumes that an authorization
74704 database. */
74706 sqlite3 *db = pParse->db; /* Database handle */
74707 char *zDb = db->aDb[iDb].zName; /* Name of attached database */
74743 int iDb; /* The index of the database the expression refers to */
74800 /* Don't do any authorization checks if the database is initialising
74892 int iDb; /* The database containing the table to be locked */
74901 ** The table to be locked has root page iTab and is found in database iDb.
74910 int iDb, /* Index of the database containing the table to lock */
74994 /* The cookie mask contains one bit for each database file open.
74996 ** set for each database that is used. Generate code to start a
74997 ** transaction on each used database and to verify the schema cookie
74998 ** on each used database.
75105 ** Locate the in-memory structure that describes a particular database
75107 ** database containing the table. Return NULL if not found.
75132 ** Locate the in-memory structure that describes a particular database
75134 ** database containing the table. Return NULL if not found. Also leave an
75145 const char *zDbase /* Name of the database. Might be NULL */
75149 /* Read the database schema. If an error occurs, leave an error message
75171 ** and the name of the database that contains the index.
75207 ** For the index called zIdxName which is found in the database iDb,
75239 ** a single database. This routine is called to reclaim memory
75240 ** before the database closes. It is also called during a rollback
75244 ** If iDb==0 then reset the internal schema tables for all database
75268 /* If one or more of the auxiliary database files has been closed,
75269 ** then remove them from the auxiliary database list. We take the
75416 ** Open the sqlite_master table stored in database number iDb for
75431 ** of a database ("main", "temp" or the name of an attached db). This
75432 ** function returns the index of the named database in db->aDb[], or
75436 int i = -1; /* Database number */
75451 ** The token *pName contains the name of a database (either "main" or
75453 ** index of the named database in db->aDb[], or -1 if the named db
75457 int i; /* Database number */
75479 ** database "xxx" is returned.
75487 int iDb; /* Database holding the object */
75492 sqlite3ErrorMsg(pParse, "corrupt database");
75499 sqlite3ErrorMsg(pParse, "unknown database %T", pName1);
75533 ** flag is true if the table should be stored in the auxiliary database
75534 ** file instead of in the main database file. This is normally the case
75557 int iDb; /* Database number to create the table in */
75574 ** set to the index of the database that the table or view is to be
75581 ** the database name is "temp" anyway. */
75622 ** index or table name in the same database. Issue an error message if
75662 ** then record a pointer to this table in the main database structure
75691 /* If the file format and encoding in the database have not been set,
76070 ** This function returns the collation sequence for database native text
76074 ** in the database native encoding, the collation factory is invoked to
76111 ** database changes. After each schema change, the cookie value
76113 ** cookie. Thereafter, whenever it goes to access the database,
76264 ** connected to the database or because the sqlite_master table has
76326 ** in the SQLITE_MASTER table of the database.
76329 ** file instead of into the main database file.
76368 ** a schema-lock excludes all other database users, the write-lock would
76444 /* Add the table to the in-memory representation of the database.
76562 sqlite3 *db = pParse->db; /* Database connection for malloc errors */
76649 ** Clear the column names from every VIEW in database idx.
76671 ** root-page of a table or index in database iDb has changed from iFrom
76708 ** Write code to erase the table with root-page iTable from database iDb.
76711 ** erasing iTable (this can happen with an auto-vacuum database).
76739 ** is also added (this can happen with an auto-vacuum database).
76750 /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM
76762 ** database, then root page 5 would be moved to page 4 by the
76926 ** created in the temp database that refers to a table in another
76927 ** database.
77126 sqlite3 *db = pParse->db; /* The database connection */
77219 DbFixer sFix; /* For assigning database names to pTable */
77222 Db *pDb; /* The specific table containing the indexed database */
77223 int iDb; /* Index of the database that is being written */
77244 /* Use the two-part index name to determine the database
77254 ** is a temp table. If so, set the database to 1. Do not do this
77255 ** if initialising a database schema.
77543 ** in-memory database structures.
77566 ** command. db->init.busy is 1 when a database is opened and
77893 sqlite3 *db, /* Database connection to notify of OOM errors */
77950 ** database name prefix. Like this: "database.table". The pDatabase
77951 ** points to the table name and the pTable points to the database name.
77954 ** SrcList.a[].zDatabase is filled with the database name from pTable,
77955 ** or with NULL if no database is specified.
77961 ** Then B is a table name and the database name is unspecified. If called
77966 ** Then C is the table name and B is the database name. If C is defined
77978 Token *pDatabase /* Database of the table */
78049 ** are the name of the table and database named in the FROM clause term.
78050 ** pDatabase is NULL if the database name qualifier is missing - the
78064 Token *pDatabase, /* Name of the database containing pTable */
78231 ** Make sure the TEMP database is open and available for use. Return
78248 sqlite3ErrorMsg(pParse, "unable to open a temporary database "
78265 ** a read-transaction for all named database files.
78274 ** record every database that needs its schema verified in the
78283 ** early in the code, before we know if any database tables will be used.
78313 ** might change the database.
78321 ** can be checked before any changes are made to the database, it is never
78346 ** perform this abort without corrupting the database, we need to make
78421 Db *pDb; /* A single database */
78422 int iDb; /* The database index number */
78423 sqlite3 *db = pParse->db; /* The database connection */
78425 Table *pTab; /* A table in the database */
78442 ** REINDEX ?<database>.?<tablename> -- 3
78443 ** REINDEX ?<database>.?<indexname> -- 4
78454 const char *zDb; /* Name of the database */
78455 Table *pTab; /* A table in the database */
78457 int iDb; /* The database index number */
78458 sqlite3 *db = pParse->db; /* The database connection */
78461 /* Read the database schema. If an error occurs, leave an error message
78507 ** with OP_OpenRead or OP_OpenWrite to access database index pIdx.
78615 ** If it is not NULL, then pColl must point to the database native encoding
78618 ** The return value is either the collation sequence to be used in database
78625 sqlite3* db, /* The database connection */
78653 database is loaded that contains references to collation sequences
78659 ** from the main database is substituted, if one is available.
78692 sqlite3 *db, /* Database connection */
78732 ** for the encoding 'enc' from the database 'db'.
78868 sqlite3 *db, /* An open database */
79217 Vdbe *v; /* The virtual database engine */
79219 const char *zDb; /* Name of database holding pTab */
79225 sqlite3 *db; /* Main database structure */
79228 int iDb; /* Database number */
79373 ** database scan. We have to delete items after the scan is complete
79929 ** the database handle that malloc() has failed and return NULL.
80972 ** returns (void *)db, where db is the sqlite3* database pointer.
81260 ** with the database handle. The counter is set to zero each time a
81261 ** database transaction is opened. Each time a statement is executed
81264 ** the database, the counter is decremented. When the transaction is
81272 ** * If the database contains foreign key violations when the
81545 int iDb, /* Index of database housing pTab */
81696 sqlite3 *db = pParse->db; /* Database handle */
81821 ** the lookaside buffer belonging to database handle dbMem.
81836 ** being dropped from the database. The SrcList passed as the second argument
81845 ** constraint violations in the database,
81848 ** the table from the database. Triggers are disabled while running this
81918 sqlite3 *db = pParse->db; /* Database handle */
81921 int iDb; /* Index of database containing pTab */
81922 const char *zDb; /* Name of database containing pTab */
82177 sqlite3 *db = pParse->db; /* Database handle */
82444 int iDb, /* The database index in sqlite3.aDb[] */
82551 ** Return non-zero if the table pTab in database iDb or any of its indices
82594 ** which is in database iDb. Return the register number for the register
82614 int iDb, /* Index of the database holding pTab */
82646 sqlite3 *db = pParse->db; /* The database connection */
82647 Db *pDb; /* Database only autoinc table */
82747 int iDbDest /* The database of pDest */
82860 sqlite3 *db; /* The main database structure */
82863 const char *zDb; /* Name of the database holding this table */
82878 int iDb; /* Index of database holding TABLE */
82879 Db *pDb; /* The database containing table being inserted into */
84032 int iDbDest /* The database of pDest */
84039 int iDbSrc; /* The database of pSrc */
84284 sqlite3 *db, /* The database on which the SQL executes */
85207 sqlite3 *db, /* Load the extension into this database connection */
85287 sqlite3 *db, /* Load the extension into this database connection */
85301 ** Call this routine when the database connection is closing in order
85372 ** loaded by every new database connection.
85433 ** If anything goes wrong, set an error in the database connection.
85556 ** backed temporary databases, 2 for the Red-Black tree in memory database
85595 ** If the TEMP database is open, close it and mark the database schema
85760 ** PRAGMA [database.]id [= value]
85766 ** If the left side is "database.id" then pId1 is the database name
85772 Token *pId1, /* First part of [database.]id field */
85773 Token *pId2, /* Second part of [database.]id field, or NULL */
85779 const char *zDb = 0; /* The database name */
85781 int iDb; /* Database index for <database> */
85789 /* Interpret the [database.] part of the pragma statement. iDb is the
85790 ** index of the database this pragma is being applied to in db.aDb[]. */
85795 /* If the temp database has been explicitly named as part of the
85818 ** PRAGMA [database.]default_cache_size
85819 ** PRAGMA [database.]default_cache_size=N
85825 ** stored in the database file.
85867 ** PRAGMA [database.]page_size
85868 ** PRAGMA [database.]page_size=N
85871 ** database page size in bytes. The second form sets the
85872 ** database page size value. The value can only be set if
85873 ** the database has not yet been created.
85893 ** PRAGMA [database.]secure_delete
85894 ** PRAGMA [database.]secure_delete=ON/OFF
85918 ** PRAGMA [database.]max_page_count
85919 ** PRAGMA [database.]max_page_count=N
85922 ** maximum number of pages in the database file. The
85926 ** PRAGMA [database.]page_count
85928 ** Return the number of pages in the specified database.
85948 ** PRAGMA [database.]locking_mode
85949 ** PRAGMA [database.]locking_mode = (normal|exclusive)
85958 ** the locking-mode of the main database).
85964 /* This indicates that no database name was specified as part
85995 ** PRAGMA [database.]journal_mode
85996 ** PRAGMA [database.]journal_mode =
86004 ** database files to be opened and the journal_modes set. */
86043 ** PRAGMA [database.]journal_size_limit
86044 ** PRAGMA [database.]journal_size_limit=N
86062 ** PRAGMA [database.]auto_vacuum
86063 ** PRAGMA [database.]auto_vacuum=N
86065 ** Get or set the value of the database 'auto-vacuum' parameter.
86090 ** creates the database file. It is important that it is created
86096 ** "incremental", write the value of meta[6] in the database
86098 ** that this really is an auto-vacuum capable database.
86123 ** PRAGMA [database.]incremental_vacuum(N)
86125 ** Do N steps of incremental vacuuming on a database.
86148 ** PRAGMA [database.]cache_size
86149 ** PRAGMA [database.]cache_size=N
86153 ** the persistent cache size value that is stored in the database
86158 ** to its default value when the database is closed and reopened.
86179 ** value will be restored the next time the database is opened.
86247 ** PRAGMA [database.]lock_proxy_file
86248 ** PRAGMA [database.]lock_proxy_file = ":auto:"|"lock_file_path"
86251 ** the value sets a specific file to be used for database access locks.
86289 ** PRAGMA [database.]synchronous
86290 ** PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL
86294 ** default value will be restored the next time the database is
86529 ** integrity_check designed to detect most database corruption
86566 /* Do an integrity check on each database file */
86582 ** for all tables and indices in the database.
86606 sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName),
86696 ** database. If the database is not initialized, it is initialized now.
86698 ** The second form of this pragma is a no-op if the main database file
86700 ** encoding that will be used for the main database file if a new file
86701 ** is created. If an existing main database file is opened, then the
86702 ** default text encoding for the existing database is used.
86705 ** created to use the same default text encoding as the main database. If
86706 ** the main database has not been initialized and/or created when ATTACH
86710 ** new database files created using this database handle. It is only
86711 ** useful if invoked immediately after the main database i
86740 /* Only change the value of sqlite.enc if the database handle is not
86741 ** initialized. If the main database exists, the new sqlite.enc value
86765 ** PRAGMA [database.]schema_version
86766 ** PRAGMA [database.]schema_version = <integer>
86768 ** PRAGMA [database.]user_version
86769 ** PRAGMA [database.]user_version = <integer>
86774 ** stored in the database header.
86777 ** is incremented by SQLite whenever the database schema is modified (by
86781 ** the database against which the compiled query is actually executed.
86784 ** crashes or database corruption. Use with caution!
86858 ** PRAGMA [database.]wal_checkpoint
86860 ** Checkpoint the database.
86871 ** Configure a database connection to automatically checkpoint a database
86896 sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "database", SQLITE_STATIC);
86992 ** interface, and routines that contribute to loading the database schema
86998 ** that the database is corrupt.
87009 "malformed database schema (%s)", zObj);
87020 ** database. See sqlite3Init() below for additional information.
87105 ** Attempt to read the database schema and initialize internal
87106 ** data structures for a single database file. The index of the
87107 ** database file is given by iDb. iDb==0 is used for the main
87108 ** database. iDb==1 should never be used. iDb>=2 is used for
87126 ** The master database table has a structure like this
87157 ** and initialisation script appropriate for the database being
87186 /* Create a cursor to hold the database open
87197 ** on the b-tree database, open one now. If a transaction is opened, it
87209 /* Get the database meta information.
87231 /* If opening a non-empty database, check the text encoding. For the
87232 ** main database, set sqlite3.enc to the encoding of the main database.
87239 /* If opening the main database, set ENC(db). */
87245 /* If opening an attached database, the encoding much match ENC(db) */
87248 " text encoding as main database");
87282 /* Ticket #2804: When we open a database in the newer file format,
87284 ** not downgrade the database and thus invalidate any descending
87353 ** Initialize all database files - the main database file, the file
87354 database files
87358 ** After a database is initialized, the DB_SchemaLoaded bit is set
87359 ** bit is set in the flags field of the Db structure. If the database
87378 ** for the TEMP database. This is loaded last, as the TEMP database
87400 ** This routine is a no-op if the database schema is already initialised.
87433 Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */
87437 ** on the b-tree database, open one now. If a transaction is opened, it
87448 /* Read the schema cookie from the database. If it does not match the
87465 ** which database file in db->aDb[] the schema refers to.
87467 ** If the same database is attached more than once, the first
87468 ** attached database is returned.
87499 sqlite3 *db, /* Database handle. */
87524 ** database schemas. The inability to get a read lock indicates that
87525 ** some other database connection is holding a write-lock, which in
87553 sqlite3Error(db, rc, "database schema is locked: %s", zDb);
87662 sqlite3 *db, /* Database handle. */
87734 sqlite3 *db, /* Database handle. */
87746 sqlite3 *db, /* Database handle. */
87764 sqlite3 *db, /* Database handle. */
87814 sqlite3 *db, /* Database handle. */
87826 sqlite3 *db, /* Database handle. */
88831 ** database table or a subquery.
89062 sqlite3 *db = pParse->db; /* Database connection */
89377 sqlite3 *db; /* Database connection */
89995 sqlite3 *db; /* Database connection */
90912 ** where table is a database table, not a sub-select or view. If the query
91530 sqlite3 *db; /* The database connection */
91724 ** Begin the database scan
91745 /* End the database scan loop.
92377 ** Query the database. But instead of invoking a callback for each row,
92387 sqlite3 *db, /* The database on which the SQL executes */
92504 ** All of the triggers on pTab that are in the same database as pTab
92561 sqlite3 *db = pParse->db; /* The database connection */
92562 int iDb; /* The database to store the trigger in */
92565 int iTabDb; /* Index of the database holding pTab */
92588 ** then set iDb to 1 to create the trigger in the temporary database.
92601 /* Ensure the table name matches database name and that the table exists */
92615 ** and the table is dropped by a different database connection, the
92616 ** trigger is not visible to the database connection that does the
92727 sqlite3 *db = pParse->db; /* The database */
92729 int iDb; /* Database containing the trigger */
92820 sqlite3 *db, /* Database connection */
92845 sqlite3 *db, /* The database connection */
92878 sqlite3 *db, /* The database connection */
92903 sqlite3 *db, /* Database connection */
92932 ** This function is called to drop a trigger from the database schema.
93012 /* Generate code to destroy the database record of the trigger.
93112 ** This routine adds a specific database name, if needed, to the target when
93113 ** forming the SrcList. This prevents a trigger in one database from
93114 ** referring to a target in another database. An exception is when the
93115 ** trigger is in TEMP in which case it can refer to any other database it
93122 int iDb; /* Index of the database to use */
93260 sqlite3 *db = pParse->db; /* Database handle */
93663 Vdbe *v; /* The virtual database engine */
93667 sqlite3 *db; /* The database structure */
93677 int iDb; /* Database containing the table being updated */
93737 /* Allocate a cursors for the main database table and for all indices.
93739 ** need to occur right after the database cursor. So go ahead and
93876 /* Begin the database scan
93891 /* End the database scan loop.
93983 ** the database after the BEFORE triggers are fired anyway (as the trigger
94176 sqlite3 *db = pParse->db; /* Database connection */
94267 ** Execute zSql on database db. Return an error code.
94285 ** Execute zSql on database db. The statement returns exactly
94286 ** one column. Execute this as SQL on the same database.
94307 ** The non-standard VACUUM command is used to clean up the database,
94312 ** gdbm_reorganize() on all the database tables. But beginning
94329 Btree *pMain; /* The database being vacuumed */
94330 Btree *pTemp; /* The temporary database we vacuum into */
94336 Db *pDb = 0; /* Database to detach at end of vacuum */
94337 int isMemDb; /* True if vacuuming a :memory: database */
94350 /* Save the current value of the database flags so that it can be
94364 /* Attach the temporary database as 'vacuum_db'. The synchronous pragma
94366 ** occurs anyway. The integrity of the database is maintained by a
94367 ** (possibly synchronous) transaction opened on the main database before
94392 /* The call to execSql() to attach the temp database has left the file
94400 /* A VACUUM cannot change the pagesize of an encrypted database. */
94411 /* Do not attempt to change the page size for a WAL database */
94438 /* Query the schema of the main database. Create a mirror schema
94439 ** in the temporary database.
94456 /* Loop through the tables in the main database. For each, do
94458 ** the contents to the temporary database.
94484 /* Copy the triggers, views, and virtual tables from the main database
94485 ** over to the temporary database. None of these objects has any
94499 ** transaction open on the vacuum database, but not on the main database.
94500 ** Open a btree level transaction on the main database. This allows a
94501 ** call to sqlite3BtreeCopyFile(). The main database btree level
94504 ** temporary database never needs to be committed.
94514 ** connections to the same database will know to reread the schema.
94556 ** database. No locks are held on any other files (since the main file
94559 ** vacuum database. The vacuum_db journal file is deleted when the pager
94599 sqlite3 *db, /* Database in which module is registered */
94641 sqlite3 *db, /* Database in which module is registered */
94653 sqlite3 *db, /* Database in which module is registered */
94711 ** database connections to be disconnected at the next opportunity.
94720 /* Assert that the mutex (if any) associated with the BtShared database
94724 ** database connection that may have an entry in the p->pVTable list. */
94758 ** associated with the database handle itself must be held.
94762 ** associated with the database the virtual table is stored in is held
94763 ** or, if the virtual table is stored in a non-sharable database, then
94764 ** the database handle mutex is held.
94794 ** The reference count of the VTable structure associated with database
94798 ** database connection.
94844 Token *pName1, /* Name of new table, or database name */
94848 int iDb; /* The database the table is being created in */
94850 sqlite3 *db; /* Database connection */
94901 sqlite3 *db = pParse->db; /* The database connection */
95169 ** of the virtual table named zTab in database iDb.
95272 ** of the virtual table named zTab in database iDb. This occurs
95432 sqlite3 *db, /* Database connection for reporting malloc problems */
96164 sqlite3 *db = pParse->db; /* Database connection */
96347 ** to "bitmap indices" in other database engines.
96360 sqlite3 *db = pParse->db; /* Database connection */
96622 sqlite3 *db = pParse->db; /* Database connection */
97736 Parse *pParse, /* Database connection */
98739 sqlite3 *db = pParse->db; /* Database handle */
99592 Vdbe *v = pParse->pVdbe; /* The virtual database engine */
99600 sqlite3 *db; /* Database connection */
99721 ** pWInfo->a[].iTabCur The VDBE cursor for the database table
99946 int iDb; /* Index of database containing table/index */
101006 26, /* DATABASE => ID */
101120 "DATABASE", "DESC", "DETACH", "EACH",
101485 /* 305 */ "database_kw_opt ::= DATABASE",
103367 /* (305) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==305);
103854 testcase( i==16 ); /* DATABASE */
104300 database connection */
105049 ** there are outstanding database connections or memory allocations or
105082 ** database connections or memory allocations. This routine is not
105108 /* Disable mutexing of database connections */
105239 ** Set up the lookaside buffers for a database connection.
105303 ** Return the mutex associated with a database connection.
105310 ** Configuration settings for an individual database connection
105408 ** Return the number of changes since the database handle was opened.
105416 ** database handle object, it does not close any savepoints that may be open
105448 ** Close an existing SQLite database
105556 /* The temp-database schema is allocated differently from the other schema
105559 ** the same sqliteMalloc() as the one that allocates the database
105575 ** Rollback all database files.
105615 /* SQLITE_ERROR */ "SQL logic error or missing database",
105619 /* SQLITE_BUSY */ "database is locked",
105620 /* SQLITE_LOCKED */ "database table is locked",
105622 /* SQLITE_READONLY */ "attempt to write a readonly database",
105625 /* SQLITE_CORRUPT */ "database disk image is malformed",
105627 /* SQLITE_FULL */ "database or disk is full",
105628 /* SQLITE_CANTOPEN */ "unable to open database file",
105631 /* SQLITE_SCHEMA */ "database schema has changed",
105638 /* SQLITE_FORMAT */ "auxiliary database format error",
105640 /* SQLITE_NOTADB */ "file is encrypted or is not a database",
105657 void *ptr, /* Database connection */
105715 ** This routine sets the busy callback for an Sqlite database to the
105733 ** This routine sets the progress callback for an Sqlite database to the
106032 sqlite3 *db, /* Attach the hook to this database */
106047 ** inserted or deleted using this database connection.
106050 sqlite3 *db, /* Attach the hook to this database */
106065 ** back by this database connection.
106068 sqlite3 *db, /* Attach the hook to this database */
106091 const char *zDb, /* Database */
106105 ** a database after committing a transaction if there are nFrame or
106130 ** into the write-ahead-log by this database connection.
106152 ** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points
106169 sqlite3Error(db, SQLITE_ERROR, "unknown database: %s", zDb);
106182 ** Run a checkpoint on database iDb. This is a no-op if database iDb is
106185 ** If a transaction is open on the database being checkpointed, this
106190 ** The mutex on database handle db should be held by the caller. The mutex
106222 ** SQLITE_TEMP_STORE db->temp_store Location of temporary database
106312 ** sqlite3ApiExit(), to avoid setting the database handle error message.
106345 ** Create a new collating function for database "db". The name is zName
106525 ** This routine does the work of opening a database on behalf of
106526 ** sqlite3_open() and sqlite3_open16(). The database filename "zFilename"
106530 const char *zFilename, /* Database filename UTF-8 encoded */
106531 sqlite3 **ppDb, /* OUT: Returned database handle */
106667 /* Open the backend database driver */
106682 /* The default safety_level for the main database is 'full'; for the temp
106683 ** database it is 'NONE'. This matches the pager layer defaults.
106696 ** database schema yet. This is delayed until the first time the database
106778 ** Open a new database handle.
106788 const char *filename, /* Database filename (UTF-8) */
106798 ** Open a new database handle.
106835 ** Register a new collation sequence with the database handle db.
106854 ** Register a new collation sequence with the database handle db.
106875 ** Register a new collation sequence with the database handle db.
106900 ** Register a collation sequence factory callback with the database handle
106918 ** Register a collation sequence factory callback with the database handle
106946 ** Test to see whether or not the database connection is in autocommit
106971 "database corruption at line %d of [%.10s]",
107004 ** Return meta information about a specific column of a database table.
107010 const char *zDbName, /* Database name or NULL */
107031 /* Ensure the database schema has been loaded */
107143 ** Invoke the xFileControl method on a particular database.
107256 ** an incompatible database file format. Changing the PENDING byte
107257 ** while any database connection is open results in undefined and
107325 ** Set the nReserve size to N for the main database on the database
107588 sqlite3Error(db, rc, (rc?"database is deadlocked":0));
107610 ** the transaction opened by database db has just finished. Locks held
107611 ** by database connection db have been released.
107723 ** This is called when the database connection passed as an argument is
108429 sqlite3 *db; /* The database connection */
108430 const char *zDb; /* logical database name */
108444 int nPgsz; /* Page size for host database */
108480 int nRowAvg; /* Average size of database rows, in pages */
108828 sqlite3 *db, /* Database in which to run SQL */
108920 sqlite3 *db = p->db; /* The database connection */
108969 ** Store the current database page-size in bytes in p->nPgsz.
109035 ** argv[1] -> database name
109041 sqlite3 *db, /* The SQLite database connection */
109057 int nDb; /* Bytes required to hold database name */
109189 ** database. TODO: For xConnect(), it could verify that said tables exist.
109195 /* Figure out the page-size for the database. This is required in order to
109196 ** estimate the cost of loading large doclists from the database (see
109224 sqlite3 *db, /* Database connection */
109234 sqlite3 *db, /* Database connection */
110426 ** prefix) from the database.
110432 ** in the database without the found length specifier at the start of on-disk
111390 ** hash-table to the database.
111409 ** the pending-terms hash-table have already been flushed into the database
111420 ** hash-table. Any changes made to the database are reverted by SQLite.
111598 ** function merges all segments in the database to a single segment.
111700 sqlite3 *db = p->db; /* Database connection */
111760 ** FTS3 enabled database connection is closed). It frees the memory
112801 ** with database connection db.
114263 ** Set up SQL objects in database db used to access the contents of
114273 ** comment above struct HashTableVtab) to the database schema. Both
114396 ** track such information in the database, then we'd only want this
114674 ** database. The internal details of this type are only accessed by the
115406 ** on the database file for longer than necessary). Thus, any virtual table
115634 int pgsz = p->nPgsz; /* Database page size */
115764 ** the contents of the pending-terms hash table to the database.
116117 ** the database contain two terms that share a prefix of almost 2KB,
116212 ** database. Then call this function recursively to write the parent of
116213 ** pTree and its peers to the database.
116215 ** Except, if pTree is a root node, do not write it to the database. Instead,
116219 ** set to the largest blockid written to the database (or zero if no
116347 /* The current leaf node is full. Write it out to the database. */
116355 ** to the database (still available in pWriter->zTerm), and
116426 ** database. This function must be called after all terms have been added
116438 sqlite3_int64 iLast = 0; /* Largest block id written to database */
116498 ** Set *pnSegment to the number of segments of level iLevel in the database.
116517 ** Set *pnSegment to the total number of segments in the database. Set
116518 ** *pnMax to the largest segment level in the database (segment levels
116649 ** of the pending-terms hash table to the database.
116707 ** comes about only when reading from an empty database.
116845 ** Merge all level iLevel segments in the database into a single
116848 ** currently present in the database.
116851 ** segment in the database, SQLITE_DONE is returned immediately.
116868 /* This call is to merge all segments in the database to a single
116870 ** greatest segment level currently present in the database. The index
116980 ** writes each term (along with its doclist) to the database via the
116994 ** database. Then delete the SegmentWriter and Fts3SegReader objects
117424 ** merge all segments in the database (including the new segment, if
117536 sqlite3_int64 nDoc; /* Number of docs in database */
119106 ** Database Format of R-Tree Tables
119230 sqlite3 *db; /* Host database connection */
119235 char *zDb; /* Name of database containing r-tree table */
119529 ** node contents out to the database.
119693 ** If the node is dirty, write it out to the database.
119719 ** count drops to zero, the node data is written to the database.
122026 ** using database connection db. If successful, the integer value returned
122055 ** Otherwise, for an xCreate(), use 64 bytes less than the database page-size.
122056 ** This ensures that each node is stored on a single database page. If the
122057 ** database page-size is so large that more than RTREE_MAXCELLS entries
122061 sqlite3 *db, /* Database handle */
122094 ** argv[1] -> database name
122099 sqlite3 *db, /* Database connection */
122146 /* Create/Connect to the underlying relational database schema. If
122253 ** Register the r-tree module with database handle db. This creates the
122753 ** types to an SQLite database connection. It is intended to be called
122799 ** Register the ICU extension functions with database db.