Lines Matching defs:key

2505 ** [foreign key constraints].  There should be two additional arguments.
2786 ** integer key called the [ROWID | "rowid"]. ^The rowid is always available
2867 ** [foreign key actions] or [REPLACE] constraint resolution are not counted.
2928 ** ^Changes made as part of [foreign key actions] are included in the
4118 ** with N URI parameters key/values pairs in the array P. The result from
4136 ** to a key and value for a query parameter. The P parameter may be a NULL
4138 ** NULL pointers and key pointers should not be empty strings.
6454 ** Specify the key for an encrypted database. This routine should be
6462 const void *pKey, int nKey /* The key */
6467 const void *pKey, int nKey /* The key */
6471 ** Change the key on an open database. If the current database is not
6480 const void *pKey, int nKey /* The new key */
6485 const void *pKey, int nKey /* The new key */
6492 ** Specify the activation key for a CEROD database. Unless
7204 ** primary key: 1
7833 ** <li> ^([foreign key constraints | Foreign key constraints] are enabled,
7834 ** column zColumn is part of a [child key] definition and the blob is
8863 ** all foreign key constraints (deferred or immediate) have been
9109 ** The page to be fetched is determined by the key. ^The minimum key value
9148 ** The xRekey() method is used to change the key value associated with the
9182 sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
9204 void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag);
11114 ** <li> The change is made by an SQL trigger or foreign key action
11151 ** KEY may consist of a single column, or may be a composite key.
11232 ** database row along with the updated values for each updated non-primary-key
11234 ** modifies the values of primary key columns. If such a change is made, it
11267 ** records the primary key values of all new rows inserted into the table.
11268 ** It also records the original primary key and other column values of any
11269 ** deleted or updated rows. For each unique primary key value, data is only
11270 ** recorded once - the first time a row with said primary key is inserted,
11274 ** updated or deleted, if one or more of its primary key columns contain a
11278 ** that consist of primary key values only (created when the user inserts
11279 ** a new record) and those that consist of the primary key values and the
11289 ** for a row with a matching primary key. If one is found, an INSERT
11294 ** queried for a row with a matching primary key. If such a row is
11295 ** found and one or more of the non-primary key fields have been
11299 ** primary key in the database, but all fields contain their original
11306 ** row with the same primary key values inserted while a session object is
11350 ** does not have a primary key, this function is a no-op (but does not return
11375 ** <li> For each row (primary key) that exists in the to-table but not in
11378 ** <li> For each row (primary key) that exists in the to-table but not in
11381 ** <li> For each row (primary key) that exists in both tables, but features
11415 ** <li> DELETE records consist of the primary key fields only. The
11427 ** Because the non-primary key "old.*" fields are omitted, no
11615 ** 0x01 if the corresponding column is part of the tables primary key, or
11731 ** it sets the output variable to the total number of known foreign key
11905 ** the two rows have the same primary key.
11956 ** primary key columns for the table must be consistent. If this is not the
12029 ** <li> The table has primary key columns in the same position as
12064 ** contains a row with the same primary key value (or values) as the
12066 ** stored in all non-primary key columns also match the values stored in
12069 ** If a row with matching primary key values is found, but one or more of
12070 ** the non-primary key fields contains a value different from the original
12074 ** only the values of those non-primary key fields are compared against
12078 ** If no row with matching primary key values is found in the database,
12083 ** (which can only happen if a foreign key constraint is violated), the
12096 ** contains a row with the same primary key values, the conflict handler
12109 ** contains a row with the same primary key value (or values) as the
12111 ** stored in all modified non-primary key columns also match the values
12114 ** If a row with matching primary key values is found, but one or more of
12115 ** the modified non-primary key fields contains a value different from an
12118 ** UPDATE changes only contain values for non-primary key fields that are
12122 ** If no row with matching primary key values is found in the database,
12229 ** (non primary-key) fields modified by the update do not contain the
12233 ** primary key.
12246 ** in duplicate primary key values.
12249 ** primary key.
12252 ** If foreign key handling is enabled, and applying a changeset leaves the
12253 ** database in a state containing foreign key violations, the conflict
12257 ** foreign key constraint violation, are committed. Or, if it returns
12331 ** INSERT of the same key on "CREATE TABLE t1(a PRIMARY KEY, b)":
12376 ** simultaneously. If a single key is modified by multiple remote
12382 ** key, it is rebased according to a REPLACE.
12384 ** <li> If there have been no REPLACE resolutions on a key, then
14707 ** directly, we use its constant as a key to lookup the run-time allocated
15538 ** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data
15540 ** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored
15541 ** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL
15623 ** selected will all have the same key. In other words, the cursor will
15624 ** be used only for equality key searches.
15697 ** an arbitrary key and no data. These btrees have pKey,nKey set to the
15698 ** key and the pData,nData,nZero fields are uninitialized. The aMem,nMem
15699 ** fields give an array of Mem objects that are a decomposition of the key.
15703 ** the key and passed in the nKey field. The pKey field is zero.
15712 ** pKey always NULL encoded key
15715 ** aMem not used decomposed key value
16032 #define OP_SeekLT 21 /* jump, synopsis: key=r[P3@P4] */
16033 #define OP_SeekLE 22 /* jump, synopsis: key=r[P3@P4] */
16034 #define OP_SeekGE 23 /* jump, synopsis: key=r[P3@P4] */
16035 #define OP_SeekGT 24 /* jump, synopsis: key=r[P3@P4] */
16037 #define OP_IfNoHope 26 /* jump, synopsis: key=r[P3@P4] */
16038 #define OP_NoConflict 27 /* jump, synopsis: key=r[P3@P4] */
16039 #define OP_NotFound 28 /* jump, synopsis: key=r[P3@P4] */
16040 #define OP_Found 29 /* jump, synopsis: key=r[P3@P4] */
16051 #define OP_IdxLE 40 /* jump, synopsis: key=r[P3@P4] */
16052 #define OP_IdxGT 41 /* jump, synopsis: key=r[P3@P4] */
16053 #define OP_IdxLT 42 /* jump, synopsis: key=r[P3@P4] */
16056 #define OP_IdxGE 45 /* jump, synopsis: key=r[P3@P4] */
16075 #define OP_Filter 64 /* jump, synopsis: if key(P3@P4) not in filter(P1) goto P2 */
16143 #define OP_SorterCompare 132 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
16149 #define OP_IdxInsert 138 /* synopsis: key=r[P2] */
16150 #define OP_SorterInsert 139 /* synopsis: key=r[P2] */
16151 #define OP_IdxDelete 140 /* synopsis: key=r[P2@P3] */
16191 #define OP_FilterAdd 180 /* synopsis: filter(P1) += key(P3@P4) */
16379 ** comments in VDBE programs that show key decision points in the code
17195 #define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
17608 #define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */
17808 #define TF_HasPrimaryKey 0x00000004 /* Table has a primary key */
17809 #define TF_Autoincrement 0x00000008 /* Integer primary key is autoincrement */
17814 #define TF_WithoutRowid 0x00000080 /* No rowid. PRIMARY KEY is the key */
17873 ** Each foreign key constraint is an instance of the following structure.
17875 ** A foreign key is associated with two tables. The "from" table is
17877 ** key. The "to" table is the table that is named in the REFERENCES clause.
17885 ** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2".
17898 ** is held in Schema.fkeyHash with a hash key of Z.
17903 char *zTo; /* Name of table that the key points to (aka: Parent) */
17906 int nCol; /* Number of columns in this key */
17937 ** key is set to NULL. SETDFLT means that the foreign key is set
17940 ** foreign key.
17956 #define OE_SetNull 8 /* Set the foreign key value to NULL */
17957 #define OE_SetDflt 9 /* Set the foreign key value to its default */
17974 u16 nKeyField; /* Number of key columns in the index */
17975 u16 nAllField; /* Total columns, including key plus others */
17978 CollSeq *aColl[1]; /* Collating sequence for each term of the key */
17993 ** the key of an index. A blob encoding of a record is created by
17997 ** An instance of this object serves as a "key" for doing a search on
17999 ** is closed to the key described by this object. This object might hold
18000 ** just a prefix of the key. The number of fields is given by
18003 ** The r1 and r2 fields are the values to return if this key is less than
18004 ** or greater than a key in the btree, respectively. These are normally
18008 ** The key comparison functions actually return default_rc when they find
18010 ** multiple entries in the b-tree with the same key (when only looking
18015 ** The key comparison functions will set eqSeen to true if they ever
18099 u16 nKeyCol; /* Number of columns forming the key */
18118 IndexSample *aSample; /* Samples of the left-most key */
18153 tRowcnt *anEq; /* Est. number of rows where the key equals this sample */
18154 tRowcnt *anLt; /* Est. number of rows where key is less than this sample */
18893 ** SRT_Union Store results as a key in a temporary index
18914 ** row of result as the key in table pDest->iSDParm.
18953 ** key. If (pDest->iSDParm>0), then the table is an index
18954 ** table. (pDest->iSDParm) is the number of key columns in
20796 ** key functionality is available. If OMIT_TRIGGER is defined but
22929 i64 iKey1; /* First key value passed to hook */
22930 i64 iKey2; /* Second key value passed to hook */
23485 ** key constraints. Set *pCurrent to zero if all foreign key constraints
26414 ** iKeyBlk is the index of the key chunk. Most new allocations
26416 ** of the current key chunk. iKeyBlk is 0 if there is no key chunk.
26417 ** The key chunk is not in either the aiHash[] or aiSmall[].
26557 ** Return a pointer to the new allocation. Or, if the key chunk
26564 /* Use the entire key chunk */
26571 /* Split the key block. Return the tail. */
26599 ** this mem3.iKeyBlk replacement to work, the key chunk must be
26601 ** affairs, of course. The calling routine must link the key
26603 ** changed) key chunk once this routine has finished.
26681 ** of the key chunk. This step usually works if step 1 fails.
26690 ** chunks. Recompute the key chunk as the largest free chunk.
26692 ** of the end of the key chunk. This step happens very
26741 /* Try to expand the key using the newly freed chunk */
26853 /* Initialize the key block. */
26917 i==mem3.iKeyBlk ? " **key**" : "");
26938 fprintf(out, "key=%d\n", mem3.iKeyBlk);
35460 ** hash table that matches the given key. If no element is found,
35462 ** If pH is not NULL, then the hash for this key is written to *pH.
35466 const char *pKey, /* The key we are searching for */
35497 ** element and a hash on the element's key.
35530 /* Attempt to locate an element of the hash table pH with a key
35540 /* Insert an element into the hash table pH. The key is pKey
35543 ** If no element exists with a matching key, then a new
35546 ** If another element already exists with the same key, then the
35548 ** The key is not copied in this instance. If a malloc fails, then
35552 ** element corresponding to "key" is removed from the hash table.
35555 unsigned int h; /* the hash of the key modulo hash table size */
35623 /* 21 */ "SeekLT" OpHelp("key=r[P3@P4]"),
35624 /* 22 */ "SeekLE" OpHelp("key=r[P3@P4]"),
35625 /* 23 */ "SeekGE" OpHelp("key=r[P3@P4]"),
35626 /* 24 */ "SeekGT" OpHelp("key=r[P3@P4]"),
35628 /* 26 */ "IfNoHope" OpHelp("key=r[P3@P4]"),
35629 /* 27 */ "NoConflict" OpHelp("key=r[P3@P4]"),
35630 /* 28 */ "NotFound" OpHelp("key=r[P3@P4]"),
35631 /* 29 */ "Found" OpHelp("key=r[P3@P4]"),
35642 /* 40 */ "IdxLE" OpHelp("key=r[P3@P4]"),
35643 /* 41 */ "IdxGT" OpHelp("key=r[P3@P4]"),
35644 /* 42 */ "IdxLT" OpHelp("key=r[P3@P4]"),
35647 /* 45 */ "IdxGE" OpHelp("key=r[P3@P4]"),
35666 /* 64 */ "Filter" OpHelp("if key(P3@P4) not in filter(P1) goto P2"),
35734 /* 132 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
35740 /* 138 */ "IdxInsert" OpHelp("key=r[P2]"),
35741 /* 139 */ "SorterInsert" OpHelp("key=r[P2]"),
35742 /* 140 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
35782 /* 180 */ "FilterAdd" OpHelp("filter(P1) += key(P3@P4)"),
35969 /* Expand the key name with an appropriate prefix and put the result
35981 /* Write content into a key. zClass is the particular namespace of the
35982 ** underlying key/value store to use - either "local" or "session".
36009 /* Delete a key (with its corresponding data) from the key/value
36010 ** namespace given by zClass. If the key does not previously exist,
36021 /* Read the value associated with a zKey from the key/value namespace given
36022 ** by zClass and put the text data associated with that key in the first
36028 ** not counting the final zero terminator. Return -1 if the key does
37785 struct vxworksFileId *pNew; /* search key and new file ID */
37935 ** An instance of the following structure serves as the key used
37980 struct unixFileId fileId; /* The lookup key */
38180 unixFile *pFile, /* Unix file with file desc used in the key */
38185 struct unixFileId fileId; /* Lookup key for the unixInodeInfo */
53725 unsigned int iMaxKey; /* Largest key seen since xTruncate() */
53734 PgHdr1 **apHash; /* Hash table for fast lookup by key */
54174 ** Discard all pages from cache pCache with a page number (key value)
54480 ** Fetch a page by key value.
64478 int iKey; /* Hash key */
64504 int iKey; /* Hash table key */
64984 ** aLeft[] and aRight[] are arrays of indices. The sort key is
65045 ** Sort the elements in list aList using aContent[] as the sort key.
67598 ** Finding a particular key requires reading O(log(M)) pages from the
67603 ** key and data for any entry are combined to form the "payload". A
67609 ** information such as the size of key and data.
67704 ** only keys and no data. The intkey flag means that the key is an integer
67705 ** which is stored in the key size entry of the cell header rather than in
67753 ** bytes of key and data in a btree cell.
67760 ** var Number of bytes of key. Or the key itself if intkey flag is set.
68047 i64 nKey; /* The key for INTKEY tables, or nPayload otherwise */
68100 void *pKey; /* Saved key that was cursor last known position */
68108 i64 nKey; /* Size of pKey, or last integer key */
69274 ** function saves the current cursor key in variables pCur->nKey and
69278 ** If the cursor is open on an intkey table, then the integer key
69282 ** the key.
69294 /* For an index btree, save the complete key content. It is possible
69295 ** that the current key is corrupt. In that case, it is possible that
69432 const void *pKey, /* Packed key if the btree is an index */
69433 i64 nKey, /* Integer key for tables. Size of pKey for indices */
69438 UnpackedRecord *pIdxKey; /* Unpacked index key */
69606 ** This routine updates the pointer map entry for page number 'key'
69613 static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){
69627 if( key==0 ){
69631 iPtrmap = PTRMAP_PAGENO(pBt, key);
69644 offset = PTRMAP_PTROFFSET(iPtrmap, key);
69653 TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent));
69668 ** This routine retrieves the pointer map entry for page 'key', writing
69672 static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
69681 iPtrmap = PTRMAP_PAGENO(pBt, key);
69688 offset = PTRMAP_PTROFFSET(iPtrmap, key);
70036 /* pIter now points at the 64-bit integer key value, a variable length
70038 ** past the end of the key value. */
73369 ** Return the value of the integer key or "rowid" for a table btree.
73411 ** of data. For index btrees, this will be the size of the key.
73774 ** pCur is pointing to an index b-tree then the key section is read.
73824 ** the key if index btrees (pPage->intKey==0) and is the data for
73826 ** key/data is written into *pAmt. If *pAmt==0, then the value
73829 ** This routine is an optimization. It is common for the entire key
73832 ** key and data without making a copy. If the key and/or data spills
73834 ** the key/data and copy it into a preallocated buffer.
73867 ** many bytes of the key or data as are available on the local
73870 ** The pointer returned is ephemeral. The key/data may move
73876 ** These routines is used to get quick access to key and data
74065 ** The left-most leaf is the one with the smallest key - the first
74090 ** The right-most entry is the one with the largest key - the last
74091 ** key in ascending order.
74181 ** table near the key intKey. Return a success code.
74186 ** before or after the key.
74189 ** comparing the key with the entry to which the cursor is
74205 i64 intKey, /* The table key */
74229 /* If the requested key is one more than the previous key, then
74409 ** near the key pIdxKey. Return a success code.
74414 ** before or after the key.
74417 ** comparing the key with the entry to which the cursor is
74436 UnpackedRecord *pIdxKey, /* Unpacked index key */
74462 ** in the table and the pIdxKey search key is greater than or
74467 ** search key, then we can start the search on the current page
74570 testcase( nCell<0 ); /* True if key size is 2^32 or more */
74571 testcase( nCell==0 ); /* Invalid key size: 0x80 0x80 0x00 */
74572 testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
74573 testcase( nCell==2 ); /* Minimum legal index key size */
76324 ** a variable length key value (which must be the same value as the
76325 ** largest key on pPage).
76327 ** To find the largest key value on pPage, first find the right-most
76330 ** and the key value (a variable length integer, may have any value).
76332 ** field. The second while(...) loop copies the key value from the
76675 ** leafData: 1 if pPage holds key+data and pParent holds only keys.
77093 ** cell consists of the integer key for the right-most cell of
77113 ** primary key.
77230 u32 key = get4byte(&apNew[i]->aData[8]);
77231 ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc);
77605 ** the key is used. The pX.pKey value must be NULL. The pX.nKey is the
77610 ** key is an arbitrary byte sequence stored in pX.pKey,nKey. The
77625 ** key values and pX->aMem can be used instead of pX->pKey to avoid having
77626 ** to decode the key.
77652 ** integer key to use. It then calls this function to actually insert the
77703 ** to a row with the same key as the new entry being inserted.
77741 ** to a row with the same key as the new entry being inserted.
77890 ** entry in the table, and the next row inserted has an integer key
77891 ** larger than the largest existing key, it is possible to insert the
78099 ** key and leaving the cursor in CURSOR_REQUIRESEEK state before
78120 ** Save the cursor key. */
78733 /* If this is a leaf page or the tree is not an int-key tree, then
78878 checkAppendMsg(pCheck, "Failed to read ptrmap key=%d", iChild);
78884 "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)",
79030 i64 *piMinKey, /* Write minimum integer primary key here */
79031 i64 maxKey /* Error if integer primary key greater than this */
79149 /* Check for integer primary key out of range */
79155 keyCanBeEqual = 0; /* Only the first key on the page may ==maxKey */
81781 ** Move data out of a btree key or data field and into a Mem structure.
81783 ** to. offset and amt determine what portion of the data or key to retrieve.
83231 ** * OP_FkCounter with P2==0 (immediate foreign key constraint)
85648 ** committed. If there are outstanding deferred foreign key constraint
85759 /* Check for immediate foreign key violations. */
85788 ** key constraints to hold up the transaction. This means a commit
86652 int nKey1, const void *pKey1, /* Left key */
86653 const UnpackedRecord *pPKey2, /* Right key */
86691 /* Read the serial types for the next element in each key. */
86694 /* Verify that there is enough key space remaining to avoid
86696 ** always be greater than or equal to the amount of required key space.
87046 ** greater than key2. The {nKey1, pKey1} key must be a blob
87048 ** key must be a parsed key such as obtained from
87064 int nKey1, const void *pKey1, /* Left key */
87065 UnpackedRecord *pPKey2, /* Right key */
87274 int nKey1, const void *pKey1, /* Left key */
87275 UnpackedRecord *pPKey2 /* Right key */
87291 int nKey1, const void *pKey1, /* Left key */
87292 UnpackedRecord *pPKey2 /* Right key */
87386 int nKey1, const void *pKey1, /* Left key */
87387 UnpackedRecord *pPKey2 /* Right key */
87578 ** Compare the key of the index entry that cursor pC is pointing to against
87579 ** the key string in pUnpacked. Write into *pRes a number
87586 ** of the keys prior to the final rowid, not the entire key.
87591 UnpackedRecord *pUnpacked, /* Unpacked version of key */
87803 i64 iKey1, /* Initial key value */
89909 ** For the purposes of the previous paragraph, a foreign key CASCADE, SET NULL
90371 ** is executed. This is used to test whether or not the foreign key
91896 ** foreign key constraint violations. If there are no foreign key
91900 ** exits. This opcode is used to raise foreign key constraint errors prior
93613 ** use as a data record in a database table or as a key
93618 ** field of the index key.
94783 ** key is sufficient to produce the required results.
94886 ** Synopsis: key=r[P3@P4]
94889 ** use the value in register P3 as the key. If cursor P1 refers
94891 ** that are used as an unpacked index key.
94894 ** is greater than or equal to the key value. If there are no records
94895 ** greater than or equal to the key and P2 is not zero, then jump to P2.
94898 ** opcode will either land on a record that exactly matches the key, or
94913 ** Synopsis: key=r[P3@P4]
94916 ** use the value in register P3 as a key. If cursor P1 refers
94918 ** that are used as an unpacked index key.
94921 ** is greater than the key value. If there are no records greater than
94922 ** the key and P2 is not zero, then jump to P2.
94931 ** Synopsis: key=r[P3@P4]
94934 ** use the value in register P3 as a key. If cursor P1 refers
94936 ** that are used as an unpacked index key.
94939 ** is less than the key value. If there are no records less than
94940 ** the key and P2 is not zero, then jump to P2.
94949 ** Synopsis: key=r[P3@P4]
94952 ** use the value in register P3 as a key. If cursor P1 refers
94954 ** that are used as an unpacked index key.
94957 ** is less than or equal to the key value. If there are no records
94958 ** less than or equal to the key and P2 is not zero, then jump to P2.
94965 ** opcode will either land on a record that exactly matches the key, or
94982 UnpackedRecord r; /* The key to seek for */
94983 int nField; /* Number of columns or fields in the key */
95020 iKey = sqlite3VdbeIntValue(pIn3); /* Get the integer key value */
95072 ** with the same key.
95195 ** The SeekGE.P3 and SeekGE.P4 operands identify an unpacked key which
95409 ** Synopsis: key=r[P3@P4]
95426 ** Synopsis: key=r[P3@P4]
95445 ** Synopsis: key=r[P3@P4]
95457 ** a key P3:N that will match some record in the index. We want to know
95463 ** This opcode is used in IN clause processing for a multi-column key.
95464 ** If an IN clause is attached to an element of the key other than the
95466 ** seek over the whole key, then it might be that one of the key element
95476 ** Synopsis: key=r[P3@P4]
95485 ** P1 index btree has a matching key prefix. If there are no matches, jump
95490 ** branch is always taken if any part of the search key input is NULL.
95550 /* Composite key generated by OP_MakeRecord */
95580 ** input fields are NULL, since any key with a NULL will not
95726 ** Get a new integer record number (a.k.a "rowid") used as the key to a table.
95727 ** The record number is not previously used as a key in the database
95866 ** number P2. The key is stored in register P3. The key must
95877 ** seeks on the cursor or if the most recent seek used a key equal to P3.
95899 Mem *pKey; /* MEM cell holding key for the record */
96156 ** Synopsis: if key(P1)!=trim(r[P3],P4) goto P2
96223 ** If cursor P1 is an index, then the content is the key of the row.
96285 ** Store in register P2 an integer which is the key of the table entry that
96531 ** Advance cursor P1 so that it points to the next key/data pair in its
96532 ** table or index. If there are no more key/value pairs then fall through
96555 ** Back up cursor P1 so that it points to the previous key/data pair in its
96556 ** table or index. If there is no previous key/value pairs then fall through
96639 ** Synopsis: key=r[P2]
96641 ** Register P2 holds an SQL index key made using the
96642 ** MakeRecord instructions. This opcode writes that key
96646 ** key of reg(P2). In that case, P3 is the index of the first register
96647 ** for the unpacked key. The availability of the unpacked key can sometimes
96660 ** seeks on the cursor or if the most recent seek used a key equivalent
96697 ** Synopsis: key=r[P2]
96699 ** Register P2 holds an SQL index key made using the
96700 ** MakeRecord instructions. This opcode writes that key
96722 ** Synopsis: key=r[P2@P3]
96725 ** an unpacked index key. This opcode removes that entry from the
96793 ** the end of the index key pointed to by cursor P1. This integer should be
96874 ** Synopsis: key=r[P3@P4]
96877 ** key that omits the PRIMARY KEY. Compare this key value against the index
96881 ** If the P1 index entry is greater than or equal to the key value
96885 ** Synopsis: key=r[P3@P4]
96888 ** key that omits the PRIMARY KEY. Compare this key value against the index
96892 ** If the P1 index entry is greater than the key value
96896 ** Synopsis: key=r[P3@P4]
96899 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
96903 ** If the P1 index entry is less than the key value then jump to P2.
96907 ** Synopsis: key=r[P3@P4]
96910 ** key that omits the PRIMARY KEY or ROWID. Compare this key value against
96914 ** If the P1 index entry is less than or equal to the key value then jump
97482 ** is really a trigger, not a foreign key action, and the flag set
97628 ** (deferred foreign key constraints). Otherwise, if P1 is zero, the
97629 ** statement counter is incremented (immediate foreign key constraints).
97645 ** This opcode tests if a foreign key constraint-counter is currently zero.
97652 ** (immediate foreign key constraint violations).
98852 ** Synopsis: filter(P1) += key(P3@P4)
98880 ** Synopsis: if key(P3@P4) not in filter(P1) goto P2
98882 ** Compute a hash on the key contained in the P4 registers starting
99462 ** column is not indexed, and that it is not part of a foreign key.
99469 /* Check that the column is not part of an FK child key definition. It
99470 ** is not necessary to check if it is part of a parent key, as parent
99471 ** key columns must be indexed. The check below will pick up this
99479 zFault = "foreign key";
99805 ** the ORDER BY key columns and result columns
99975 ** merged. An aReadr[] object either points to a valid key or else is at EOF.
99987 ** comparing aReadr[2*i-N] and aReadr[2*i-N+1]. Whichever key is smaller, the
99991 ** other key value. If the keys are equal (only possible with two EOF
99997 ** currently points to the smallest key value. aTree[0] is unused.
100012 ** The current element is "Apple" (the value of the key indicated by
100014 ** be advanced to the next key in its segment. Say the next key is
100020 ** 5 key to the current key of PmaReader 4 (still "Grapefruit"). The PmaReader
100023 ** 5, so aTree[3] is set to 6. Key 0 is smaller than key 6 (Banana<Durian),
100029 ** key comparison operations are required, where N is the number of segments
100096 int mxKeysize; /* Largest serialized key seen so far */
100119 ** PMA, in sorted order. The next key to be read is cached in nKey/aKey.
100121 ** contain a contiguous representation of the key, then aAlloc is allocated
100122 ** and the key is copied into aAlloc and aKey is made to poitn to aAlloc.
100130 int nKey; /* Number of bytes in key */
100133 u8 *aKey; /* Pointer to current key */
100450 ** Advance PmaReader pReadr to the next key in its PMA. Return SQLITE_OK if
100494 ** leaves the PmaReader pointing to the first key in the PMA (or EOF if the
100576 ** the first field of each key is a TEXT value and that the collation
100619 ** the first field of each key is an INTEGER value.
100694 ** order of the primary key, which happens to be make up the final part
100706 int nField, /* Number of key fields in each record */
101322 ** key). The varint is the number of bytes in the blob of data.
101679 /* Write the next key to the output. */
101874 ** function returns, the first key of merged data may be read from the
101882 ** its first key.
101942 ** the first key in its range.
101949 ** to its first key. A call to vdbePmaReaderNext() is still required to do
101962 ** the current PmaReader set to point to the first key in its range.
102381 ** creates a new list consisting of a single key immediately afterwards.
102446 ** current key.
102450 int *pnKey /* OUT: Size of current key in bytes */
102473 ** Copy the current sorter key into the memory cell pOut.
102477 void *pKey; int nKey; /* Sorter key to copy into pOut */
102493 ** Compare the key in memory cell pVal with the key that the sorter cursor
102497 ** If the sorter cursor key contains any NULL values, consider it to be
102502 ** key in pVal is smaller than, equal to or larger than the current sorter
102503 ** key.
102510 Mem *pVal, /* Value to compare to current sorter key */
102518 void *pKey; int nKey; /* Sorter key to compare pVal with */
108984 ** For each expression, build an index key from the evaluation and
113996 ** of any foreign key constraints that use the table being renamed as the
114684 ** inclusive are samples of the left-most key value in the index taken at
114716 ** binary encoding of a key from the index. The nEq column is a
114735 ** the key space, though not uniformly, and which include samples with
114743 ** of a blob encoding of the complete index key as is found in
114878 i64 iRowid; /* Rowid in main table of the key */
115013 int nKeyCol; /* Number of key columns */
115294 ** R Rowid for the current row. Might be a key record for
115447 ** a key with the corresponding number of fields. In other words,
115725 ** (2) the number of columns in the key without the rowid/pk
116757 zErrDyn = sqlite3DbStrDup(db, "Invalid key value");
116769 /* No key specified. Use the key from URI filename, or if none,
116770 ** use the key from the main database. */
116917 Expr *pKey /* Database key for encryption extension */
119288 ** of columns that form the primary key. If pList is NULL, then the
119289 ** most recently added column of the table is the primary key.
119291 ** A table can have at most one primary key. If the table already has
119292 ** a primary key (and this is the second primary key) then create an
119301 ** If the key is not an INTEGER PRIMARY KEY, then create a unique
119302 ** index for the key. No index is created for INTEGER PRIMARY KEYs.
119318 "table \"%s\" has more than one primary key", pTab->zName);
119795 ** for the PRIMARY KEY as the primary key index is now
119918 /* This index is a superset of the primary key */
121036 ** This routine is called to create a new foreign key on the table
121038 ** in the current table point to the foreign key. If pFromCol==0 then
121039 ** connect the key to the last column inserted. pTo is the name of
121048 ** The foreign key is set for IMMEDIATE processing. A subsequent call
121074 sqlite3ErrorMsg(pParse, "foreign key on %s"
121082 "number of columns in foreign key does not match the number of "
121124 "unknown column \"%s\" in foreign key definition",
121163 /* Link the foreign key to the table as the last step.
121178 ** clause is seen as part of a foreign key definition. The isDeferred
121180 ** The behavior of the most recently created foreign key is adjusted
121364 ** be NULL for a primary key or an index that is created to satisfy a
121370 ** is a primary key or unique-constraint on the most recent column added
121382 int sortOrder, /* Sort order of primary key when pList==NULL */
121504 ** dealing with a primary key or UNIQUE constraint. We have to invent our
121566 ** key out of the last column added to the table under construction.
121639 ** TODO: Issue a warning if the table primary key is used as part of the
121640 ** index key.
121709 /* Append the table key to the end of the index. For WITHOUT ROWID
124002 int iKey; /* Memory cell holding key of row to be deleted */
124003 i16 nKey; /* Number of memory cells in the row key */
124004 int iEphCur = 0; /* Ephemeral table holding all primary key values */
124204 /* Construct a query to find the rowid or primary key for every row
124227 /* Extract the rowid or primary key for the current row */
124241 /* For ONEPASS, no need to store the rowid/primary-key. There is only
124244 nKey = nPk; /* OP_Found will use an unpacked key */
124258 /* Add the PK key for this row to the temporary table */
124260 nKey = 0; /* Zero tells OP_Found to use a composite key */
124296 assert( nKey==nPk ); /* OP_Found will use an unpacked key */
124309 assert( nKey==0 ); /* OP_Found will use a composite key */
124404 ** 3. The primary key for the row to be deleted must be stored in a
124548 ** handle rows (possibly in other tables) that refer via a foreign key
124572 ** for rowid tables or to the primary key index for WITHOUT ROWID
124591 int r1 = -1; /* Register holding an index key */
124617 ** Generate code that will assemble an index key and stores it in register
124618 ** regOut. The key with be for index pIdx which is an index on pTab.
124624 ** registers that holds the elements of the index key. The
124638 ** a pointer to a different index for which an index key has just been
124640 ** its key into the same sequence of registers and if pPrior and pIdx share
124649 Index *pIdx, /* The index for which to generate a key */
124651 int regOut, /* Put the new key into this register if not 0 */
124652 int prefixOnly, /* Compute only a unique prefix of the key */
124654 Index *pPrior, /* Previously generated index key */
124655 int regPrior /* Register holding previous generated key */
127135 ** This file contains code used by the compiler to add foreign key
127148 ** If an immediate foreign key constraint is violated,
127151 ** deferred foreign key constraint is violated, no action is taken
127158 ** that causes a foreign key violation, the counter is incremented. Each
127164 ** * When a commit fails due to a deferred foreign key constraint,
127168 ** * If the database contains foreign key violations when the
127219 ** INSERT violates a foreign key constraint. This is necessary as such
127245 ** sqlite3FkCheck() - Check for foreign key violations.
127268 ** A foreign key constraint requires that the key columns in the parent
127270 ** Given that pParent is the parent table for foreign key constraint pFKey,
127271 ** search the schema for a unique index on the parent key columns.
127273 ** If successful, zero is returned. If the parent key is an INTEGER PRIMARY
127277 ** If the parent key consists of a single column (the foreign key constraint
127278 ** is not a composite foreign key), output variable *paiCol is set to NULL.
127280 ** N is the number of columns in the parent key. The first element of the
127289 ** 1) The named parent key columns do not exist, or
127291 ** 2) The named parent key columns do exist, but are not subject to a
127294 ** 3) No parent key columns were provided explicitly as part of the
127295 ** foreign key definition, and the parent table does not have a
127298 ** 4) No parent key columns were provided explicitly as part of the
127299 ** foreign key definition, and the PRIMARY KEY of the parent table
127300 ** consists of a different number of columns to the child key in
127303 ** then non-zero is returned, and a "foreign key mismatch" error loaded
127310 FKey *pFKey, /* Foreign key to find index for */
127316 int nCol = pFKey->nCol; /* Number of columns in parent key */
127317 char *zKey = pFKey->aCol[0].zCol; /* Name of left-most parent key column */
127324 /* If this is a non-composite (single column) foreign key, check if it
127328 ** Otherwise, for a composite foreign key (more than one column), allocate
127336 ** mapped to the primary key of table pParent, or
127356 ** of columns. If each indexed column corresponds to a foreign key
127360 /* If zKey is NULL, then this foreign key is implicitly mapped to
127371 /* If zKey is non-NULL, then this foreign key was declared to
127407 "foreign key mismatch - \"%w\" referencing \"%w\"",
127420 ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed
127448 Index *pIdx, /* Unique index on parent key columns in pTab */
127449 FKey *pFKey, /* Foreign key constraint */
127450 int *aiCol, /* Map from parent key columns to child table columns */
127458 int iOk = sqlite3VdbeMakeLabel(pParse); /* jump here if parent key found */
127470 ** Check if any of the key columns in the child table row are NULL. If
127484 /* If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY
127489 /* Invoke MustBeInt to coerce the child key value to an integer (i.e.
127490 ** apply the affinity of the parent key). If this fails, then there
127491 ** is no matching parent key. Before using MustBeInt, make a copy of
127492 ** the value. Otherwise, the value inserted into the child key column
127531 ** If any of the parent-key values are NULL, then the row cannot match
127533 ** of the parent-key values are NULL (at this point it is known that
127534 ** none of the child key values are).
127547 /* The parent key is a composite key that includes the IPK column */
127645 ** from the parent table of foreign key constraint pFKey and, if pFKey is
127675 Index *pIdx, /* Index on parent covering the foreign key */
127676 FKey *pFKey, /* The foreign key linking pSrc to pTab */
127704 ** the parent key columns. The affinity of the parent key column should
127705 ** be applied to each child key value before the comparison takes place.
127732 ** for WITHOUT ROWID tables. In the second form, the *parent* key is
127733 ** (a,b,...). Either the parent or primary key could be used to
127734 ** uniquely identify the current row, but the parent key is more convenient
127770 ** foreign key constraint counter. */
127795 ** to the FKey structure representing the foreign key constraint on table
127857 ** DELETE, but foreign key actions are not.
127868 /* Search for a deferred foreign key constraint for which this table
127886 /* If the DELETE has generated immediate foreign key constraint
127911 ** The second argument points to an FKey object representing a foreign key
127920 ** child key for FK constraint *p are modified.
127924 FKey *p, /* Foreign key for which pTab is the child */
127938 ** The second argument points to an FKey object representing a foreign key
127947 ** parent key for FK constraint *p are modified.
127993 ** table pTab to generate VDBE code to perform foreign key constraint
128035 /* Loop through all the foreign key constraints for which pTab is the
128036 ** child table (the table that the foreign key definition is part of). */
128038 Table *pTo; /* Parent table of foreign key pFKey */
128039 Index *pIdx = 0; /* Index on key columns in pTo */
128053 /* Find the parent table of this foreign key. Also find a unique index
128054 ** on the parent key columns in the parent table. If either of these
128099 /* Request permission to read the parent key columns. If the
128112 ** a cursor to use to search the unique index on the parent key columns
128120 ** outstanding foreign key constraint violation. */
128129 ** foreign key, then omit this scan altogether. As all child key
128138 /* Loop through all the foreign key constraints that refer to this table.
128141 Index *pIdx = 0; /* Foreign key index for pFKey */
128154 ** an immediate foreign key violation. So do nothing in this case. */
128181 ** action applies, then any foreign key violations caused by
128182 ** removing the parent key will be rectified by the action trigger.
128250 ** If any foreign key processing will be required, this function returns
128251 ** non-zero. If there is no foreign key related processing, this function
128262 ** Or, assuming some other foreign key processing is required, 1.
128274 /* A DELETE operation. Foreign key processing is required if the
128276 ** foreign key constraint. */
128279 /* This is an UPDATE. Foreign key processing is only required if the
128280 ** operation modifies one or more child or parent key columns. */
128283 /* Check if any child key columns are being modified. */
128291 /* Check if any parent key columns are being modified. */
128305 ** compiled on table pTab, which is the parent table of foreign-key pFKey.
128316 ** For example, if pFKey is the foreign key and pTab is table "p" in
128328 ** The returned pointer is cached as part of the foreign key object. It
128329 ** is eventually freed along with the rest of the foreign key object by
128335 FKey *pFKey, /* Foreign key to get action for */
128352 Index *pIdx = 0; /* Parent key index for this FK */
128353 int *aiCol = 0; /* child table cols -> parent key cols */
128537 /* If foreign-key support is enabled, iterate through all FKs that
128557 ** Free all memory associated with foreign key definitions attached to
128584 /* EV: R-30323-21917 Each foreign key constraint in SQLite is
129453 ** the index into IDLIST of the primary key column. ipkColumn is
129454 ** the index of the primary key as it appears in IDLIST, not as
129457 ** loop, if ipkColumn==(-1), that means that integer primary key
129459 ** it will automatically generated an integer primary key.
129595 ** key, the set the ipkColumn variable to the integer primary key
129898 ** to generate a unique primary key value.
129954 ** parent table in a foreign key constraint. It is safe to set the
130194 ** For an UPDATE, the pkChng boolean is true if the true primary key (the
130196 ** might be modified by the UPDATE. If pkChng is false, then the key of
130317 ** normal rowid tables. nPkField is the number of key fields in the
130319 ** number of fields in the true primary key of the table. */
130830 ** primary key, then no collision is possible. The collision detection
131582 ** any foreign key constraints. This is more restrictive than necessary.
131584 ** command, and the VACUUM command disables foreign key constraints. So
131711 ** OP_IdxInsert to seek to the point within the b-tree where each key
133663 /* 26 */ "key",
133975 {/* zName: */ "key",
135368 /* Foreign key support may not be enabled or disabled while not
135749 FKey *pFK; /* A foreign key constraint */
135753 int i; /* Loop counter: Foreign key number for pTab */
135754 int j; /* Loop counter: Field of the foreign key */
135760 int addrOk; /* Jump here if the key is OK */
135817 /* Generate code to read the child key values into registers
135818 ** regRow..regRow+n. If any of the child key values are NULL, this
135829 ** key. If a match is found, jump to addrOk. */
136009 int r2; /* Previous key for WITHOUT ROWID tables */
136233 ** current key. The entry is unique if (1) any column is NULL
136234 ** or (2) the next entry has a different key */
136767 ** key 0
138957 int nKey; /* Number of sorting key columns, including OP_Sequence */
139321 ** values for any expressions that are also part of the sort-key are omitted
139398 ** expression within the sort-key that pushOntoSorter() will generate.
139493 /* In this mode, write each query result to the key of the temporary
139507 ** saving that record, use it as a key to delete elements from
139516 /* Store the result as data using a unique key.
139652 ** index with pSO->nExpr+2 columns. Build a key using pSO for the first
139721 ** Allocate a KeyInfo object sufficient for an index of N key columns and
139882 int nKey; /* Number of key columns in sorter record */
141476 /* Store the result as data using a unique key.
147687 ** not a foreign key action, and (b) the flag to enable recursive triggers
148013 ** PRIMARY KEY. In this case <other-columns> are the primary key columns
148024 ** rowid value in <other-columns> is used as the integer key, and the
148161 int hasFK; /* True if foreign key processing is required */
148172 int iEph = 0; /* Ephemeral table holding all primary key values */
148409 ** the key for accessing each index.
148894 /* If changing the rowid value, or if there are foreign key constraints
148934 ** handle rows (possibly in other tables) that refer via a foreign key
149699 ** disable CHECK and foreign key constraints. */
151406 int iBase; /* Base register of multi-key index record */
151407 int nPrefix; /* Number of prior entires in the key */
152669 ** key value of the loop. If one or more IN operators appear, then
152685 ** a key to search the index. Hence the first byte in the returned affinity
154241 /* Check if the temp table already contains this key. If so,
154244 ** insert the key into the temp table and proceed with processing
154248 ** is zero, assume that the key cannot already be present in
154250 ** need to insert the key into the temp table, as it will never
154925 ** that we can increment the prefix key to find an upper bound for the
157971 ** Estimate the location of a particular key among all keys in an
158378 ** key-prefix formed by the nEq values matched against the nEq left-most
158409 ** have been requested when testing key $P in whereEqualScanEst(). */
159930 Index sPk; /* A fake index object for the primary key */
159959 ** variable sPk to represent the rowid primary key index. Make this
160068 /* Integer primary key index */
160175 /* If a non-unique index is used, or if a prefix of the key for
160920 u16 nKeyCol; /* Number of key columns in pIndex */
165813 ** while( (csrCurrent.key + regEnd) < csrEnd.key ){
165815 ** while( csrStart.key + regStart) < csrCurrent.key ){
165826 ** while( csrStart.key + regStart) < csrCurrent.key ){
165832 ** In the above notation, "csr.key" means the current value of the ORDER BY
165848 ** while( (csrEnd.key + regEnd) <= csrCurrent.key ){
165851 ** while( (csrStart.key + regStart) < csrCurrent.key ){
165858 ** while( (csrEnd.key + regEnd) <= csrCurrent.key ){
165861 ** while( (csrStart.key + regStart) < csrCurrent.key ){
165879 ** while( (csrCurrent.key + regEnd) < csrEnd.key ){
165880 ** while( (csrCurrent.key + regStart) > csrStart.key ){
165890 ** while( (csrCurrent.key + regStart) > csrStart.key ){
173582 ** this routine will be called automatically by key routines such as
176609 }else if( (zKey = uriParameter(zUri, "key"))!=0 ){
179240 char copyKey; /* True if copy of key made on insert */
179272 ** A copy of the key is made if the copyKey parameter to fts3HashInit is 1.
180423 ** <key> = <value>
180426 ** term may be quoted, but the <key> may not.
180840 /* The results of parsing supported FTS4 key=value options: */
187670 ** determines what kind of key the hash table will use. "copyKey" is
187744 ** Return a pointer to the appropriate hash function given the key class.
187765 ** Return a pointer to the appropriate hash function given the key class.
187832 ** hash table that matches the given key. The hash for this key has
187837 const void *pKey, /* The key we are searching for */
187839 int h /* The hash for this key. */
187861 ** element and a hash on the element's key.
187902 int h; /* A hash on key */
187914 ** Attempt to locate an element of the hash table pH with a key
187919 Fts3HashElem *pElem; /* The element that matches key (if any) */
187925 /* Insert an element into the hash table pH. The key is pKey,nKey
187928 ** If no element exists with a matching key, then a new
187929 ** element is created. A copy of the key is made if the copyKey
187932 ** If another element already exists with the same key, then the
187934 ** The key is not copied in this instance. If a malloc fails, then
187938 ** element corresponding to "key" is removed from the hash table.
187942 const void *pKey, /* The key */
187943 int nKey, /* Number of bytes in the key */
187946 int hraw; /* Raw hash value of the key */
187947 int h; /* the hash of the key modulo hash table size */
188714 ** SELECT <function-name>(<key-name>);
188715 ** SELECT <function-name>(<key-name>, <pointer>);
188722 ** to the string <key-name>. If <pointer> is not specified, then
188723 ** the string <key-name> must already exist in the has table. Otherwise,
188728 ** to string <key-name> (after the hash-table is updated, if applicable).
188907 ** SELECT <function-name>(<key-name>, ..., <input-string>);
189130 ** of the key when a value is inserted. i.e. by a call similar to:
193590 Blob key; /* Last key written to the current block */
193734 ** node is finished and written to disk. The key (zTerm/nTerm) is guaranteed
193735 ** to be greater than the largest key on the node just written, but smaller
193736 ** than or equal to the first key that will be written to the next leaf
193760 /* Figure out how much space the key will consume if it is written to
193762 ** the space required changes depending on which node the key is to
193764 nPrefix = fts3PrefixCompress(pNode->key.a, pNode->key.n, zTerm, nTerm);
193770 if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){
193772 ** the key to it will not cause it to grow to larger than nNodeSize
193773 ** bytes in size, write the key here. */
193784 blobGrowBuffer(&pNode->key, nTerm, &rc);
193787 if( pNode->key.n ){
193796 memcpy(pNode->key.a, zTerm, nTerm);
193797 pNode->key.n = nTerm;
193801 ** Then allocate a new, empty sibling node. The key will be written
193811 pNode->key.n = 0;
193913 nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm);
193932 ** to the database (still available in pLeaf->key), and
193946 pLeaf->key.n = 0;
193963 &pLeaf->block, &pLeaf->key, zTerm, nTerm, aDoclist, nDoclist
194001 assert( *pRc || pNode->key.nAlloc==0 );
194003 sqlite3_free(pNode->key.a);
194044 sqlite3_free(pNode->key.a);
194060 sqlite3_free(pRoot->key.a);
194130 ** * The first key read from the input (arguments zKey and nKey) is
194131 ** greater than the largest key currently stored in the potential
194138 const char *zKey, /* First key to write */
194179 /* Check that zKey/nKey is larger than the largest key the candidate */
194240 blobGrowBuffer(&pNode->key, reader.term.n, &rc);
194244 memcpy(pNode->key.a, reader.term.a, reader.term.n);
194246 pNode->key.n = reader.term.n;
197991 unsigned int key = (((unsigned int)c)<<10) | 0x000003FF;
197997 if( key >= aEntry[iTest] ){
198004 assert( aEntry[0]<key );
198005 assert( key>=aEntry[iRes] );
198064 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
198070 if( key >= aDia[iTest] ){
198077 assert( key>=aDia[iRes] );
200411 "CREATE TABLE x(key,value,type,atom,id,parent,fullkey,path,"
201566 ** Given a node number iNode, return the corresponding key to use
202340 ** The rScore is the primary key. Smaller rScore values come first.
208209 ** updates are done in sorted key order.
208296 ** by index key before applying them to the b-tree. This leads to an IO
208336 ** * No foreign key violations are detected or reported.
208378 ** key column - "rowid". Virtual tables for which the "rowid" column does
208379 ** not function like a primary key value cannot be updated using RBU. For
208415 ** real primary key values of the row to delete should be stored in the
208422 ** The real primary key values identifying the row to update should be
208724 ** Return the total number of key-value operations (inserts, deletes or
209969 ** parameter. Unless the table has an external primary key index
209971 ** if the table does have an external primary key index, then *piPk
209972 ** is set to the root page number of the primary key index before
210296 ** largest key that has already been written to the target table and
210358 ** queries the target index b-tree for the largest key already written to
210364 ** * The last key written to the index before the operation was
210533 /* An integer primary key. If the table has an explicit IPK, use
210637 ** primary key of the current table. For example, if the table is:
210832 ** a table b-tree where the table has an external primary key. If the
210834 ** a table (not index) with an external primary key, this function is a
210859 /* Figure out the name of the primary key index for the current table.
211148 char *zImposterPK = 0; /* Primary key declaration for imposter */
212201 /* For a virtual table, or a table with no primary key, the
213077 ** Return the total number of key-value operations (inserts, deletes or
215618 u8 *abPK; /* Primary key array */
215641 u8 *abPK; /* Array of primary key flags */
215976 ** This macro is used to calculate hash key values for data structures. In
215978 ** as a series of unsigned integers. In order to calculate a hash-key value
215988 ** key values of modified rows.
215994 ** hash-key value passed as the first. Return the new hash-key value.
216003 ** the hash-key value passed as the first. Return the new hash-key value.
216013 ** hash-key value passed as the first. Return the new hash-key value.
216021 ** It calculates a hash based on the primary key values of the old.* or
216023 ** *piHash before returning. If the primary key contains one or more NULL
216105 ** Based on the primary key values stored in change aRecord, calculate a
216106 ** hash key. Assume the has table has nBucket buckets. The hash keys
216130 ** primary key columns. */
216159 ** have the same values stored in the primary key columns), or false
216491 ** column is part of the primary key.
216636 ** key, sqlite3_session.rc is left set to SQLITE_OK and non-zero returned to
216862 /* Calculate the hash-key for this change. If the primary key of the row
217745 ** Otherwise, the old.* record contains all primary key values and the
217900 ** zTab in database zDb based on its primary key. i.e.
218090 u8 *abPK = 0; /* Primary key array */
218524 u8 *abPK, /* Array of primary key flags, or NULL */
219041 ** it sets the output variable to the total number of known foreign key
219536 ** key. Assuming the following table structure:
219695 ** This function binds the primary key values from the change that changeset
219713 u8 *abPK, /* Primary key flags array */
219798 ** record with the same primary key as the record about to be deleted, updated
219847 /* There exists another row with the new.* primary key. */
219861 /* No other row with the new.* primary key. */
219899 ** one is encountered, update or delete the row with the matching primary key
219995 ** a row with a matching primary key. If so, this is a DATA conflict.
219996 ** Otherwise, if there is no primary key match, it is a NOTFOUND. */
220077 ** specified primary key and the conflict handler returned
220273 "primary key mismatch for table %s", zTab
229483 ** following type. Each object, its key (a nul-terminated string) and
229485 ** key immediately follows the object in memory. The position list
229486 ** data immediately follows the key data in memory.
229488 ** The data that follows the key is in a similar, but not identical format
229504 Fts5HashEntry *pHashNext; /* Next hash entry with same hash-key */
229510 int nKey; /* Length of key in bytes */
229678 ** Add an entry to the in-memory hash table. The key is the concatenation
229835 ** each sorted in key order. This function merges the two lists into a
230505 ** the smallest key overall. aFirst[0] is unused.
232675 ** to a key that is a duplicate of another, higher priority,
233830 ** at least one term. Argument (nTerm/pTerm) is the split-key - a term that
234373 /* Check for key annihilation. */
235862 const char *z, /* Index key to query for */
235863 int n, /* Size of index key in bytes */
236122 ** to or larger than the split-key in zIdxTerm. Also check that if there
236131 int res; /* Comparison of term and split-key */
242415 unsigned int key = (((unsigned int)c)<<3) | 0x00000007;
242421 if( key >= aDia[iTest] ){
242428 assert( key>=aDia[iRes] );
244655 unsigned char *key;
244786 CODEC_STATIC void *opensslGetCtx(void *cipher, int mode, unsigned char *key, unsigned char *initVector){
244793 EVP_CipherInit_ex(tmpCtx, NULL, NULL, key, initVector, mode);
244816 CODEC_STATIC int opensslHmac(Buffer *key, Buffer *input1, Buffer *input2, Buffer *output, int hmacAlgo){
244822 HMAC_Init_ex(ctx, key->buffer, key->bufferSize, EVP_sha1(), NULL);
244824 HMAC_Init_ex(ctx, key->buffer, key->bufferSize, EVP_sha256(), NULL);
244826 HMAC_Init_ex(ctx, key->buffer, key->bufferSize, EVP_sha512(), NULL);
244836 CODEC_STATIC void opensslKdf(Buffer *password, Buffer *salt, int workfactor, Buffer *key, int kdfAlgo){
244839 workfactor, EVP_sha1(), key->bufferSize, key->buffer);
244842 workfactor, EVP_sha256(), key->bufferSize, key->buffer);
244845 workfactor, EVP_sha512(), key->bufferSize, key->buffer);
244925 if(keyCtx->key != NULL){
244926 (void)memset_s(keyCtx->key, keyCtx->codecConst.keySize, 0, keyCtx->codecConst.keySize);
244927 sqlite3_free(keyCtx->key);
244928 keyCtx->key = NULL;
244953 keyCtx->key = (unsigned char *)sqlite3Malloc(keyCtx->codecConst.keySize);
244975 // This function will free all resources of key context, except it self.
244983 // You should clear key derive result of output before you call this function
244986 if(input->key != NULL && input->codecConst.keySize > 0){
244987 output->key = (unsigned char *)sqlite3Malloc(output->codecConst.keySize);
244988 if(output->key == NULL){
244992 rc = memcpy_s(output->key, output->codecConst.keySize, input->key, input->codecConst.keySize);
245025 // You should set all key infos including salt before you call this function
245059 if(keyCtx->key == NULL || keyCtx->hmacKey == NULL || keyCtx->keyInfo == NULL){
245065 sqlite3CodecHex2Bin(keyCtx->password + 2, keyCtx->codecConst.keySize * 2, keyCtx->key);
245073 sqlite3CodecHex2Bin(keyCtx->password + 2, keyCtx->codecConst.keySize * 2, keyCtx->key);
245083 Buffer key;
245088 key.buffer = keyCtx->key;
245089 key.bufferSize = keyCtx->codecConst.keySize;
245090 opensslKdf(&password, &salt, keyCtx->iter, &key, keyCtx->codecConst.kdfAlgo);
245093 sqlite3CodecBin2Hex(keyCtx->key, keyCtx->codecConst.keySize, keyCtx->keyInfo + 2);
245104 hmacPassword.buffer = keyCtx->key;
245130 // This function may clear key derive infos
245150 // You should clear key derive infos before you call this function
245261 // You should clear key derive infos and password infos before you call this function
245276 // You should clear key derive infos and password infos before you call this function
245339 // You should clear key context before you call this function
245489 Buffer key;
245490 key.buffer = ctx->hmacKey;
245491 key.bufferSize = ctx->codecConst.keySize;
245503 int rc = opensslHmac(&key, &input1, &input2, &outputBuffer, ctx->codecConst.hmacAlgo);
245570 void *cipherCtx = opensslGetCtx(keyCtx->codecConst.cipher, CODEC_OPERATION_ENCRYPT, keyCtx->key, initVector.buffer);
245624 void *cipherCtx = opensslGetCtx(keyCtx->codecConst.cipher, CODEC_OPERATION_DECRYPT, keyCtx->key, initVector);
246329 int (*key)(sqlite3*,const void*,int);