Lines Matching refs:Schema
788 #define SQLITE_SCHEMA 17 /* The database schema changed */
1557 ** for the given schema. The fourth parameter to [sqlite3_file_control()]
2663 ** triggers in the main database schema or in the schemas of [ATTACH]-ed
2680 ** views in the main database schema or in the schemas of ATTACH-ed
2720 ** schema. This option does not follow the
2725 ** will become the new schema name in place of "main". ^SQLite does
2726 ** not make a copy of the new main schema name string, so the application
2779 ** with no schema and no content. The following process works even for
2783 ** database schema by preparing then discarding some query against the
2878 ** created database files to have a schema format version number (the 4-byte
3775 ** schema change. Hence, the application should ensure that the
3782 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
4025 ** and similar because those routines might force a reparse of the schema
4789 ** the database schema. In other words, the SQLITE_PREPARE_FROM_DDL flag
4796 ** is derived from parts of the database schema. In particular, virtual
4880 ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
4899 ** a schema change, on the first [sqlite3_step()] call following any change
5528 ** ^(For example, given the database schema:
6042 ** the database schema. This flag is especially recommended for SQL
6044 ** Without this flag, an attacker might be able to modify the schema of
6228 ** schema structures such as [CHECK constraints], [DEFAULT clauses],
6235 ** into using a database file that has had its schema surreptitiously
6242 ** inside of the database schema, and thus ensures that the database
6261 ** schema structures such as [CHECK constraints], [DEFAULT clauses],
7300 ** CAPI3REF: Return The Schema Name For A Database Connection
7303 ** ^The sqlite3_db_name(D,N) interface returns a pointer to the schema name
7306 ** the "temp" schema. Larger values of N correspond to various ATTACH-ed
7311 ** changes the schema, including [ATTACH] or [DETACH] or calls to
7368 ** [transaction state] of schema S in database connection D. ^If S is NULL,
7369 ** then the highest transaction state of any schema on database connection D
7377 ** a valid schema, then -1 is returned.
7387 ** constants in order to describe the transaction state of schema S
7487 ** the schema-name of the attached database that is being autovacuumed,
7613 ** and schema data structures between [database connection | connections]
7831 ** any errors are encountered while loading the schema.
8361 ** CAPI3REF: Declare The Schema Of A Virtual Table
9445 ** memory used to store the schema for all databases associated
9448 ** schema memory is shared with other database connections due to
9595 ** automatically regenerated due to schema changes or changes to
11282 ** schema S in database connection D. ^On success, the
11285 ** If there is not already a read-transaction open on schema S when
11304 ** <li> Schema S of [database connection] D must be a [WAL mode] database.
11306 ** <li> There must not be a write transaction open on schema S of database
11318 ** whether or not a read transaction is opened on schema S is undefined.
11338 ** transaction or upgrades an existing one for schema S of
11346 ** is already a read transaction open on schema S, then the database handle
11350 ** if schema S does not exist, or if the snapshot object is invalid.
11366 ** schema S is in [WAL mode]. A database connection might not know
12018 ** some of the rules above. In SQLite, the schema of sqlite_stat1 is:
12101 ** a database with a compatible schema using the [sqlite3changeset_apply()]
12743 ** CAPI3REF: Add a Schema to a Changegroup
12747 ** added to the changegroup handle must match the schema of database zDb
12750 ** with the configured schema, SQLITE_SCHEMA is returned and the changegroup
12753 ** A changeset schema is considered compatible with the database schema in
12764 ** The output of the changegroup object always has the same schema as the
12767 ** in the database schema, these are filled in using the default column
12768 ** values from the database schema. This makes it possible to combined
12843 ** object has been configured with a database schema using the
13733 ** configured with schema data for the specified table. It may be configured
13736 ** table. If the changegroup object has not been configured with a schema for
16272 ** Name of table that holds the database schema.
16295 ** The root-page of the schema table.
16300 ** The name of the schema table. The name is different for TEMP.
16385 typedef struct Schema Schema;
17483 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
18498 char *zDbSName; /* Name of this database. (schema name, not filename) */
18502 Schema *pSchema; /* Pointer to database schema (possibly shared) */
18506 ** An instance of the following structure stores a database schema.
18508 ** Most Schema objects are associated with a Btree. The exception is
18509 ** the Schema for the TEMP database (sqlite3.aDb[1]) which is free-standing.
18510 ** In shared cache mode, a single Schema object can be shared by multiple
18513 ** Schema objects are automatically deallocated when the last Btree that
18514 ** references them is destroyed. The TEMP Schema is manually freed by
18518 ** to access Schema content. This implies that the thread must also be
18520 ** For a TEMP Schema, only the connection mutex is required.
18522 struct Schema {
18523 int schema_cookie; /* Database schema version number for this file */
18530 u8 file_format; /* Schema format version for this file */
18532 u16 schemaFlags; /* Flags associated with this schema */
18548 ** The DB_SchemaLoaded flag is set after the database schema has been
18552 ** have been filled out. If the schema changes, these column names might
18555 #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */
18557 #define DB_ResetWanted 0x0008 /* Reset the schema when nSchemaLock==0 */
18579 ** with a particular database connection. Hence, schema information cannot
18580 ** be stored in lookaside because in shared cache mode the schema information
18582 ** schema information, the Lookaside.bEnabled flag is cleared so that
18583 ** lookaside allocations are not used to construct the schema objects.
18696 u32 nSchemaLock; /* Do not reset the schema when non-zero */
18860 ** vtabs in the schema definition */
18881 #define SQLITE_NoSchemaError 0x08000000 /* Do not report schema parse errors*/
18913 #define DBFLAG_SchemaKnownOk 0x0010 /* Schema is known to be valid */
19386 ** the database schema.
19388 ** If the database schema is shared, then there is one instance of this
19390 ** schema. This is because each database connection requires its own unique
19394 ** schema is shared, as the implementation often stores the database
19403 ** database schema are initially stored in a linked-list pointed to by
19411 ** schema is being reloaded for some reason), the VTable objects are not
19432 u8 bAllSchemas; /* True if might use any attached schema */
19445 ** The schema for each SQL table, virtual table, and view is represented
19480 char **azArg; /* 0: module 1: schema 2: vtab name 3...: args */
19485 Schema *pSchema; /* Schema that contains this table */
19605 ** is held in Schema.fkeyHash with a hash key of Z.
19807 ** table as part of parsing an existing database schema), transient instances
19820 Schema *pSchema; /* Schema containing this index */
20042 ** Expr objects can use a lot of memory space in database schema. To
20419 Schema *pSchema; /* Schema to which this item is fixed */
20929 bft checkSchema :1; /* Causes schema cookie check after an error */
20945 yDbMask cookieMask; /* Bitmask of schema verified databases */
20970 Token sNameToken; /* Token with unqualified schema object name */
21102 ** Each trigger present in the database schema is stored as an instance of
21125 Schema *pSchema; /* Schema containing the trigger */
21126 Schema *pTabSchema; /* Schema containing the table */
21307 u8 bExtraSchemaChecks; /* Verify type,name,tbl_name in schema */
21435 Schema *pSchema; /* Fix items to this schema */
21436 u8 bTemp; /* True for TEMP schema entries */
22311 SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
22523 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
22524 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *);
24827 Table *pTab; /* Schema object being updated */
25297 ** to store the schema for all databases (main, temp, and any ATTACHed
25309 Schema *pSchema = db->aDb[i].pSchema;
40769 ** schema:
55989 ** Translate a database connection pointer and schema name into a
72154 ** 40 4 Schema cookie
72155 ** 44 4 File format of schema layer
72418 ** schema associated with the database file are all contained within
73050 ** db->aDb[iDb].pSchema structure. The mutexes required for schema
73059 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
73202 ** Enable or disable the shared pager and schema features.
73331 ** function has to search through the database schema.
73334 ** hold a write-lock on the schema table (root page 1). This is also
73343 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
73357 /* If the client is reading or writing an index and the schema is
73393 ** write-lock on the schema table, or (if the client is reading) a
76666 ** consisting of a single page and no schema objects). Return SQLITE_OK
76716 int *pSchemaVersion /* Put schema version number here, if not NULL */
77575 ** rolled back modified the database schema. In this case b-tree root
82546 /* This can only happen if the schema is corrupt such that there is more
82549 ** the schema was loaded. This cannot be asserted though, as a user might
82550 ** set the flag, load the schema, and then unset the flag. */
83535 ** The schema layer numbers meta values differently. At the schema
84467 ** purposes (for example, to store a high-level schema associated with
84486 assert( nBytes==0 || nBytes==sizeof(Schema) );
84714 u32 iDestSchema; /* Original schema cookie in destination */
85102 /* Update the schema version field in the destination database. This
85103 ** is to make sure that the schema-version really does change in
85105 ** same schema version.
94296 ** schema change has occurred. That detail is handled by the
94438 ** sqlite3Step() to do most of the work. If a schema error occurs,
95211 ** as if there had been a schema change, on the first sqlite3_step() call
97304 u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
99981 ** as the schema format is 2 or more and none of the omitted columns
100537 ** If P5!=0 then this opcode also checks the schema cookie against P3
100538 ** and the schema generation counter against P4.
100539 ** The cookie changes its value whenever the database schema changes.
100541 ** and that the current process needs to reread the schema. If the schema
100542 ** cookie in P3 differs from the schema cookie in the database header or
100543 ** if the schema generation counter in P4 differs from the current
100615 ** IMPLEMENTATION-OF: R-03189-51135 As each SQL statement runs, the schema
100616 ** version is checked to ensure that the schema has not changed since the
100620 p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
100621 /* If the schema-cookie from the database file matches the cookie
100622 ** stored with the in-memory representation of the schema, do
100623 ** not reload the schema from the database file.
100629 ** discard the database schema, as the user code implementing the
100652 ** P3==1 is the schema version. P3==2 is the database format.
100683 ** P2==1 is the schema version. P2==2 is the database format.
100691 ** schema version is set to P3-P5. The "PRAGMA schema_version=N" statement
100692 ** has P5 set to 1, so that the internal schema version will be different
100693 ** from the database schema version, resulting in a schema reset.
100709 /* When the schema cookie changes, record the new cookie internally */
100719 ** schema is changed. Ticket #1644 */
103553 ** Read and parse all entries from the schema table of database P1
103555 ** entire schema for P1 is reparsed.
103652 ** schema consistent with what is on disk.
103666 ** schema consistent with what is on disk.
103680 ** schema consistent with what is on disk.
104650 ** The P2==1 case occurs when a CREATE INDEX or similar schema change happens
104848 ** P4 is a pointer to a Table object that is a virtual table in schema P1
109209 const char *zSchema; /* tables_used.schema */
109228 /* bytecode() schema */
109244 /* Tables_used() schema */
109247 "schema TEXT,"
109378 Schema *pSchema;
109471 case 21: /* tables_used.schema */
110549 ** Return TRUE (non-zero) if zTab is a valid name for the schema table pTab.
110553 Table *pTab, /* The schema table we are trying to match */
110617 Schema *pSchema = 0; /* Schema of the expression */
110632 /* Translate the schema name in zDb into a pointer to the corresponding
110633 ** schema. If not found, pSchema will remain NULL and nothing will match
112632 ** schema elements */
113939 ** that the schema is possibly tainted).
114470 ** part of the in-memory representation of the database schema.
115178 ** when parsing an existing schema out of the sqlite_schema table and 4
115184 ** malformed schema error.
115896 ** to NOT NULL constraints in the schema). If no NULL values are possible,
120400 ** statement to ensure that the operation has not rendered any schema
120405 const char *zDb, /* Name of db to verify schema of */
120408 int bNoDQS /* Do not allow DQS in the schema */
120458 ** Generate code to reload the schema for database iDb. And, if iDb!=1, for
120550 /* Begin a transaction for database iDb. Then modify the schema cookie
120551 ** (since the ALTER TABLE modifies the schema). Call sqlite3MayAbort(),
120565 ** the schema to use the new table name. */
120645 const char *zDb, /* Schema holding the table */
120780 /* Make sure the schema version is at least 3. But do not upgrade
120960 const char *zDb; /* Name of schema containing the table */
120961 int iSchema; /* Index of the schema */
120972 /* Which schema holds the table to be altered */
120994 /* Ensure the schema contains no double-quoted strings */
121024 /* Drop and reload the database schema. */
121505 const char *zDb, /* Name of schema SQL belongs to */
121508 int bTemp /* True if SQL is from temp schema */
121687 ** it was read from the schema of database zDb. Return SQLITE_OK if
121869 ** 8. bTemp: True if zSql comes from temp schema
122094 ** 3: The complete text of the schema statement being modified,
122097 ** 6: True if the schema statement comes from the temp db.
122099 ** It returns the new schema statement. For example:
122271 ** the database schema:
122380 ** After an ALTER TABLE .. RENAME operation is performed and the schema
122381 ** reloaded, this function is called on each SQL statement in the schema
122388 ** 4: True if object is from temp schema.
122519 ** argv[0]: An integer - the index of the schema containing the table
122667 /* Drop and reload the database schema. */
123096 const char **pzDb, /* OUT: write name of schema here */
123167 /* Finally, reload the database schema. */
123273 /* Finally, reload the database schema. */
123342 int iDb = 0; /* Which schema does pTab live in */
123343 const char *zDb = 0; /* Name of the schema in which pTab lives */
123385 /* Finally, reload the database schema. */
124805 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
124876 /* Read the database schema. If an error occurs, leave an error message
124891 /* Analyze the schema named as the argument */
125356 Schema *pSchema = db->aDb[iDb].pSchema;
125537 Schema *pNewSchema = sqlite3SchemaGet(db, pNewBt);
125539 /* Both the Btree and the new Schema were allocated successfully.
125575 /* Allocate the new entry in the db->aDb[] array and initialize the schema
125591 ** it to obtain the database schema. At this point the schema may
125645 /* If the file was opened successfully, read the schema for the new database.
125744 /* If any TEMP triggers reference the schema being detached, move those
125745 ** triggers to reference the TEMP schema itself. */
126160 char *zDb = db->aDb[iDb].zDbSName; /* Schema name of attached database */
126188 Schema *pSchema, /* The schema of the expression */
126510 ** transaction on each used database and to verify the schema cookie
126518 Schema *pSchema;
126653 /* All mutexes are required for schema access. Make sure we hold them. */
126661 ** to schema 0 as a legacy fallback. */
126729 /* Read the database schema. If an error occurs, leave an error message
126740 /* If zName is the not the name of a table in the schema created using
126789 ** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be
126841 /* All mutexes are required for schema access. Make sure we hold them. */
126845 Schema *pSchema = db->aDb[j].pSchema;
126934 ** Reset the schema for the database at index iDb. Also reset the
126935 ** TEMP schema. The reset is deferred if db->nSchemaLock is not zero.
126959 ** Erase all schema information from all attached databases (including
127106 ** contains lookaside memory. (Table objects in the schema do not use
127115 /* Record the number of outstanding lookaside allocations in schema Tables
127116 ** prior to doing any free() operations. Since schema Tables do not use
127166 /* Verify that no lookaside memory was used by schema tables */
127334 ** unqualified name for a new schema object (table, index, view or
127535 /* Special case: Parsing the sqlite_schema or sqlite_temp_schema schema */
127632 ** the schema table. Note in particular that we must go ahead
128341 ** Generate code that will increment the schema cookie.
128343 ** The schema cookie is used to determine when the schema for the
128344 ** database changes. After each schema change, the cookie value
128345 ** changes. When a process first reads the schema it records the
128347 ** it checks the cookie to make sure the schema has not changed
128351 ** the schema to change multiple times and for the cookie to be
128352 ** set back to prior value. But schema changes are infrequent
128357 ** the schema-version whenever the schema changes.
128645 ** internal schema data structures and the generated VDBE code so that they
128649 ** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL.
128656 ** schema to the rootpage from the main table.
128754 ** a database schema). */
128847 ** tables within the same schema looking for shadow tables of pTab, and mark
128937 ** An entry for the table is made in the schema table on disk, unless
129080 ** illegal in a schema and will lead to errors or heap corruption
129103 ** in the schema table of the database.
129144 ** as a schema-lock must have already been obtained to create it. Since
129145 ** a schema-lock excludes all other database users, the write-lock would
129211 ** schema table. We just need to update that slot with all
129263 Schema *pSchema = p->pSchema;
129379 /* Use sqlite3EndTable() to add the view to the schema table */
129550 ** This function is called by the VDBE to adjust the internal schema
129593 ** Also write code to modify the sqlite_schema table and internal schema
129600 if( iTable<2 ) sqlite3ErrorMsg(pParse, "corrupt schema");
129623 ** Code to update the sqlite_schema tables and internal schema definitions
129741 /* Drop all entries in the schema table that refer to the
129742 ** table. The program name loops through the schema table and deletes
129756 /* Remove the table entry from SQLite's internal schema and modify
129757 ** the schema cookie.
129896 /* Generate code to remove the table from the schema table
130315 ** if initializing a database schema.
130376 ** sqlite_schema table (because some other process changed the schema) and
130727 ** table to parse the schema, or if this index is the PRIMARY KEY index
130782 /* Fill the index with data and reparse the schema. Code an OP_Expire
130957 /* Generate code to remove the index and from the schema table */
131665 ** Record the fact that the schema cookie will need to be verified
131666 ** for database iDb. The code to actually verify the schema cookie
131889 /* Read the database schema. If an error occurs, leave an error message
131992 ** schema. Adding the missing collating sequence later does not
131997 ** Except, do not do this if the index is not in the schema hash
132614 ** Free all resources held by the schema structure. The void* argument points
132615 ** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the
132617 ** of the schema hash tables).
132619 ** The Schema.cache_size variable is not cleared.
132625 Schema *pSchema = (Schema *)p;
132653 ** Find and return the schema associated with a BTree. Create
132656 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
132657 Schema * p;
132659 p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear);
132661 p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));
136793 ** Implementation of sqlite_filestat(SCHEMA).
136796 ** about the sqlite3_file object associated with SCHEMA.
137316 ** search the schema for a unique index on the parent key columns.
137834 ** given the following schema:
137871 ** in a particular database. This needs to happen when the schema
137934 ** any modifications to the schema are made. This is because statement
137935 ** transactions are not able to rollback schema changes.
138103 ** schema items cannot be located, set an error in pParse and return
138371 ** the following schema:
138617 ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
139324 ** b) The schema is currently being parsed (i.e. the VALUES clause is part
139325 ** of a schema item like a VIEW or TRIGGER). In this case there is no VM
139375 /* Ensure the database schema has been read. This is to ensure we have
141395 /* Records with omitted columns are only allowed for schema format
141862 return 0; /* Corrupt schema - two indexes on the same btree */
143979 #define PragFlg_NeedSchema 0x01 /* Force schema load before running */
143985 #define PragFlg_SchemaOpt 0x40 /* Schema restricts name search if present */
143986 #define PragFlg_SchemaReq 0x80 /* Schema required - "main" is default */
144015 /* 21 */ "schema", /* Used by: table_list */
144734 ** If the TEMP database is open, close it and mark the database schema
144970 ** PRAGMA [schema.]id [= value]
144982 Token *pId1, /* First part of [schema.]id field */
144983 Token *pId2, /* Second part of [schema.]id field, or NULL */
145003 /* Interpret the [schema.] part of the pragma statement. iDb is the
145076 /* Make sure the database schema is loaded if the pragma requires that */
145093 ** PRAGMA [schema.]default_cache_size
145094 ** PRAGMA [schema.]default_cache_size=N
145145 ** PRAGMA [schema.]page_size
145146 ** PRAGMA [schema.]page_size=N
145172 ** PRAGMA [schema.]secure_delete
145173 ** PRAGMA [schema.]secure_delete=ON/OFF/FAST
145202 ** PRAGMA [schema.]max_page_count
145203 ** PRAGMA [schema.]max_page_count=N
145214 ** PRAGMA [schema.]page_count
145239 ** PRAGMA [schema.]locking_mode
145240 ** PRAGMA [schema.]locking_mode = (normal|exclusive)
145285 ** PRAGMA [schema.]journal_mode
145286 ** PRAGMA [schema.]journal_mode =
145330 ** PRAGMA [schema.]journal_size_limit
145331 ** PRAGMA [schema.]journal_size_limit=N
145350 ** PRAGMA [schema.]auto_vacuum
145351 ** PRAGMA [schema.]auto_vacuum=N
145404 ** PRAGMA [schema.]incremental_vacuum(N)
145427 ** PRAGMA [schema.]cache_size
145428 ** PRAGMA [schema.]cache_size=N
145450 ** PRAGMA [schema.]cache_spill
145452 ** PRAGMA [schema.]cache_spill=N
145469 ** not just the schema specified.
145493 ** PRAGMA [schema.]mmap_size(N)
145643 ** PRAGMA [schema.]lock_proxy_file
145644 ** PRAGMA [schema.]lock_proxy_file = ":auto:"|"lock_file_path"
145679 ** PRAGMA [schema.]synchronous
145680 ** PRAGMA [schema.]synchronous=OFF|ON|NORMAL|FULL|EXTRA
145734 /* IMP: R-60817-01178 If the argument is "RESET" then schema
145736 ** in addition, the schema is reloaded. */
145821 ** entire schema.
145823 ** schema: Name of attached database hold this table
146103 HashElem *k; /* Loop counter: Next table in schema */
146246 ** schema, use the form:
146248 ** PRAGMA schema.integrity_check;
146288 HashElem *x; /* For looping over tables in the schema */
146289 Hash *pTbls; /* Set of all tables in the schema */
146825 ** will be overwritten when the schema is next loaded. If it does not
146848 ** PRAGMA [schema.]schema_version
146849 ** PRAGMA [schema.]schema_version = <integer>
146851 ** PRAGMA [schema.]user_version
146852 ** PRAGMA [schema.]user_version = <integer>
146854 ** PRAGMA [schema.]freelist_count
146856 ** PRAGMA [schema.]data_version
146858 ** PRAGMA [schema.]application_id
146859 ** PRAGMA [schema.]application_id = <integer>
146862 ** the value of the schema-version and user-version, respectively. Both
146863 ** the schema-version and the user-version are 32-bit signed integers
146866 ** The schema-cookie is usually only manipulated internally by SQLite. It
146867 ** is incremented by SQLite whenever the database schema is modified (by
146868 ** creating or dropping a table or index). The schema version is used by
146870 ** of the schema used when compiling the SQL query matches the schema of
146873 ** the schema-version is potentially dangerous and may lead to program
146944 ** PRAGMA [schema.]wal_checkpoint = passive|full|restart|truncate
147002 ** PRAGMA schema.optimize
147003 ** PRAGMA schema.optimize(MASK)
147006 ** two forms, and only the specified schema is optimized in the latter two.
147073 int iDbLast; /* Loop termination point for the schema loop */
147075 HashElem *k; /* Loop over tables of a schema */
147076 Schema *pSchema; /* The current schema */
147077 Table *pTab; /* A table in the schema */
147180 /* In a schema with a large number of tables and indexes, scale back
147364 char *azArg[2]; /* Value of the argument and schema */
147403 sqlite3_str_appendall(&acc, ",schema HIDDEN");
147676 ** interface, and routines that contribute to loading the database schema
147713 z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
147723 ** This would indicate a corrupt schema.
147788 ** any other kind of statement while parsing the schema, even a corrupt
147789 ** schema.
147855 ** Attempt to read the database schema and initialize internal
147884 /* Construct the in-memory representation schema tables (sqlite_schema or
147888 ** the schema table as read-only. */
147936 ** meta[0] Schema cookie. Changes with each schema change.
147937 ** meta[1] File format of schema layer.
148022 /* Read the schema information out of the schema tables
148058 ** the schema loaded, even if errors (other than OOM) occurred. In
148061 ** against whatever subset of the schema was loaded before the error
148110 /* Do the main schema first */
148115 /* All other schemas after the main schema. The "temp" schema must be last */
148130 ** This routine is a no-op if the database schema is already initialized.
148131 ** Otherwise, the schema is loaded. An error code is returned.
148151 ** Check schema cookies in all databases. If any cookie is out
148152 ** of date set pParse->rc to SQLITE_SCHEMA. If all schema cookies
148181 /* Read the schema cookie from the database. If it does not match the
148182 ** value stored as part of the in-memory schema representation,
148199 ** Convert a schema pointer into the iDb index that indicates
148200 ** which database file in db->aDb[] the schema refers to.
148205 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
148391 ** to the schema.
148394 ** schema changes and if those schema changes are subsequently rolled
148396 ** prepared statement goes to run the schema cookie would fail to detect
148397 ** the schema change. Disaster would follow.
148401 ** is not possible for another thread to start a new schema change
148403 ** locks on the schema, we just need to make sure nobody else is
148407 ** but it does *not* override schema lock detection, so this all still
148418 sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb);
148522 ** or encounters a permanent error. A schema problem after one schema
148542 ** Rerun the compilation of a statement after a schema change.
148583 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
148585 ** and the statement is automatically recompiled if an schema change
148711 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
148713 ** and the statement is automatically recompiled if an schema change
150851 ** column specific strings, in case the schema is reset before this
154449 /* The FROM term contains a schema qualifier (ex: main.t1) and so
154919 const char *zSchemaName = 0; /* Schema name for this data source */
154920 int iDb; /* Schema index for this data src */
157969 ** triggers on pTab in the TEMP schema. This routine prepends all
157978 Schema *pTmpSchema; /* Schema of the pTab table */
158080 ** name on pTableName if we are reparsing out of the schema table
158578 ** This function is called to drop a trigger from the database schema.
159400 /* Sanity checking: The schema for the trigger and for the table are
159401 ** always defined. The trigger must be in the same schema as the table
161350 const char *zDbMain; /* Schema name of database to vacuum */
161379 ** restored before returning. Then set the writable-schema flag, and
161482 /* Query the schema of the main database. Create a mirror schema
161519 ** from the schema table.
161543 ** The increment is used to increase the schema cookie so that other
161544 ** connections to the same database will know to reread the schema.
161547 BTREE_SCHEMA_VERSION, 1, /* Add one to the old schema cookie */
161889 ** objects without disturbing the rest of the Schema object (which may
161953 ** structure is associated with a single sqlite3* user of the schema.
162099 ** schema table. We just need to update that slot with all
162133 Schema *pSchema = pTab->pSchema;
162258 const char *zFormat = "vtable constructor did not declare schema: %s";
162427 ** This function is used to set the schema of a virtual table. It is only
162478 ** schema. Nevertheless, defend against that (turn off db->init.busy)
162923 ** the schema. */
163192 LogEst rStarDelta; /* Cost delta due to star-schema heuristic. Not
172663 ** those objects, since there is no opportunity to add schema
174217 ** the affect of star-schema detection was changed to increase the rRun cost
176497 ** schema:
179862 ** error while parsing a legacy schema.
186512 /* Ignore SQL comments if either (1) we are reparsing the schema or
188317 Schema *pSchema = db->aDb[i].pSchema;
188487 ** the pager rollback and schema reset an atomic operation. */
188504 /* Clear the TEMP schema separately and last */
188558 /* The temp-database schema is allocated differently from the other schema
188560 ** So it needs to be freed here. Todo: Why not roll the temp schema into
188594 ** modified the database schema. If the b-tree mutexes are not taken
188596 ** the database rollback and schema reset, which can cause false
188769 /* SQLITE_SCHEMA */ "database schema has changed",
189665 int iDb; /* Schema to checkpoint */
190709 ** database schema yet. This is delayed until the first time the database
191140 /* Ensure the database schema has been loaded */
191341 ** schema cookie in the main database for db, or
191342 ** x if the schema cookie is zero. This case
191377 ** to reset the schema can result in some unexpected behavior.
191643 ** verification of rootpage numbers when parsing the schema. This
191705 ** Enable imposter mode only when the schema has already been parsed. Then
191707 ** the parsed schema. Then turn imposter mode back off again.
191709 ** If onOff==0 and tnum>0 then reset the schema for all databases, causing
191710 ** the schema to be reparsed the next time it is needed. This has the
192066 ** Return the name of the N-th database schema. Return NULL if N is out
192214 ** schema zDb of database db.
194245 ** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table
195147 /* Declare the table schema to SQLite. */
197632 const char *zSchema, /* Name of schema in which pVtab lives */
199879 ** Schema of the terms table.
203229 ** comment above struct HashTableVtab) to the database schema. Both
203538 ** The table created has the following schema:
203662 ** Schema of the tokenizer table.
209664 ** tables. The schema of the virtual table being:
221763 /* Create/Connect to the underlying relational database schema. If
221765 ** the r-tree table schema.
222281 rtreeCheckAppendMsg(&check, "Schema corrupt or not an rtree");
222312 const char *zSchema, /* Schema in which the virtual table lives */
223677 /* Create/Connect to the underlying relational database schema. If
223679 ** the r-tree table schema.
227973 ** then the imposter table schema is:
228047 ** same schema as the actual target table (less any UNIQUE constraints).
228048 ** More precisely, the "same schema" means the same columns, types,
229438 ** Increment the schema cookie of the main database opened by p->dbMain.
229440 ** Or, if this is an RBU vacuum, set the schema cookie of the main db
229441 ** opened by p->dbMain to one more than the schema cookie of the main
229554 ** RBU vacuum operation, create the schema in the target db.
229615 ** when this handle was opened, create the target database schema. */
229873 ** the sqlite3rbu.nPhaseOneStep variable. The schema of the rbu_count table
231444 " schema TEXT HIDDEN," /* 10 Database schema being analyzed */
231487 int iDb; /* Schema used for this query */
231574 ** 0x01 There is a schema=? term in the WHERE clause
231586 /* Look for a valid schema=? constraint. If found, change the idxNum to
231602 case 10: { /* schema */
232118 /* schema=? constraint is present. Get its value */
232215 case 10: { /* schema */
232299 ** schema for the database file that is to be read. The default schema is
232363 "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
232390 ** 0 schema=main, full table scan
232391 ** 1 schema=main, pgno=?1
232392 ** 2 schema=?1, full table scan
232393 ** 3 schema=?1, pgno=?2
232400 /* If there is a schema= constraint, it must be honored. Report a
232401 ** ridiculously large estimated cost if the schema= constraint is
232418 /* If we reach this point, it means that either there is no schema=
232419 ** constraint (in which case we use the "main" schema) or else the
232420 ** schema constraint was accepted. Lower the estimated cost accordingly
232495 ** 0 schema=main, full table scan
232496 ** 1 schema=main, pgno=?1
232497 ** 2 schema=?1, full table scan
232498 ** 3 schema=?1, pgno=?2
232579 default: { /* schema */
232655 zErr = "no such schema";
232818 ** following schema:
234374 ** zThis, in schema zDb.
234568 sqlite3 *db, /* Database handle to read schema from */
236453 /* Check the table schema is still Ok. */
238418 ** database schema to throw an exception if a duplicate is inserted. */
238714 /* If there is a schema mismatch on the current table, proceed to the
239680 ** Provide a database schema to the changegroup object.
239690 /* Cannot add a schema after one or more calls to sqlite3changegroup_add(),
263351 const char *zSchema, /* Name of schema in which this table lives */
267839 ** or, for tables in the TEMP schema only.