Home | History | Annotate | Download | only in orig

Lines Matching refs:pFKey

10186   FKey *pFKey;         /* Linked list of all foreign keys in this table */
71398 FKey *pFKey;
71399 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
71401 for(j=0; j<pFKey->nCol; j++){
71402 if( pFKey->aCol[j].iFrom==iCol ){
79106 if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){
83400 FKey *pFKey = 0;
83428 pFKey) + (nCol-1)*sizeof(pFKey->aCol[0]) + pTo->n + 1;
83434 pFKey = sqlite3DbMallocZero(db, nByte );
83435 if( pFKey==0 ){
83438 pFKey->pFrom = p;
83439 pFKey->pNextFrom = p->pFKey;
83440 z = (char*)&pFKey->aCol[nCol];
83441 pFKey->zTo = z;
83446 pFKey->nCol = nCol;
83448 pFKey->aCol[0].iFrom = p->nCol-1;
83454 pFKey->aCol[i].iFrom = j;
83469 pFKey->aCol[i].zCol = z;
83475 pFKey->isDeferred = 0;
83476 pFKey->aAction[0] = (u8)(flags & 0xff); /* ON DELETE action */
83477 pFKey->aAction[1] = (u8)((flags >> 8 ) & 0xff); /* ON UPDATE action */
83481 pFKey->zTo, sqlite3Strlen30(pFKey->zTo), (void *)pFKey
83483 if( pNextTo==pFKey ){
83489 pFKey->pNextTo = pNextTo;
83490 pNextTo->pPrevTo = pFKey;
83495 p->pFKey = pFKey;
83496 pFKey = 0;
83499 sqlite3DbFree(db, pFKey);
83515 FKey *pFKey;
83516 if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return;
83518 pFKey->isDeferred = (u8)isDeferred;
87885 ** Given that pParent is the parent table for foreign key constraint pFKey,
87924 Table *pParent, /* Parent table of FK constraint pFKey */
87925 FKey *pFKey, /* Foreign key to find index for */
87927 int **paiCol /* OUT: Map of index columns in pFKey */
87931 int nCol = pFKey->nCol; /* Number of columns in parent key */
87932 char *zKey = pFKey->aCol[0].zCol; /* Name of left-most parent key column */
87970 ** column of pFKey, then this index is a winner. */
87979 for(i=0; i<nCol; i++) aiCol[i] = pFKey->aCol[i].iFrom;
88005 if( sqlite3StrICmp(pFKey->aCol[j].zCol, zIdxCol)==0 ){
88006 if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom;
88031 ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed
88032 ** on the child table of pFKey, this function is invoked twice for each row
88058 Table *pTab, /* Parent table of FK pFKey */
88060 FKey *pFKey, /* Foreign key constraint */
88079 sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk);
88081 for(i=0; i<pFKey->nCol; i++){
88105 if( pTab==pFKey->pFrom && nIncr==1 ){
88116 int nCol = pFKey->nCol;
88137 if( pTab==pFKey->pFrom && nIncr==1 ){
88162 if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){
88172 if( nIncr>0 && pFKey->isDeferred==0 ){
88175 sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
88184 ** from the parent table of foreign key constraint pFKey and, if pFKey is
88215 FKey *pFKey, /* Foreign key relationship */
88231 iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0);
88242 for(i=0; i<pFKey->nCol; i++){
88266 iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
88268 zCol = pFKey->pFrom->aCol[iCol].zName;
88278 if( pTab==pFKey->pFrom && nIncr>0 ){
88305 if( nIncr>0 && pFKey->isDeferred==0 ){
88308 sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
88389 for(p=pTab->pFKey; p; p=p->pNextFrom){
88443 FKey *pFKey; /* Used to iterate through FKs */
88459 for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){
88460 Table *pTo; /* Parent table of foreign key pFKey */
88473 pTo = sqlite3FindTable(db, pFKey->zTo, zDb);
88475 pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb);
88477 if( !pTo || locateFkeyIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){
88489 int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1;
88490 for(i=0; i<pFKey->nCol; i++){
88491 int iReg = pFKey->aCol[i].iFrom + regOld + 1;
88494 sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1);
88498 assert( pFKey->nCol==1 || (aiFree && pIdx) );
88503 iCol = pFKey->aCol[0].iFrom;
88506 for(i=0; i<pFKey->nCol; i++){
88533 fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1,isIgnore);
88538 fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1,isIgnore);
88545 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
88546 Index *pIdx = 0; /* Foreign key index for pFKey */
88550 if( !pFKey->isDeferred && !pParse->pToplevel && !pParse->isMultiWrite ){
88557 if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){
88561 assert( aiCol || pFKey->nCol==1 );
88569 pItem->pTab = pFKey->pFrom;
88570 pItem->zName = pFKey->pFrom->zName;
88575 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1);
88584 fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1);
88607 for(p=pTab->pFKey; p; p=p->pNextFrom){
88646 return (sqlite3FkReferences(pTab) || pTab->pFKey);
88654 for(p=pTab->pFKey; p; p=p->pNextFrom){
88683 ** compiled on table pTab, which is the parent table of foreign-key pFKey.
88689 ** equivalent to the ON UPDATE or ON DELETE action specified by pFKey.
88694 ** For example, if pFKey is the foreign key and pTab is table "p" in
88713 FKey *pFKey, /* Foreign key to get action for */
88721 action = pFKey->aAction[iAction];
88722 pTrigger = pFKey->apTrigger[iAction];
88737 if( locateFkeyIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0;
88738 assert( aiCol || pFKey->nCol==1 );
88740 for(i=0; i<pFKey->nCol; i++){
88748 iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom;
88751 tFromCol.z = pFKey->pFrom->aCol[iFromCol].zName;
88796 Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt;
88811 zFrom = pFKey->pFrom->zName;
88885 pFKey->apTrigger[iAction] = pTrigger;
88907 FKey *pFKey; /* Iterator variable */
88908 for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){
88909 Trigger *pAction = fkActionTrigger(pParse, pTab, pFKey, pChanges);
88925 FKey *pFKey; /* Iterator variable */
88926 FKey *pNext; /* Copy of pFKey->pNextFrom */
88929 for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){
88933 if( pFKey->pPrevTo ){
88934 pFKey->pPrevTo->pNextTo = pFKey->pNextTo;
88936 void *p = (void *)pFKey->pNextTo;
88937 const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo);
88940 if( pFKey->pNextTo ){
88941 pFKey->pNextTo->pPrevTo = pFKey->pPrevTo;
88948 assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 );
88952 fkTriggerDelete(db, pFKey->apTrigger[0]);
88953 fkTriggerDelete(db, pFKey->apTrigger[1]);
88956 pNext = pFKey->pNextFrom;
88957 sqlite3DbFree(db, pFKey);
90701 if( (pParse->db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){
93096 pFK = pTab->pFKey;