line |
true |
false |
branch |
119
|
44 |
0 |
if( pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; |
|
44 |
0 |
if( pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; |
126
|
0 |
44 |
if( zTab==0 ) goto insert_cleanup; |
128
|
0 |
44 |
if( pTab==0 ){ |
133
|
0 |
44 |
if( sqliteAuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){ |
145
|
44 |
0 |
row_triggers_exist = before_triggers || after_triggers; |
|
0 |
44 |
row_triggers_exist = before_triggers || after_triggers; |
147
|
0 |
44 |
if( sqliteIsReadOnly(pParse, pTab, before_triggers) ){ |
150
|
0 |
44 |
if( pTab==0 ) goto insert_cleanup; |
154
|
0 |
44 |
if( isView && sqliteViewGetColumnNames(pParse, pTab) ){ |
|
0 |
0 |
if( isView && sqliteViewGetColumnNames(pParse, pTab) ){ |
161
|
0 |
44 |
if( v==0 ) goto insert_cleanup; |
162
|
44 |
0 |
sqliteBeginWriteOperation(pParse, pSelect || row_triggers_exist, pTab->iDb); |
|
0 |
44 |
sqliteBeginWriteOperation(pParse, pSelect || row_triggers_exist, pTab->iDb); |
165
|
0 |
44 |
if( row_triggers_exist ){ |
177
|
0 |
44 |
if( pSelect ){ |
185
|
0 |
0 |
if( rc || pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; |
|
0 |
0 |
if( rc || pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; |
|
0 |
0 |
if( rc || pParse->nErr || sqlite_malloc_failed ) goto insert_cleanup; |
199
|
0 |
0 |
if( row_triggers_exist ){ |
204
|
0 |
0 |
if( addr>0 ){ |
206
|
0 |
0 |
if( pOp->opcode==OP_Integer && pOp->p1==pTab->iDb ){ |
|
0 |
0 |
if( pOp->opcode==OP_Integer && pOp->p1==pTab->iDb ){ |
212
|
0 |
0 |
if( useTempTable ){ |
246
|
95 |
44 |
for(i=0; i
|
247
|
0 |
95 |
if( sqliteExprResolveIds(pParse, &dummy, 0, pList->a[i].pExpr) ){ |
250
|
0 |
95 |
if( sqliteExprCheck(pParse, pList->a[i].pExpr, 0, 0) ){ |
259
|
41 |
3 |
if( pColumn==0 && nColumn!=pTab->nCol ){ |
|
0 |
41 |
if( pColumn==0 && nColumn!=pTab->nCol ){ |
265
|
3 |
41 |
if( pColumn!=0 && nColumn!=pColumn->nId ){ |
|
0 |
3 |
if( pColumn!=0 && nColumn!=pColumn->nId ){ |
281
|
3 |
41 |
if( pColumn ){ |
282
|
6 |
3 |
for(i=0; inId; i++){ |
285
|
6 |
3 |
for(i=0; inId; i++){ |
286
|
9 |
0 |
for(j=0; jnCol; j++){ |
287
|
6 |
3 |
if( sqliteStrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){ |
289
|
0 |
6 |
if( j==pTab->iPKey ){ |
295
|
0 |
6 |
if( j>=pTab->nCol ){ |
296
|
0 |
0 |
if( sqliteIsRowid(pColumn->a[i].zName) ){ |
312
|
41 |
3 |
if( pColumn==0 ){ |
318
|
0 |
44 |
if( row_triggers_exist ){ |
324
|
0 |
44 |
if( db->flags & SQLITE_CountRows ){ |
331
|
44 |
0 |
if( !row_triggers_exist ){ |
342
|
0 |
44 |
if( useTempTable ){ |
346
|
0 |
44 |
}else if( pSelect ){ |
354
|
0 |
44 |
if( before_triggers ){ |
362
|
0 |
0 |
if( keyColumn<0 ){ |
364
|
0 |
0 |
}else if( useTempTable ){ |
366
|
0 |
0 |
}else if( pSelect ){ |
378
|
0 |
0 |
for(i=0; inCol; i++){ |
379
|
0 |
0 |
if( pColumn==0 ){ |
382
|
0 |
0 |
for(j=0; jnId; j++){ |
383
|
0 |
0 |
if( pColumn->a[j].idx==i ) break; |
386
|
0 |
0 |
if( pColumn && j>=pColumn->nId ){ |
|
0 |
0 |
if( pColumn && j>=pColumn->nId ){ |
388
|
0 |
0 |
}else if( useTempTable ){ |
390
|
0 |
0 |
}else if( pSelect ){ |
400
|
0 |
0 |
if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_BEFORE, pTab, |
409
|
0 |
44 |
if( row_triggers_exist && !isView ){ |
|
0 |
0 |
if( row_triggers_exist && !isView ){ |
420
|
44 |
0 |
if( !isView ){ |
421
|
0 |
44 |
if( keyColumn>=0 ){ |
422
|
0 |
0 |
if( useTempTable ){ |
424
|
0 |
0 |
}else if( pSelect ){ |
443
|
95 |
44 |
for(i=0; inCol; i++){ |
444
|
0 |
95 |
if( i==pTab->iPKey ){ |
452
|
89 |
6 |
if( pColumn==0 ){ |
455
|
9 |
0 |
for(j=0; jnId; j++){ |
456
|
6 |
3 |
if( pColumn->a[j].idx==i ) break; |
459
|
6 |
89 |
if( pColumn && j>=pColumn->nId ){ |
|
0 |
6 |
if( pColumn && j>=pColumn->nId ){ |
461
|
0 |
95 |
}else if( useTempTable ){ |
463
|
0 |
95 |
}else if( pSelect ){ |
475
|
0 |
44 |
sqliteCompleteInsertion(pParse, pTab, base, 0,0,0, |
481
|
0 |
44 |
if( (db->flags & SQLITE_CountRows)!=0 ){ |
485
|
0 |
44 |
if( row_triggers_exist ){ |
487
|
0 |
0 |
if( !isView ){ |
489
|
0 |
0 |
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){ |
495
|
0 |
0 |
if( sqliteCodeRowTrigger(pParse, TK_INSERT, 0, TK_AFTER, pTab, newIdx, -1, |
504
|
0 |
44 |
if( useTempTable ){ |
508
|
0 |
44 |
}else if( pSelect ){ |
514
|
44 |
0 |
if( !row_triggers_exist ){ |
517
|
2 |
44 |
for(idx=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, idx++){ |
528
|
0 |
44 |
if( db->flags & SQLITE_CountRows ){ |
536
|
44 |
0 |
if( pList ) sqliteExprListDelete(pList); |
537
|
0 |
44 |
if( pSelect ) sqliteSelectDelete(pSelect); |
641
|
0 |
44 |
int hasTwoRecnos = (isUpdate && recnoChng); |
|
0 |
0 |
int hasTwoRecnos = (isUpdate && recnoChng); |
650
|
95 |
44 |
for(i=0; i
|
651
|
0 |
95 |
if( i==pTab->iPKey ){ |
655
|
67 |
28 |
if( onError==OE_None ) continue; |
656
|
0 |
28 |
if( overrideError!=OE_Default ){ |
658
|
0 |
28 |
}else if( pParse->db->onError!=OE_Default ){ |
660
|
28 |
0 |
}else if( onError==OE_Default ){ |
663
|
0 |
28 |
if( onError==OE_Replace && pTab->aCol[i].zDflt==0 ){ |
|
0 |
0 |
if( onError==OE_Replace && pTab->aCol[i].zDflt==0 ){ |
702
|
0 |
44 |
if( recnoChng ){ |
704
|
0 |
0 |
if( overrideError!=OE_Default ){ |
706
|
0 |
0 |
}else if( pParse->db->onError!=OE_Default ){ |
708
|
0 |
0 |
}else if( onError==OE_Default ){ |
712
|
0 |
0 |
if( isUpdate ){ |
733
|
0 |
0 |
if( isUpdate ){ |
749
|
0 |
0 |
if( isUpdate ){ |
761
|
2 |
44 |
for(iCur=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, iCur++){ |
762
|
0 |
2 |
if( aIdxUsed && aIdxUsed[iCur]==0 ) continue; /* Skip unused indices */ |
|
0 |
0 |
if( aIdxUsed && aIdxUsed[iCur]==0 ) continue; /* Skip unused indices */ |
767
|
3 |
2 |
for(i=0; inColumn; i++){ |
769
|
0 |
3 |
if( idx==pTab->iPKey ){ |
776
|
2 |
0 |
if( pParse->db->file_format>=4 ) sqliteAddIdxKeyType(v, pIdx); |
780
|
0 |
2 |
if( onError==OE_None ) continue; /* pIdx is not a UNIQUE index */ |
781
|
0 |
2 |
if( overrideError!=OE_Default ){ |
783
|
0 |
2 |
}else if( pParse->db->onError!=OE_Default ){ |
785
|
1 |
1 |
}else if( onError==OE_Default ){ |
788
|
0 |
2 |
if( seenReplace ){ |
789
|
0 |
0 |
if( onError==OE_Ignore ) onError = OE_Replace; |
790
|
0 |
0 |
else if( onError==OE_Fail ) onError = OE_Abort; |
805
|
1 |
1 |
strcpy(zErrMsg, pIdx->nColumn>1 ? "columns " : "column "); |
807
|
3 |
2 |
for(j=0; jnColumn && n1
|
|
3 |
0 |
for(j=0; jnColumn && n1
|
810
|
1 |
2 |
if( j>0 ){ |
814
|
0 |
3 |
if( n1+n2>sizeof(zErrMsg)-30 ){ |
823
|
1 |
1 |
strcpy(&zErrMsg[n1], |
836
|
0 |
0 |
if( isUpdate ){ |
880
|
2 |
44 |
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){} |
881
|
2 |
44 |
for(i=nIdx-1; i>=0; i--){ |
882
|
0 |
2 |
if( aIdxUsed && aIdxUsed[i]==0 ) continue; |
|
0 |
0 |
if( aIdxUsed && aIdxUsed[i]==0 ) continue; |
886
|
0 |
44 |
if( newIdx>=0 ){ |
893
|
0 |
44 |
(isUpdate?0:OPFLAG_LASTROWID) | OPFLAG_CSCHANGE); |
894
|
0 |
44 |
if( isUpdate && recnoChng ){ |
|
0 |
0 |
if( isUpdate && recnoChng ){ |
914
|
2 |
50 |
for(i=1, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ |