Lines Matching full:constraint
947 #define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
2034 ** ^An [INSERT] that fails due to a constraint violation is not a
2039 ** encounters a constraint violation, it does not fail. The
2041 ** the constraint problem so INSERT OR REPLACE will always change
2076 ** are changed as side effects of [REPLACE] constraint resolution,
3588 ** ^[SQLITE_ERROR] means that a run-time error (such as a constraint
4682 ** an error or constraint causes an implicit rollback to occur.
4877 ** <tr><td> 7th <td> int <td> True if column has a NOT NULL constraint
4918 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
5098 ** expr on the right-hand side can be evaluated (and thus the constraint
5114 ** is true, then the constraint is assumed to be fully handled by the
5135 int iColumn; /* Column on left-hand side of constraint */
5136 unsigned char op; /* Constraint operator */
5137 unsigned char usable; /* True if this constraint is usable */
5147 int argvIndex; /* if >0, constraint is part of argv to xFilter */
5148 unsigned char omit; /* Do not code a test for this constraint */
5158 ** CAPI3REF: Virtual Table Constraint Operator Codes
5162 ** an operator that is part of a constraint term in the wHERE clause of
9229 u8 notNull; /* True if there is a NOT NULL constraint */
9453 ** Each foreign key constraint is an instance of the following structure.
9462 ** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x)
9479 u8 isDeferred; /* True if constraint checking is deferred till COMMIT */
9489 ** SQLite supports many different ways to resolve a constraint
9490 ** error. ROLLBACK processing means that a constraint violation
9497 ** occurs. IGNORE means that the particular row that caused the constraint
9500 ** a UNIQUE constraint violation are removed so that the new insert or
9513 #define OE_None 0 /* There is no constraint to check */
10132 u8 isCheck; /* True if resolving names in a CHECK constraint */
11320 ** this constraint.
15602 ** fragmentation as long as the following constraint holds:
15607 ** that an application can, at any time, verify this constraint.
17793 ** xScratchMalloc(). We verify this constraint in the single-threaded
47506 ** size supplied does not meet this constraint then the page size is not
48650 ** the result of a constraint, malloc() failure or IO error) then
48696 ** that are contained within a BEGIN...COMMIT block. If a constraint
55661 ** * OP_FkCounter with P2==0 (immediate foreign key constraint)
57267 ** database handles deferred constraint counter to the value it had when
57306 ** committed. If there are outstanding deferred foreign key constraint
57319 sqlite3SetString(&p->zErrMsg, db, "foreign key constraint failed");
57431 ** or hit an 'OR FAIL' constraint and there are no deferred foreign
59341 ** Constraint: If you have ENABLE_COLUMN_METADATA then you must
61271 sqlite3_log(pOp->p1, "constraint failed at %d in [%s]", pc, p->zSql);
63095 ** constraint violations present in the database to the value stored
63248 /* Store the current value of the database handles deferred constraint
65531 ** Increment a "constraint counter" by P2 (P2 may be negative or positive).
65532 ** If P1 is non-zero, the database constraint counter is incremented
65547 ** This opcode tests if a foreign key constraint-counter is currently zero.
65551 ** If P1 is non-zero, then the jump is taken if the database constraint-counter
65552 ** is zero (the one that counts deferred constraint violations). If P1 is
65553 ** zero, the jump is taken if the statement constraint-counter is zero
65554 ** (immediate foreign key constraint violations).
69484 ** to enforce this constraint.
70120 assert( p->iTable>=0 ); /* p cannot be part of a CHECK constraint */
70207 ** has a UNIQUE constraint or UNIQUE index.
70668 ** of a "NOT NULL" constraint in the database schema.
73213 ** If there is a NOT NULL constraint, then the default value for the
75815 ** parsing a CREATE TABLE statement. A "NOT NULL" constraint has
76023 ** Add a new CHECK constraint to the table currently under construction.
76301 /* Resolve names in all CHECK constraint expressions.
77195 ** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable
77200 ** is a primary key or unique-constraint on the most recent column added
77321 ** dealing with a primary key or UNIQUE constraint. We have to invent our
77508 ** the constraint occur in different orders, then the constraints are
77529 /* This constraint creates the same index as a previous
77530 ** constraint specified somewhere in the CREATE TABLE statement.
77532 ** constraint and the previous equivalent constraint have explicit
77579 ** or UNIQUE constraint of a CREATE TABLE statement. Since the table
77608 /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */
77640 ** OE_Ignore. This is necessary for the correct constraint check
77736 "or PRIMARY KEY constraint cannot be dropped", 0);
78325 ** be set for operations that might fail (due to a constraint) part of
81260 ** If an immediate foreign key constraint is violated, SQLITE_CONSTRAINT
81262 ** deferred foreign key constraint is violated, no action is taken
81264 ** transaction before fixing the constraint violation, the attempt fails.
81275 ** * When a commit fails due to a deferred foreign key constraint,
81276 ** there is no way to tell which foreign constraint is not satisfied,
81289 ** constraint counter.
81294 ** found (as the constraint is now satisfied).
81318 ** If a delete caused by OR REPLACE violates an FK constraint, an exception
81319 ** is thrown, even if the FK constraint would be satisfied after the new
81325 ** constraint counter is greater than zero, it returns SQLITE_CONSTRAINT
81329 ** INSERT violates a foreign key constraint. This is necessary as such
81378 ** A foreign key constraint requires that the key columns in the parent
81379 ** table are collectively subject to a UNIQUE or PRIMARY KEY constraint.
81380 ** Given that pParent is the parent table for foreign key constraint pFKey,
81387 ** If the parent key consists of a single column (the foreign key constraint
81392 ** constraint to the parent table column stored in the left-most column
81402 ** UNIQUE or PRIMARY KEY constraint, or
81419 Table *pParent, /* Parent table of FK constraint pFKey */
81526 ** child table of foreign key constraint pFKey. If an SQL UPDATE is executed
81539 ** INSERT immediate Increment the "immediate constraint counter".
81541 ** DELETE immediate Decrement the "immediate constraint counter".
81543 ** INSERT deferred Increment the "deferred constraint counter".
81545 ** DELETE deferred Decrement the "deferred constraint counter".
81555 FKey *pFKey, /* Foreign key constraint */
81558 int nIncr, /* Increment constraint counter by this */
81571 ** any are, then the constraint is considered satisfied. No need to
81597 ** to increment the constraint-counter (i.e. this is an INSERT operation),
81599 ** increment the constraint-counter. */
81623 ** to increment the constraint-counter (i.e. this is an INSERT operation),
81625 ** increment the constraint-counter. */
81647 ** one row into the table, raise a constraint immediately instead of
81652 pParse, OE_Abort, "foreign key constraint failed", P4_STATIC
81667 ** from the parent table of foreign key constraint pFKey and, if pFKey is
81678 ** DELETE immediate Increment the "immediate constraint counter".
81680 ** throw a "foreign key constraint failed" exception.
81682 ** INSERT immediate Decrement the "immediate constraint counter".
81684 ** DELETE deferred Increment the "deferred constraint counter".
81686 ** throw a "foreign key constraint failed" exception.
81688 ** INSERT deferred Decrement the "deferred constraint counter".
81784 ** clause. If the constraint is not deferred, throw an exception for
81786 ** deferred constraint counter by nIncr for each row selected. */
81812 ** to the FKey structure representing the foreign key constraint on table
81849 ** (a) The table is the parent table of a FK constraint, or
81850 ** (b) The table is the child table of a deferred FK constraint and it is
81852 ** constraint violations in the database,
81866 /* Search for a deferred foreign key constraint for which this table
81884 /* If the DELETE has generated immediate foreign key constraint
81890 pParse, OE_Abort, "foreign key constraint failed", P4_STATIC
81901 ** table pTab to generate VDBE code to perform foreign key constraint
82000 ** outstanding foreign key constraint violation. */
82005 ** be found, adding the child row has violated the FK constraint. */
82048 ** immediately if the FK constraint is violated, even if this is a
82050 ** the constraint, the FK should specify NO ACTION (represented
82113 ** foreign key constraint. */
82288 pRaise = sqlite3Expr(db, TK_RAISE, "foreign key constraint failed");
82411 /* EV: R-30323-21917 Each foreign key constraint in SQLite is
82753 int onError, /* How to handle constraint errors */
82865 int onError /* How to handle constraint errors */
83491 ** Generate code to do constraint checks prior to an INSERT or an UPDATE.
83521 ** CHECK, and UNIQUE constraints are all checked. If a constraint fails,
83525 ** Constraint type Action What Happens
83557 ** for the constraint is used.
83575 int *pbMayReplace /* OUT: Set to true if constraint may cause a replace */
84038 int onError, /* How to handle constraint errors */
85720 ** Return a human-readable name for a constraint resolution action.
87091 ** constraint for a CREATE TABLE. The index should have already
90497 ** an ORDER BY clause. Ticket #3773. We could relax this constraint
93664 int onError /* How to handle constraint errors */
94051 /* Do constraint checks. */
94055 /* Do FK constraint checks. */
95764 #define WHERE_TOP_LIMIT 0x00100000 /* x<EXPR or x<=EXPR constraint */
95765 #define WHERE_BTM_LIMIT 0x00200000 /* x>EXPR or x>=EXPR constraint */
96816 /* Add a WO_MATCH auxiliary term to the constraint set if the
96893 ** index do not need to satisfy this constraint.) The *pbRev value is
96971 ** then the index cannot satisfy the ORDER BY constraint.
97047 sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n",
97643 ** table. In other words, if the constraint is of the form:
97647 ** and we are evaluating a join, then the constraint on column is
97871 constraint. Or, equivalently, the number of equality constraints
97892 ** reduces the search space by 2/3rds. Hence a single constraint (x>?)
97893 ** results in a return of 33 and a range constraint (x>? AND x<?) results
98108 ** space to 1/3rd its original size. So an x>? constraint reduces
98300 /* Assume each additional range constraint reduces the result
98486 ** The current value for the constraint is left in register iReg.
98488 ** For a constraint of the form X=expr, the expression is evaluated and its
98580 ** the right hand side of the equality constraint (t2.b) has NONE affinity,
98597 WhereTerm *pTerm; /* A single constraint term */
99062 int regBase; /* Base register holding constraint values */
99064 WhereTerm *pRangeStart = 0; /* Inequality constraint at range start */
99065 WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */
99069 int nConstraint; /* Number of constraint terms */
99074 char *zStartAff; /* Affinity for start of range constraint */
99075 char *zEndAff; /* Affinity for end of range constraint */
99099 /* Find any inequality constraint terms for the start and end
99111 /* Generate code to evaluate all constraint terms using == or IN
99173 /* Load the value for the inequality constraint at the end of the
101141 "CONSTRAINT", "DEFAULT", "NULL", "PRIMARY",
101242 /* 55 */ "carg ::= CONSTRAINT nm ccons",
101280 /* 93 */ "tcons ::= CONSTRAINT nm",
103362 /* (55) carg ::= CONSTRAINT nm ccons */ yytestcase(yyruleno==55);
103368 /* (93) tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==93);
103883 testcase( i==38 ); /* CONSTRAINT */
105612 /* Any deferred constraint violations have now been resolved. */
105646 /* SQLITE_CONSTRAINT */ "constraint failed",
107043 int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */
109283 int iCons = -1; /* Index of constraint to use */
109304 /* A MATCH constraint. Use a full-text search.
109306 ** If there is more than one MATCH constraint available, use the first
109307 ** one encountered. If there is both a MATCH constraint and a direct
119352 ** A search constraint.
119357 double rValue; /* Constraint value. */
119359 sqlite3_rtree_geometry *pGeom; /* Constraint callback argument for a MATCH */
119939 int i; /* Used to iterate through constraint array */
119977 ** The r-tree constraint passed as the second argument to this function is
119978 ** guaranteed to be a MATCH constraint.
119982 RtreeConstraint *pConstraint, /* MATCH constraint to test */
120302 ** as the second argument for a MATCH constraint. The value passed as the
120449 ** constraint used. The first two bytes of idxStr correspond to
120450 ** the constraint in sqlite3_index_info.aConstraintUsage[] with
120453 ** The first of each pair of bytes in idxStr identifies the constraint
120467 ** to which the constraint applies. The leftmost coordinate column
120484 /* We have an equality constraint on the rowid. Use strategy 1. */
120520 /* Make sure this particular constraint has not been used before.
120527 ** A == is disqualifed if there is any prior constraint.
121890 goto constraint;
121899 goto constraint;
121913 goto constraint;
121933 constraint: