Home | History | Annotate | Download | only in amalgamation

Lines Matching defs:Schema

941 #define SQLITE_SCHEMA      17   /* The database schema changed */
2724 ** schema change. Hence, the application should ensure that the
2731 ** sqlite3_prepare_v2() to reprepare a statement after a schema change.
3189 ** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it
3207 ** a schema change, on the first [sqlite3_step()] call following any change
3606 ** ^(For example, given the database schema:
4828 ** and schema data structures between [database connection | connections]
5339 ** CAPI3REF: Declare The Schema Of A Virtual Table
6153 ** memory used to store the schema for all databases associated
6156 ** schema memory is shared with other database connections due to
7513 ** The name of the schema table.
7584 typedef struct Schema Schema;
7850 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*);
9011 Schema *pSchema; /* Pointer to database schema (possibly shared) */
9015 ** An instance of the following structure stores a database schema.
9017 ** Most Schema objects are associated with a Btree. The exception is
9018 ** the Schema for the TEMP databaes (sqlite3.aDb[1]) which is free-standing.
9019 ** In shared cache mode, a single Schema object can be shared by multiple
9022 ** Schema objects are automatically deallocated when the last Btree that
9023 ** references them is destroyed. The TEMP Schema is manually freed by
9027 ** to access Schema content. This implies that the thread must also be
9029 ** For a TEMP Schema, on the connection mutex is required.
9031 struct Schema {
9032 int schema_cookie; /* Database schema version number for this file */
9039 u8 file_format; /* Schema format version for this file */
9041 u16 flags; /* Flags associated with this schema */
9057 ** The DB_SchemaLoaded flag is set after the database schema has been
9061 ** have been filled out. If the schema changes, these column names might
9064 #define DB_SchemaLoaded 0x0001 /* The schema has been loaded */
9088 ** with a particular database connection. Hence, schema information cannot
9089 ** be stored in lookaside because in shared cache mode the schema information
9091 ** schema information, the Lookaside.bEnabled flag is cleared so that
9092 ** lookaside allocations are not used to construct the schema objects.
9280 #define SQLITE_RecoveryMode 0x00800000 /* Ignore schema errors */
9535 ** the database schema.
9537 ** If the database schema is shared, then there is one instance of this
9539 ** schema. This is because each database connection requires its own unique
9543 ** schema is shared, as the implementation often stores the database
9552 ** database schema are initially stored in a linked-list pointed to by
9560 ** schema is being reloaded for some reason), the VTable objects are not
9639 Schema *pSchema; /* Schema that contains this table */
9827 Schema *pSchema; /* Schema containing this index */
9969 ** Expr objects can use a lot of memory space in database schema. To
10520 u8 checkSchema; /* Causes schema cookie check after an error */
10546 yDbMask cookieMask; /* Bitmask of schema verified databases */
10582 Token sNameToken; /* Token with unqualified schema object name */
10630 * Each trigger present in the database schema is stored as an instance of
10652 Schema *pSchema; /* Schema containing the trigger */
10653 Schema *pTabSchema; /* Schema containing the table */
11207 SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*);
11344 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *);
11345 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *);
12781 ** to store the schema for all databases (main, temp, and any ATTACHed
12791 Schema *pSchema = db->aDb[i].pSchema;
46275 ** 40 4 Schema cookie
46276 ** 44 4 File format of schema layer
46535 ** schema associated with the database file are all contained within
47071 ** db->aDb[iDb].pSchema structure. The mutexes required for schema
47080 SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){
47183 ** Enable or disable the shared pager and schema features.
47234 ** function has to search through the database schema.
47237 ** hold a write-lock on the schema table (root page 1). This is also
47246 Schema *pSchema = (Schema *)pBtree->pBt->pSchema;
47260 /* If the client is reading or writing an index and the schema is
47286 ** write-lock on the schema table, or (if the client is reading) a
54389 ** The schema layer numbers meta values differently. At the schema
55097 ** purposes (for example, to store a high-level schema associated with
55293 u32 iDestSchema; /* Original schema cookie in destination */
55671 /* Update the schema version field in the destination database. This
55672 ** is to make sure that the schema-version really does change in
55674 ** same schema version.
59354 /* Rollback or commit any schema changes that occurred. */
60672 ** schema change has occurred. That detail is handled by the
60798 ** sqlite3Step() to do most of the work. If a schema error occurs,
61344 ** as if there had been a schema change, on the first sqlite3_step() call
62459 u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */
65188 ** P3==1 is the schema version. P3==2 is the database format.
65219 ** into cookie number P2 of database P1. P2==1 is the schema version.
65241 /* When the schema cookie changes, record the new cookie internally */
65250 ** schema is changed. Ticket #1644 */
65260 ** schema version) and make sure it is equal to P2 and that the
65261 ** generation counter on the local schema parse equals P3.
65267 ** The cookie changes its value whenever the database schema changes.
65269 ** and that the current process needs to reread the schema.
65294 p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed");
65295 /* If the schema-cookie from the database file matches the cookie
65296 ** stored with the in-memory representation of the schema, do
65297 ** not reload the schema from the database file.
65303 ** discard the database schema, as the user code implementing the
67104 ** schema consistent with what is on disk.
67116 ** schema consistent with what is on disk.
67128 ** schema consistent with what is on disk.
68565 {OP_VerifyCookie, 0, 0, 0}, /* 1: Check the schema cookie */
69674 Schema *pSchema = 0; /* Schema of the expression */
71582 ** part of the in-memory representation of the database schema.
72595 ** of a "NOT NULL" constraint in the database schema.
74795 const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */
74799 ** that is not part of the temp-db schema, add a clause to the WHERE
74821 ** Argument zName is the name of the table in the database schema at
74841 /* Drop any table triggers from the internal schema. */
74849 /* Drop the table and index from the internal schema. */
74967 ** Then modify the schema cookie (since the ALTER TABLE modifies the
74968 ** schema). Open a statement transaction if the table is a virtual
75074 /* Drop and reload the internal table schema. */
75222 /* Reload the schema of the modified table. */
75310 /* Begin a transaction and increment the schema cookie. */
75706 Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */
75769 /* Read the database schema. If an error occurs, leave an error message
76151 /* Allocate the new entry in the db->aDb[] array and initialise the schema
76167 ** it to obtain the database schema. At this point the schema may
76230 /* If the file was opened successfully, read the schema for the new database.
76725 Schema *pSchema, /* The schema of the expression */
76986 ** transaction on each used database and to verify the schema cookie
77114 /* All mutexes are required for schema access. Make sure we hold them. */
77144 /* Read the database schema. If an error occurs, leave an error message
77179 /* All mutexes are required for schema access. Make sure we hold them. */
77183 Schema *pSchema = db->aDb[j].pSchema;
77238 ** Erase all schema information from the in-memory hash tables of
77241 ** if there were schema changes during the transaction or if a
77242 ** schema-cookie mismatch occurs.
77244 ** If iDb<0 then reset the internal schema tables for all database
77245 ** files. If iDb>=0 then reset the internal schema for only the
77253 /* Case 1: Reset the single schema identified by iDb */
77287 ** schema hash tables and therefore do not have to make any changes
77531 ** unqualified name for a new schema object (table, index, view or
78130 ** Generate code that will increment the schema cookie.
78132 ** The schema cookie is used to determine when the schema for the
78133 ** database changes. After each schema change, the cookie value
78134 ** changes. When a process first reads the schema it records the
78136 ** it checks the cookie to make sure the schema has not changed
78140 ** the schema to change multiple times and for the cookie to be
78141 ** set back to prior value. But schema changes are infrequent
78390 ** as a schema-lock must have already been obtained to create it. Since
78391 ** a schema-lock excludes all other database users, the write-lock would
78472 Schema *pSchema = p->pSchema;
78696 ** This function is called by the VDBE to adjust the internal schema
78739 ** Also write code to modify the sqlite_master table and internal schema
78767 ** Code to update the sqlite_master tables and internal schema definitions
78975 /* Remove the table entry from SQLite's internal schema and modify
78976 ** the schema cookie.
79287 ** if initialising a database schema.
79341 ** sqlite_master table (because some other process changed the schema) and
79655 /* Fill the index with data and reparse the schema. Code an OP_Expire
80303 ** Generate VDBE code that will verify the schema cookie and start
80306 ** It is important that all schema cookies be verified and all
80313 ** record every database that needs its schema verified in the
80321 ** schema on any databases. This can be used to position the OP_Goto
80482 assert( sqlite3BtreeHoldsAllMutexes(db) ); /* Needed for schema access */
80517 /* Read the database schema. If an error occurs, leave an error message
80999 ** Free all resources held by the schema structure. The void* argument points
81000 ** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the
81002 ** of the schema hash tables).
81004 ** The Schema.cache_size variable is not cleared.
81010 Schema *pSchema = (Schema *)p;
81035 ** Find and return the schema associated with a BTree. Create
81038 SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){
81039 Schema * p;
81041 p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear);
81043 p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema));
83437 ** search the schema a unique index on the parent key columns.
83862 ** given the following schema:
83942 ** any modifications to the schema are made. This is because statement
83943 ** transactions are not able to rollback schema changes. */
84009 ** schema items cannot be located, set an error in pParse and return
84217 ** the following schema:
84442 ** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash
87662 ** If the TEMP database is open, close it and mark the database schema
88070 /* Force the schema to be loaded on all databases. This cases all
88810 ** will be overwritten when the schema is next loaded. If it does not
88840 ** the value of the schema-version and user-version, respectively. Both
88841 ** the schema-version and the user-version are 32-bit signed integers
88844 ** The schema-cookie is usually only manipulated internally by SQLite. It
88845 ** is incremented by SQLite whenever the database schema is modified (by
88846 ** creating or dropping a table or index). The schema version is used by
88848 ** of the schema used when compiling the SQL query matches the schema of
88851 ** the schema-version is potentially dangerous and may lead to program
88861 int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */
89076 ** interface, and routines that contribute to loading the database schema
89093 "malformed database schema (%s)", zObj);
89189 ** Attempt to read the database schema and initialize internal
89240 /* zMasterSchema and zInitScript are set to point at the master schema
89251 /* Construct the schema tables. */
89296 ** meta[0] Schema cookie. Changes with each schema change.
89297 ** meta[1] File format of schema layer.
89374 /* Read the schema information out of the schema tables
89407 ** the schema loaded, even if errors occurred. In this situation the
89410 ** of the schema was loaded before the error occurred. The primary
89460 /* Once all the other databases have been initialised, load the schema
89462 ** schema may contain references to objects in other databases.
89483 ** This routine is a no-op if the database schema is already initialised.
89484 ** Otherwise, the schema is loaded. An error code is returned.
89502 ** Check schema cookies in all databases. If any cookie is out
89503 ** of date set pParse->rc to SQLITE_SCHEMA. If all schema cookies
89531 /* Read the schema cookie from the database. If it does not match the
89532 ** value stored as part of the in-memory schema representation,
89549 ** Convert a schema pointer into the iDb index that indicates
89550 ** which database file in db->aDb[] the schema refers to.
89555 SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
89612 ** to the schema.
89615 ** schema changes and if those schema changes are subsequently rolled
89617 ** prepared statement goes to run the schema cookie would fail to detect
89618 ** the schema change. Disaster would follow.
89622 ** is not possible for another thread to start a new schema change
89624 ** locks on the schema, we just need to make sure nobody else is
89628 ** but it does *not* override schema lock detection, so this all still
89638 sqlite3Error(db, rc, "database schema is locked: %s", zDb);
89771 ** Rerun the compilation of a statement after a schema change.
89810 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
89812 ** and the statement is automatically recompiled if an schema change
89890 ** and so if a schema change occurs, SQLITE_SCHEMA is returned by
89892 ** and the statement is automatically recompiled if an schema change
91047 ** column specific strings, in case the schema is reset before this
94625 ** triggers on pTab in the TEMP schema. This routine prepends all
94634 Schema * const pTmpSchema = pParse->db->aDb[1].pSchema;
95056 ** This function is called to drop a trigger from the database schema.
95625 /* Sanity checking: The schema for the trigger and for the table are
95626 ** always defined. The trigger must be in the same schema as the table
96484 ** restored before returning. Then set the writable-schema flag, and
96527 ** to read the schema was concluded. Unlock it here so that this doesn't
96571 /* Query the schema of the main database. Create a mirror schema
96646 ** The increment is used to increase the schema cookie so that other
96647 ** connections to the same database will know to reread the schema.
96650 BTREE_SCHEMA_VERSION, 1, /* Add one to the old schema cookie */
96928 ** structure is associated with a single sqlite3* user of the schema.
97094 ** allows a schema that contains virtual tables to be loaded before
97098 Schema *pSchema = pTab->pSchema;
97190 const char *zFormat = "vtable constructor did not declare schema: %s";
97345 ** This function is used to set the schema of a virtual table. It is only
100434 ** set to 9. Given the same schema and either of the following WHERE
108030 /* The temp-database schema is allocated differently from the other schema
108032 ** So it needs to be freed here. Todo: Why not roll the temp schema into
108105 /* SQLITE_SCHEMA */ "database schema has changed",
109209 ** database schema yet. This is delayed until the first time the database
109544 /* Ensure the database schema has been loaded */
110326 * schema will contain no type for that column.
110331 * they cannot be simply ignored. The exposed schema will be INTEGER
110335 * also adds NOT NULL to the column in the exposed schema. If the
110364 * of the difference between the schema exposed by the module, and the
110368 * type schema data STRICT
110378 * type is the type provided to the recover module, schema is the
110379 * schema exposed by the module, data is the acceptable types of data
110457 * Unfortunately, simply adding it to the exposed schema and using
111947 * the stored data matches the schema.
112249 * schema in *pzCreateSql (for sqlite3_declare_vtab).
112318 char *zCreateSql; /* Schema of created virtual table. */
113563 ** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table
114050 /* Declare the table schema to SQLite. */
116802 ** Schema of the terms table.
119624 ** comment above struct HashTableVtab) to the database schema. Both
127289 /* Create/Connect to the underlying relational database schema. If
127291 ** the r-tree table schema.