Query by the constraint name

@param constraintName
constraint name
@return data columns
@throws SQLException
upon failure
320926
public List<DataColumns> queryByConstraintName(String constraintName)
			throws SQLException {
		return queryForEq(DataColumns.COLUMN_CONSTRAINT_NAME, constraintName);
	}
66327
function Constraint(constraintName, constraintPayload) {
	var name = constraintName;
	var payload = constraintPayload;

	/**
	 * The constraint name.
	 * @returns {String} a name
	 */
	this.getName = function () {
		return name;
	};

	/**
	 * Sets the name of the constraint.
	 * @param {String} n name
	 */
	this.setName = function (n) {
		name = n;
	};

	/**
	 * The payload (a map)
	 * @returns {Object} an object
	 */
	this.getPayload = function () {
		return payload;
	};

	/**
	 * Sets the payload.
	 * @param {Object} p the payload object
	 */
	this.setPayload = function (p) {
		payload = p;
	};
}
166458
public int deleteByExtension(String extensionName) throws SQLException {

		DeleteBuilder<Extensions, Void> db = deleteBuilder();
		db.where().eq(Extensions.COLUMN_EXTENSION_NAME, extensionName);

		int deleted = db.delete();

		return deleted;
	}
778295
protected function getConstraints()
    {
        if (is_null($this->constrains)) {
            $this->constrains = DB::select(
                'SELECT
                    r.referenced_table_name AS `references`
                   ,r.CONSTRAINT_NAME AS `name`
                   ,r.UPDATE_RULE AS `onUpdate`
                   ,r.DELETE_RULE AS `onDelete`
                   ,u.referenced_column_name AS `on`
                   ,u.column_name AS `foreign`
                   ,CASE WHEN u.TABLE_NAME = r.referenced_table_name THEN 1 ELSE 0 END selfReferences
                   FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS AS r
                   INNER JOIN information_schema.key_column_usage AS u ON u.CONSTRAINT_NAME = r.CONSTRAINT_NAME
                                                                       AND u.table_schema = r.constraint_schema
                                                                       AND u.table_name = r.table_name
                   WHERE u.table_name = ? AND u.constraint_schema = ?;',
                [$this->tableName, $this->databaseName]
            );
        }

        return $this->constrains;
    }
891846
protected function getTableConstraints($tableName)
	{
		$this->connect();

		$this->setQuery(
			'SELECT CONSTRAINT_NAME FROM' . ' INFORMATION_SCHEMA.TABLE_CONSTRAINTS' . ' WHERE TABLE_NAME = ' . $this->quote($tableName)
		);

		return $this->loadColumn();
	}
416010
public boolean hasConstraint (String constraint)
    {
        return (_constraints == null) ? false :
            ListUtil.contains(_constraints, constraint);
    }
1368889
public FKeyModel getFkey(String fkeyName) {
		if (fkeyConstraints == null)
			return null;
		for (FKeyModel fkey : fkeyConstraints)
			if (!StrUtils.isEmpty(fkeyName) && fkeyName.equalsIgnoreCase(fkey.getFkeyName()))
				return fkey;
		return null;
	}
1136023
public function getTable($tableName)
    {
        $table = new Table($tableName);

        $columns = $this->_getColumns($tableName);
        foreach ($columns as $col) {
            $table->addColumn($this->_createColumn($col));
        }

        $constraints = $this->_getConstraints($tableName);
        foreach ($constraints as $constraint) {
            $object = $this->_createConstraint($constraint);
            if ($object) {
                $table->addConstraint($object);
            }
        }

        return $table;
    }
1090534
public function constraint($name, $value, $options = [])
    {
        $value += ['options' => []];
        $meta = isset($this->_constraints[$name]) ? $this->_constraints[$name] : null;
        if (!($template = isset($meta['template']) ? $meta['template'] : null)) {
            throw new SqlException("Invalid constraint template `'{$name}'`.");
        }

        $data = [];
        foreach ($value as $name => $value) {
            switch ($name) {
                case 'key':
                case 'index':
                    if (isset($meta[$name])) {
                        $data['index'] = $meta[$name];
                    }
                break;
                case 'to':
                    $data[$name] = $this->name($value);
                break;
                case 'on':
                    $data[$name] = "ON {$value}";
                break;
                case 'constraint':
                    $data[$name] = "CONSTRAINT " . $this->name($value);
                break;
                case 'expr':
                    $data[$name] = $this->conditions(is_array($value) ? $value : [$value], $options);
                break;
                case 'column':
                case 'primaryKey':
                case 'foreignKey':
                    $data[$name] = join(', ', array_map([$this, 'name'], (array) $value));
                    $data['name'] = $this->name(join('_', (array) $value));
                break;
            }
        }

        return trim(Text::insert($template, $data, ['clean' => ['method' => 'text']]));
    }
232565
public Map<String, Map<String, Map<String, Map<String, ?>>>> removeValidationConstraint(String type,
			String field, String constraintName) {
		if (StringUtils.isBlank(type) || StringUtils.isBlank(field) || StringUtils.isBlank(constraintName)) {
			return Collections.emptyMap();
		}
		return getEntity(invokeDelete(Utils.formatMessage("_constraints/{0}/{1}/{2}", type,
				field, constraintName), null), Map.class);
	}
1048875
protected function generateTableConstraints($constraintName, $constraints)
    {
        $annotations = array();
        foreach ($constraints as $name => $constraint) {
            $columns = array();
            foreach ($constraint['columns'] as $column) {
                $columns[] = '"' . $column . '"';
            }
            $annotations[] = '@' . $this->annotationsPrefix . $constraintName . '(name="' . $name . '", columns={' . implode(', ', $columns) . '})';
        }
        return implode(', ', $annotations);
    }
585761
public Constraint method(Object target, String methodName, String constraintType) {
        return new MethodInvokingConstraint(target, methodName, constraintType);
    }
462864
void checkColumnInCheckConstraint(int colIndex) {

        for (int i = 0, size = constraintList.length; i < size; i++) {
            Constraint c = constraintList[i];

            if (c.constType == Constraint.CHECK && !c.isNotNull()
                    && c.hasColumn(colIndex)) {
                HsqlName name = c.getName();

                throw Error.error(ErrorCode.X_42502,
                                  name.getSchemaQualifiedStatementName());
            }
        }
    }
61601
public function removeConstraint($fieldName, $constraintName)
    {
        if ($constraint = $this->getConstraint($fieldName, $constraintName)) {
            if ($this->form) {
                $constraint->removeParsley();
            }
            $class = get_class($constraint);
            unset($this->constraints[$fieldName][$class]);
            unset($constraint);
        }

        return $this;
    }
295981
private function GetConstraintRules($constraintName, ConstraintRule &$onUpdate = null, ConstraintRule &$onDelete = null)
    {
        $sql = new Sql\Builder($this);
        $tbl = $sql->Table('information_schema.REFERENTIAL_CONSTRAINTS', array('CONSTRAINT_NAME', 'UPDATE_RULE', 'DELETE_RULE'));
       
        $where = $sql->Equals($tbl->Field('CONSTRAINT_NAME'), $sql->Value($constraintName));
        $selectList = $sql->SelectList($tbl->Field('UPDATE_RULE'));
        $selectList->Add($tbl->Field('DELETE_RULE'));
        $select = $sql->Select(false, $selectList, $tbl, $where);
        $reader = $this->ExecuteQuery((string) $select);
        if ($reader->Read())
        {
            $onUpdate = ConstraintRule::ByValue($reader->ByName('UPDATE_RULE'));
            $onDelete = ConstraintRule::ByValue($reader->ByName('DELETE_RULE'));
        }
    }
951861
public DataColumnConstraints queryByUnique(String constraintName,
			DataColumnConstraintType constraintType, String value)
			throws SQLException {

		DataColumnConstraints constraint = null;

		QueryBuilder<DataColumnConstraints, Void> qb = queryBuilder();
		setUniqueWhere(qb.where(), constraintName, constraintType, value);
		List<DataColumnConstraints> constraints = qb.query();
		if (!constraints.isEmpty()) {

			if (constraints.size() > 1) {
				throw new GeoPackageException("More than one "
						+ DataColumnConstraints.class.getSimpleName()
						+ " was found for unique constraint. Name: "
						+ constraintName + ", Type: " + constraintType
						+ ", Value: " + value);
			}

			constraint = constraints.get(0);
		}

		return constraint;
	}
1289989
protected function _getConstraints($tableName)
    {

        $params = [
            ':schemaName' => $this->_adapter->getSchemaName(),
            ':tableName' => $tableName
        ];

        return $this->_adapter->query($this->_getConstraintsSql, $params);
    }