Lines Matching full:constraint
943 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
2027 ** ^An [INSERT] that fails due to a constraint violation is not a
2032 ** encounters a constraint violation, it does not fail. The
2034 ** the constraint problem so INSERT OR REPLACE will always change
2069 ** are changed as side effects of [REPLACE] constraint resolution,
3581 ** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
4675 ** an error or constraint causes an implicit rollback to occur.
4870 ** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
4911 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
5091 ** expr on the right-hand side can be evaluated (and thus the constraint
5107 ** is true, then the constraint is assumed to be fully handled by the
5128 int iColumn; /* Column on left-hand side of constraint */
5129 unsigned char op; /* Constraint operator */
5130 unsigned char usable; /* True if this constraint is usable */
5140 int argvIndex; /* if >0, constraint is part of argv to xFilter */
5141 unsigned char omit; /* Do not code a test for this constraint */
5151 ** CAPI3REF: Virtual Table Constraint Operator Codes
5155 ** an operator that is part of a constraint term in the wHERE clause of
9222 u8 notNull; /* True if there is a NOT NULL constraint */
9446 ** Each foreign key constraint is an instance of the following structure.
9455 ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
9472 u8 isDeferred; /* True if constraint checking is deferred till COMMIT */
9482 ** SQLite supports many different ways to resolve a constraint
9483 ** error. ROLLBACK processing means that a constraint violation
9490 ** occurs. IGNORE means that the particular row that caused the constraint
9493 ** a UNIQUE constraint violation are removed so that the new insert or
9506 #define OE_None 0 /* There is no constraint to check */
10125 u8 isCheck; /* True if resolving names in a CHECK constraint */
11313 ** this constraint.
15595 ** fragmentation as long as the following constraint holds:
15600 ** that an application can, at any time, verify this constraint.
17786 ** xScratchMalloc(). We verify this constraint in the single-threaded
47499 ** size supplied does not meet this constraint then the page size is not
48643 ** the result of a constraint, malloc() failure or IO error) then
48689 ** that are contained within a BEGIN...COMMIT block. If a constraint
55654 ** * OP_FkCounter with P2==0 (immediate foreign key constraint)
57260 ** database handles deferred constraint counter to the value it had when
57299 ** committed. If there are outstanding deferred foreign key constraint
57312 sqlite3SetString(&p->zErrMsg, db, "foreign key constraint failed");
57424 ** or hit an 'OR FAIL' constraint and there are no deferred foreign
59334 ** Constraint: If you have ENABLE_COLUMN_METADATA then you must
61264 sqlite3_log(pOp->p1, "constraint failed at %d in [%s]", pc, p->zSql);
63088 ** constraint violations present in the database to the value stored
63241 /* Store the current value of the database handles deferred constraint
65524 ** Increment a "constraint counter" by P2 (P2 may be negative or positive).
65525 ** If P1 is non-zero, the database constraint counter is incremented
65540 ** This opcode tests if a foreign key constraint-counter is currently zero.
65544 ** If P1 is non-zero, then the jump is taken if the database constraint-counter
65545 ** is zero (the one that counts deferred constraint violations). If P1 is
65546 ** zero, the jump is taken if the statement constraint-counter is zero
65547 ** (immediate foreign key constraint violations).
69477 ** to enforce this constraint.
70113 assert( p->iTable>=0 ); /* p cannot be part of a CHECK constraint */
70200 ** has a UNIQUE constraint or UNIQUE index.
70661 ** of a "NOT NULL" constraint in the database schema.
73206 ** If there is a NOT NULL constraint, then the default value for the
75808 ** parsing a CREATE TABLE statement. A "NOT NULL" constraint has
76016 ** Add a new CHECK constraint to the table currently under construction.
76294 /* Resolve names in all CHECK constraint expressions.
77188 ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable
77193 ** is a primary key or unique-constraint on the most recent column added
77314 ** dealing with a primary key or UNIQUE constraint. We have to invent our
77501 ** the constraint occur in different orders, then the constraints are
77522 /* This constraint creates the same index as a previous
77523 ** constraint specified somewhere in the CREATE TABLE statement.
77525 ** constraint and the previous equivalent constraint have explicit
77572 ** or UNIQUE constraint of a CREATE TABLE statement. Since the table
77601 /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
77633 ** OE_Ignore. This is necessary for the correct constraint check
77729 "or PRIMARY KEY constraint cannot be dropped", 0);
78318 ** be set for operations that might fail (due to a constraint) part of
81253 ** If an immediate foreign key constraint is violated, SQLITE_CONSTRAINT
81255 ** deferred foreign key constraint is violated, no action is taken
81257 ** transaction before fixing the constraint violation, the attempt fails.
81268 ** * When a commit fails due to a deferred foreign key constraint,
81269 ** there is no way to tell which foreign constraint is not satisfied,
81282 ** constraint counter.
81287 ** found (as the constraint is now satisfied).
81311 ** If a delete caused by OR REPLACE violates an FK constraint, an exception
81312 ** is thrown, even if the FK constraint would be satisfied after the new
81318 ** constraint counter is greater than zero, it returns SQLITE_CONSTRAINT
81322 ** INSERT violates a foreign key constraint. This is necessary as such
81371 ** A foreign key constraint requires that the key columns in the parent
81372 ** table are collectively subject to a UNIQUE or PRIMARY KEY constraint.
81373 ** Given that pParent is the parent table for foreign key constraint pFKey,
81380 ** If the parent key consists of a single column (the foreign key constraint
81385 ** constraint to the parent table column stored in the left-most column
81395 ** UNIQUE or PRIMARY KEY constraint, or
81412 Table *pParent, /* Parent table of FK constraint pFKey */
81519 ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed
81532 ** INSERT immediate Increment the "immediate constraint counter".
81534 ** DELETE immediate Decrement the "immediate constraint counter".
81536 ** INSERT deferred Increment the "deferred constraint counter".
81538 ** DELETE deferred Decrement the "deferred constraint counter".
81548 FKey *pFKey, /* Foreign key constraint */
81551 int nIncr, /* Increment constraint counter by this */
81564 ** any are, then the constraint is considered satisfied. No need to
81590 ** to increment the constraint-counter (i.e. this is an INSERT operation),
81592 ** increment the constraint-counter. */
81616 ** to increment the constraint-counter (i.e. this is an INSERT operation),
81618 ** increment the constraint-counter. */
81640 ** one row into the table, raise a constraint immediately instead of
81645 pParse, OE_Abort, "foreign key constraint failed", P4_STATIC
81660 ** from the parent table of foreign key constraint pFKey and, if pFKey is
81671 ** DELETE immediate Increment the "immediate constraint counter".
81673 ** throw a "foreign key constraint failed" exception.
81675 ** INSERT immediate Decrement the "immediate constraint counter".
81677 ** DELETE deferred Increment the "deferred constraint counter".
81679 ** throw a "foreign key constraint failed" exception.
81681 ** INSERT deferred Decrement the "deferred constraint counter".
81777 ** clause. If the constraint is not deferred, throw an exception for
81779 ** deferred constraint counter by nIncr for each row selected. */
81805 ** to the FKey structure representing the foreign key constraint on table
81842 ** (a) The table is the parent table of a FK constraint, or
81843 ** (b) The table is the child table of a deferred FK constraint and it is
81845 ** constraint violations in the database,
81859 /* Search for a deferred foreign key constraint for which this table
81877 /* If the DELETE has generated immediate foreign key constraint
81883 pParse, OE_Abort, "foreign key constraint failed", P4_STATIC
81894 ** table pTab to generate VDBE code to perform foreign key constraint
81993 ** outstanding foreign key constraint violation. */
81998 ** be found, adding the child row has violated the FK constraint. */
82041 ** immediately if the FK constraint is violated, even if this is a
82043 ** the constraint, the FK should specify NO ACTION (represented
82106 ** foreign key constraint. */
82281 pRaise = sqlite3Expr(db, TK_RAISE, "foreign key constraint failed");
82404 /* EV: R-30323-21917 Each foreign key constraint in SQLite is
82746 int onError, /* How to handle constraint errors */
82858 int onError /* How to handle constraint errors */
83484 ** Generate code to do constraint checks prior to an INSERT or an UPDATE.
83514 ** CHECK, and UNIQUE constraints are all checked. If a constraint fails,
83518 ** Constraint type Action What Happens
83550 ** for the constraint is used.
83568 int *pbMayReplace /* OUT: Set to true if constraint may cause a replace */
84031 int onError, /* How to handle constraint errors */
85713 ** Return a human-readable name for a constraint resolution action.
87084 ** constraint for a CREATE TABLE. The index should have already
90490 ** an ORDER BY clause. Ticket #3773. We could relax this constraint
93657 int onError /* How to handle constraint errors */
94044 /* Do constraint checks. */
94048 /* Do FK constraint checks. */
95757 #define WHERE_TOP_LIMIT 0x00100000 /* x<EXPR or x<=EXPR constraint */
95758 #define WHERE_BTM_LIMIT 0x00200000 /* x>EXPR or x>=EXPR constraint */
96809 /* Add a WO_MATCH auxiliary term to the constraint set if the
96886 ** index do not need to satisfy this constraint.) The *pbRev value is
96964 ** then the index cannot satisfy the ORDER BY constraint.
97040 sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
97636 ** table. In other words, if the constraint is of the form:
97640 ** and we are evaluating a join, then the constraint on column is
97864 ** range constraint. Or, equivalently, the number of equality constraints
97885 ** reduces the search space by 2/3rds. Hence a single constraint (x>?)
97886 ** results in a return of 33 and a range constraint (x>? AND x<?) results
98101 ** space to 1/3rd its original size. So an x>? constraint reduces
98293 /* Assume each additional range constraint reduces the result
98479 ** The current value for the constraint is left in register iReg.
98481 ** For a constraint of the form X=expr, the expression is evaluated and its
98573 ** the right hand side of the equality constraint (t2.b) has NONE affinity,
98590 WhereTerm *pTerm; /* A single constraint term */
99055 int regBase; /* Base register holding constraint values */
99057 WhereTerm *pRangeStart = 0; /* Inequality constraint at range start */
99058 WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */
99062 int nConstraint; /* Number of constraint terms */
99067 char *zStartAff; /* Affinity for start of range constraint */
99068 char *zEndAff; /* Affinity for end of range constraint */
99092 /* Find any inequality constraint terms for the start and end
99104 /* Generate code to evaluate all constraint terms using == or IN
99166 /* Load the value for the inequality constraint at the end of the
101134 "CONSTRAINT", "DEFAULT", "NULL", "PRIMARY",
101235 /* 55 */ "carg ::= CONSTRAINT nm ccons",
101273 /* 93 */ "tcons ::= CONSTRAINT nm",
103355 /* (55) carg ::= CONSTRAINT nm ccons */ yytestcase(yyruleno==55);
103361 /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);
103876 testcase( i==38 ); /* CONSTRAINT */
105599 /* Any deferred constraint violations have now been resolved. */
105633 /* SQLITE_CONSTRAINT */ "constraint failed",
107015 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
109255 int iCons = -1; /* Index of constraint to use */
109276 /* A MATCH constraint. Use a full-text search.
109278 ** If there is more than one MATCH constraint available, use the first
109279 ** one encountered. If there is both a MATCH constraint and a direct
119321 ** A search constraint.
119326 double rValue; /* Constraint value. */
119328 sqlite3_rtree_geometry *pGeom; /* Constraint callback argument for a MATCH */
119908 int i; /* Used to iterate through constraint array */
119946 ** The r-tree constraint passed as the second argument to this function is
119947 ** guaranteed to be a MATCH constraint.
119951 RtreeConstraint *pConstraint, /* MATCH constraint to test */
120271 ** as the second argument for a MATCH constraint. The value passed as the
120418 ** constraint used. The first two bytes of idxStr correspond to
120419 ** the constraint in sqlite3_index_info.aConstraintUsage[] with
120422 ** The first of each pair of bytes in idxStr identifies the constraint
120436 ** to which the constraint applies. The leftmost coordinate column
120453 /* We have an equality constraint on the rowid. Use strategy 1. */
120489 /* Make sure this particular constraint has not been used before.
120496 ** A == is disqualifed if there is any prior constraint.
121859 goto constraint;
121868 goto constraint;
121882 goto constraint;
121902 constraint: