Enables or disables database integrity check.
This method may be used to temporarily turn off foreign constraints check.
@param boolean $check whether to enable database integrity check
972773
public function checkIntegrity($check)
  {
    $db=$this->getDbConnection();
    foreach($this->schemas as $schema){
      $db->createCommand()->checkIntegrity($check,$schema)->execute();
    }
  }
337540
public function store($check=true)
	{
		// Validate data?
		if ($check)
		{
			// Is data valid?
			if (!$this->check())
			{
				return false;
			}

			if ($this->_context)
			{
				$results = \Event::trigger('content.onContentBeforeSave', array(
					$this->_context,
					&$this,
					$this->exists()
				));
				foreach ($results as $result)
				{
					if ($result === false)
					{
						$this->setError(\App::get('language')->txt('Content failed validation.'));
						return false;
					}
				}
			}
		}

		// Attempt to store data
		if (!$this->_tbl->store())
		{
			$this->setError($this->_tbl->getError());
			return false;
		}

		return true;
	}
102496
public Checkbox setChecked(boolean checked) {
        if (checked) {
            String valueEnabledString = this.getEnabledValueString();
            this.setValue(valueEnabledString);
        } else {
            this.setValue("");
        }

        return this;
    }
522706
public function pauseCheck($check_id) {
    $this->ensureParameters(array('check_id' => $check_id), __METHOD__);
    $check = array(
      'paused' => TRUE,
    );
    return $this->modifyCheck($check_id, $check);
  }
1216445
protected function after() {
		if($this->connection->getDatabasePlatform() instanceof SQLServerPlatform) {
			$this->connection->executeUpdate('exec sp_msforeachtable "ALTER TABLE ? WITH CHECK CHECK CONSTRAINT all"');
		} else if($this->connection->getDatabasePlatform() instanceof MySqlPlatform) {
			$this->connection->executeUpdate('SET FOREIGN_KEY_CHECKS=1');
		} else if($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
			$this->connection->executeUpdate('PRAGMA foreign_keys = ON');
		}
	}
433
final public function dropTables(array $tables, $fkChecks = false)
    {
        // Whether FK checks are enabled
        if ($fkChecks == false) {
            $this->db->raw('SET FOREIGN_KEY_CHECKS=0')
                     ->execute();
        }

        foreach ($tables as $table) {
            if (!$this->dropTable($table)) {
                return false;
            }
        }

        // Whether FK checks are enabled
        if ($fkChecks == false) {
            $this->db->raw('SET FOREIGN_KEY_CHECKS=1')
                     ->execute();
        }

        return true;
    }
417798
public function setChecked(bool $checked)
	{
		$this->value = $checked ? $this->getCheckedValue() : $this->getUncheckedValue();
		return $this;
	}
164281
private function makeCheckCallback( $check )
    {
        // callable
        if( is_callable($check) ) {
            $this->check = $check;
            $this->type = $this->makeCallbackHumanReadable( $check );
            return;
        }

        // class or obj
        if( is_object($check) ) {
            $class = get_class( $check );
        } elseif( is_string($check) ) {
            $class = (string) $check;
        } else {
            throw new BadTypeException( $check, "Class|Object|Callable");
        }
        $this->type = $class;
        $this->check = function( $newMember ) use ( $class ) {
            return is_a( $newMember, $class );
        };
    }
987531
protected function beginTransaction($autoCommit = false): void
    {
        if (!$autoCommit && null !== $this->connection) {
            $this->connection->beginTransaction();
        }
    }
1230827
public void setChecked(boolean checked) {
        setChecked(checked ? CheckableDrawable.CheckedState.CHECKED : CheckableDrawable.CheckedState.UNCHECKED);
    }
466173
public function checkCss($check = null): bool
    {
        // Css (could be array) and objects css property set?
        if (isset($check) && $this->css) {

            // convert non array css to array
            if (!is_array($check)) {
                $check = (array) $check;
            }

            // Is css to check already in objects css array?
            $check = array_intersect($check, $this->css) ? true : false;
        }
        else {
            // Without set css param we only check if css is used
            $check = $this->css ? true : false;
        }

        return $check;
    }
860160
protected function drop($tables, bool $ignoreKeyConstraints = false) : void
    {
        if ($ignoreKeyConstraints) {
            $this->database->statement('SET FOREIGN_KEY_CHECKS=0;');
        }

        if (! is_array($tables)) {
            $tables = [$tables];
        }

        foreach ($tables as $table) {
            if ($this->tableExists($table)) {
                $this->schema->drop($table);
            }
        }

        if ($ignoreKeyConstraints) {
            $this->database->statement('SET FOREIGN_KEY_CHECKS=1;');
        }
    }
221901
private function _isActive($check) {
		// Check if the check is configured
		$test = $this->_config->getTest($check);
		$active = !empty($test);

		$active = $active && !(in_array($check, $this->_functionSuppressWarnings) || in_array($check, $this->_classSuppressWarnings) || in_array($check, $this->_interfaceSuppressWarnings) || in_array($check, $this->_fileSuppressWarnings));

		return $active;
	}
753725
protected function truncate($table)
    {
        if ($this->db->connection()->getConfig('driver') === 'mysql') {
            $this->db->statement('SET FOREIGN_KEY_CHECKS=0;');
            $this->db->table($table)->truncate();
            $this->db->statement('SET FOREIGN_KEY_CHECKS=1;');
        }
    }
1151824
public function disableViewCheck(bool $disable = true)
    {
        if ($disable) {
            array_delete($this->checkboxes, 'view');
        } elseif (!in_array('view', $this->checkboxes)) {
            array_push($this->checkboxes, 'view');
        }

        return $this;
    }
494378
public function disable()
    {
        $updatedCheck = $this->ohDear->disableCheck($this->id);

        $this->enabled = $updatedCheck->enabled;
    }
1223850
public function getUser($check = true)
    {
        if ($check === true && $this->user === null) {
            $this->check();
        }

        return $this->user;
    }