_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q241800 | ActiveDataFilter.buildAttributeCondition | validation | protected function buildAttributeCondition($attribute, $condition)
{
if (is_array($condition)) {
$parts = [];
foreach ($condition as $operator => $value) {
if (isset($this->operatorTypes[$operator])) {
if (isset($this->conditionBuilders[$operator])... | php | {
"resource": ""
} |
q241801 | ActiveDataFilter.buildOperatorCondition | validation | protected function buildOperatorCondition($operator, $condition, $attribute)
{
if (isset($this->queryOperatorMap[$operator])) {
$operator = $this->queryOperatorMap[$operator];
}
return [$operator, $attribute, $this->filterAttributeValue($attribute, $condition)];
} | php | {
"resource": ""
} |
q241802 | BaseYii.autoload | validation | public static function autoload($className)
{
if (isset(static::$classMap[$className])) {
$classFile = static::$classMap[$className];
if ($classFile[0] === '@') {
$classFile = static::getAlias($classFile);
}
} elseif (strpos($className, '\\') !== f... | php | {
"resource": ""
} |
q241803 | BaseYii.debug | validation | public static function debug($message, $category = 'application')
{
if (YII_DEBUG) {
static::getLogger()->log($message, Logger::LEVEL_TRACE, $category);
}
} | php | {
"resource": ""
} |
q241804 | BaseListView.renderSummary | validation | public function renderSummary()
{
$count = $this->dataProvider->getCount();
if ($count <= 0) {
return '';
}
$summaryOptions = $this->summaryOptions;
$tag = ArrayHelper::remove($summaryOptions, 'tag', 'div');
if (($pagination = $this->dataProvider->getPagin... | php | {
"resource": ""
} |
q241805 | BaseListView.renderSorter | validation | public function renderSorter()
{
$sort = $this->dataProvider->getSort();
if ($sort === false || empty($sort->attributes) || $this->dataProvider->getCount() <= 0) {
return '';
}
/* @var $class LinkSorter */
$sorter = $this->sorter;
$class = ArrayHelper::rem... | php | {
"resource": ""
} |
q241806 | Request.getScriptFile | validation | public function getScriptFile()
{
if ($this->_scriptFile === null) {
if (isset($_SERVER['SCRIPT_FILENAME'])) {
$this->setScriptFile($_SERVER['SCRIPT_FILENAME']);
} else {
throw new InvalidConfigException('Unable to determine the entry script file path.... | php | {
"resource": ""
} |
q241807 | Request.setScriptFile | validation | public function setScriptFile($value)
{
$scriptFile = realpath(Yii::getAlias($value));
if ($scriptFile !== false && is_file($scriptFile)) {
$this->_scriptFile = $scriptFile;
} else {
throw new InvalidConfigException('Unable to determine the entry script file path.');
... | php | {
"resource": ""
} |
q241808 | DateValidator.parseDateValueFormat | validation | private function parseDateValueFormat($value, $format)
{
if (is_array($value)) {
return false;
}
if (strncmp($format, 'php:', 4) === 0) {
$format = substr($format, 4);
} else {
if (extension_loaded('intl')) {
return $this->parseDate... | php | {
"resource": ""
} |
q241809 | DateValidator.formatTimestamp | validation | private function formatTimestamp($timestamp, $format)
{
if (strncmp($format, 'php:', 4) === 0) {
$format = substr($format, 4);
} else {
$format = FormatConverter::convertDateIcuToPhp($format, 'date');
}
$date = new DateTime();
$date->setTimestamp($tim... | php | {
"resource": ""
} |
q241810 | Security.encrypt | validation | protected function encrypt($data, $passwordBased, $secret, $info)
{
if (!extension_loaded('openssl')) {
throw new InvalidConfigException('Encryption requires the OpenSSL PHP extension');
}
if (!isset($this->allowedCiphers[$this->cipher][0], $this->allowedCiphers[$this->cipher][1]... | php | {
"resource": ""
} |
q241811 | Security.validateData | validation | public function validateData($data, $key, $rawHash = false)
{
$test = @hash_hmac($this->macHash, '', '', $rawHash);
if (!$test) {
throw new InvalidConfigException('Failed to generate HMAC with hash algorithm: ' . $this->macHash);
}
$hashLength = StringHelper::byteLength($... | php | {
"resource": ""
} |
q241812 | Security.generatePasswordHash | validation | public function generatePasswordHash($password, $cost = null)
{
if ($cost === null) {
$cost = $this->passwordHashCost;
}
if (function_exists('password_hash')) {
/* @noinspection PhpUndefinedConstantInspection */
return password_hash($password, PASSWORD_DE... | php | {
"resource": ""
} |
q241813 | Security.validatePassword | validation | public function validatePassword($password, $hash)
{
if (!is_string($password) || $password === '') {
throw new InvalidArgumentException('Password must be a string and cannot be empty.');
}
if (!preg_match('/^\$2[axy]\$(\d\d)\$[\.\/0-9A-Za-z]{22}/', $hash, $matches)
... | php | {
"resource": ""
} |
q241814 | Security.compareString | validation | public function compareString($expected, $actual)
{
if (!is_string($expected)) {
throw new InvalidArgumentException('Expected expected value to be a string, ' . gettype($expected) . ' given.');
}
if (!is_string($actual)) {
throw new InvalidArgumentException('Expected... | php | {
"resource": ""
} |
q241815 | Security.unmaskToken | validation | public function unmaskToken($maskedToken)
{
$decoded = StringHelper::base64UrlDecode($maskedToken);
$length = StringHelper::byteLength($decoded) / 2;
// Check if the masked token has an even length.
if (!is_int($length)) {
return '';
}
return StringHelper... | php | {
"resource": ""
} |
q241816 | BlameableBehavior.getDefaultValue | validation | protected function getDefaultValue($event)
{
if ($this->defaultValue instanceof \Closure || (is_array($this->defaultValue) && is_callable($this->defaultValue))) {
return call_user_func($this->defaultValue, $event);
}
return $this->defaultValue;
} | php | {
"resource": ""
} |
q241817 | OptionsAction.run | validation | public function run($id = null)
{
if (Yii::$app->getRequest()->getMethod() !== 'OPTIONS') {
Yii::$app->getResponse()->setStatusCode(405);
}
$options = $id === null ? $this->collectionOptions : $this->resourceOptions;
$headers = Yii::$app->getResponse()->getHeaders();
... | php | {
"resource": ""
} |
q241818 | BaseUrl.normalizeRoute | validation | protected static function normalizeRoute($route)
{
$route = Yii::getAlias((string) $route);
if (strncmp($route, '/', 1) === 0) {
// absolute route
return ltrim($route, '/');
}
// relative route
if (Yii::$app->controller === null) {
throw n... | php | {
"resource": ""
} |
q241819 | BaseUrl.to | validation | public static function to($url = '', $scheme = false)
{
if (is_array($url)) {
return static::toRoute($url, $scheme);
}
$url = Yii::getAlias($url);
if ($url === '') {
$url = Yii::$app->getRequest()->getUrl();
}
if ($scheme === false) {
... | php | {
"resource": ""
} |
q241820 | BaseUrl.ensureScheme | validation | public static function ensureScheme($url, $scheme)
{
if (static::isRelative($url) || !is_string($scheme)) {
return $url;
}
if (substr($url, 0, 2) === '//') {
// e.g. //example.com/path/to/resource
return $scheme === '' ? $url : "$scheme:$url";
}
... | php | {
"resource": ""
} |
q241821 | BaseUrl.current | validation | public static function current(array $params = [], $scheme = false)
{
$currentParams = Yii::$app->getRequest()->getQueryParams();
$currentParams[0] = '/' . Yii::$app->controller->getRoute();
$route = array_replace_recursive($currentParams, $params);
return static::toRoute($route, $sc... | php | {
"resource": ""
} |
q241822 | AssetController.getAssetManager | validation | public function getAssetManager()
{
if (!is_object($this->_assetManager)) {
$options = $this->_assetManager;
if (!isset($options['class'])) {
$options['class'] = 'yii\\web\\AssetManager';
}
if (!isset($options['basePath'])) {
th... | php | {
"resource": ""
} |
q241823 | AssetController.setAssetManager | validation | public function setAssetManager($assetManager)
{
if (is_scalar($assetManager)) {
throw new Exception('"' . get_class($this) . '::assetManager" should be either object or array - "' . gettype($assetManager) . '" given.');
}
$this->_assetManager = $assetManager;
} | php | {
"resource": ""
} |
q241824 | AssetController.actionCompress | validation | public function actionCompress($configFile, $bundleFile)
{
$this->loadConfiguration($configFile);
$bundles = $this->loadBundles($this->bundles);
$targets = $this->loadTargets($this->targets, $bundles);
foreach ($targets as $name => $target) {
$this->stdout("Creating outpu... | php | {
"resource": ""
} |
q241825 | AssetController.loadConfiguration | validation | protected function loadConfiguration($configFile)
{
$this->stdout("Loading configuration from '{$configFile}'...\n");
$config = require $configFile;
foreach ($config as $name => $value) {
if (property_exists($this, $name) || $this->canSetProperty($name)) {
$this->... | php | {
"resource": ""
} |
q241826 | AssetController.loadBundles | validation | protected function loadBundles($bundles)
{
$this->stdout("Collecting source bundles information...\n");
$am = $this->getAssetManager();
$result = [];
foreach ($bundles as $name) {
$result[$name] = $am->getBundle($name);
}
foreach ($result as $bundle) {
... | php | {
"resource": ""
} |
q241827 | AssetController.loadDependency | validation | protected function loadDependency($bundle, &$result)
{
$am = $this->getAssetManager();
foreach ($bundle->depends as $name) {
if (!isset($result[$name])) {
$dependencyBundle = $am->getBundle($name);
$result[$name] = false;
$this->loadDepende... | php | {
"resource": ""
} |
q241828 | AssetController.buildTarget | validation | protected function buildTarget($target, $type, $bundles)
{
$inputFiles = [];
foreach ($target->depends as $name) {
if (isset($bundles[$name])) {
if (!$this->isBundleExternal($bundles[$name])) {
foreach ($bundles[$name]->$type as $file) {
... | php | {
"resource": ""
} |
q241829 | AssetController.adjustDependency | validation | protected function adjustDependency($targets, $bundles)
{
$this->stdout("Creating new bundle configuration...\n");
$map = [];
foreach ($targets as $name => $target) {
foreach ($target->depends as $bundle) {
$map[$bundle] = $name;
}
}
... | php | {
"resource": ""
} |
q241830 | AssetController.registerBundle | validation | protected function registerBundle($bundles, $name, &$registered)
{
if (!isset($registered[$name])) {
$registered[$name] = false;
$bundle = $bundles[$name];
foreach ($bundle->depends as $depend) {
$this->registerBundle($bundles, $depend, $registered);
... | php | {
"resource": ""
} |
q241831 | AssetController.compressJsFiles | validation | protected function compressJsFiles($inputFiles, $outputFile)
{
if (empty($inputFiles)) {
return;
}
$this->stdout(" Compressing JavaScript files...\n");
if (is_string($this->jsCompressor)) {
$tmpFile = $outputFile . '.tmp';
$this->combineJsFiles($i... | php | {
"resource": ""
} |
q241832 | AssetController.compressCssFiles | validation | protected function compressCssFiles($inputFiles, $outputFile)
{
if (empty($inputFiles)) {
return;
}
$this->stdout(" Compressing CSS files...\n");
if (is_string($this->cssCompressor)) {
$tmpFile = $outputFile . '.tmp';
$this->combineCssFiles($input... | php | {
"resource": ""
} |
q241833 | AssetController.combineJsFiles | validation | public function combineJsFiles($inputFiles, $outputFile)
{
$content = '';
foreach ($inputFiles as $file) {
// Add a semicolon to source code if trailing semicolon missing.
// Notice: It needs a new line before `;` to avoid affection of line comment. (// ...;)
$fil... | php | {
"resource": ""
} |
q241834 | AssetController.combineCssFiles | validation | public function combineCssFiles($inputFiles, $outputFile)
{
$content = '';
$outputFilePath = dirname($this->findRealPath($outputFile));
foreach ($inputFiles as $file) {
$content .= "/*** BEGIN FILE: $file ***/\n"
. $this->adjustCssUrl(file_get_contents($file), dir... | php | {
"resource": ""
} |
q241835 | AssetController.composeCircularDependencyTrace | validation | private function composeCircularDependencyTrace($circularDependencyName, array $registered)
{
$dependencyTrace = [];
$startFound = false;
foreach ($registered as $name => $value) {
if ($name === $circularDependencyName) {
$startFound = true;
}
... | php | {
"resource": ""
} |
q241836 | AssetController.deletePublishedAssets | validation | private function deletePublishedAssets($bundles)
{
$this->stdout("Deleting source files...\n");
if ($this->getAssetManager()->linkAssets) {
$this->stdout("`AssetManager::linkAssets` option is enabled. Deleting of source files canceled.\n", Console::FG_YELLOW);
return;
... | php | {
"resource": ""
} |
q241837 | Utf8Controller.actionCheckGuide | validation | public function actionCheckGuide($directory = null)
{
if ($directory === null) {
$directory = \dirname(\dirname(__DIR__)) . '/docs';
}
if (is_file($directory)) {
$files = [$directory];
} else {
$files = FileHelper::findFiles($directory, [
... | php | {
"resource": ""
} |
q241838 | ActiveQuery.one | validation | public function one($db = null)
{
$row = parent::one($db);
if ($row !== false) {
$models = $this->populate([$row]);
return reset($models) ?: null;
}
return null;
} | php | {
"resource": ""
} |
q241839 | ActiveQuery.joinWith | validation | public function joinWith($with, $eagerLoading = true, $joinType = 'LEFT JOIN')
{
$relations = [];
foreach ((array) $with as $name => $callback) {
if (is_int($name)) {
$name = $callback;
$callback = null;
}
if (preg_match('/^(.*?)(?... | php | {
"resource": ""
} |
q241840 | ActiveQuery.joinWithRelation | validation | private function joinWithRelation($parent, $child, $joinType)
{
$via = $child->via;
$child->via = null;
if ($via instanceof self) {
// via table
$this->joinWithRelation($parent, $via, $joinType);
$this->joinWithRelation($via, $child, $joinType);
... | php | {
"resource": ""
} |
q241841 | ActiveQuery.andOnCondition | validation | public function andOnCondition($condition, $params = [])
{
if ($this->on === null) {
$this->on = $condition;
} else {
$this->on = ['and', $this->on, $condition];
}
$this->addParams($params);
return $this;
} | php | {
"resource": ""
} |
q241842 | ActiveQuery.orOnCondition | validation | public function orOnCondition($condition, $params = [])
{
if ($this->on === null) {
$this->on = $condition;
} else {
$this->on = ['or', $this->on, $condition];
}
$this->addParams($params);
return $this;
} | php | {
"resource": ""
} |
q241843 | SqlTokenizer.tokenize | validation | public function tokenize()
{
$this->length = mb_strlen($this->sql, 'UTF-8');
$this->offset = 0;
$this->_substrings = [];
$this->_buffer = '';
$this->_token = new SqlToken([
'type' => SqlToken::TYPE_CODE,
'content' => $this->sql,
]);
$th... | php | {
"resource": ""
} |
q241844 | SqlTokenizer.startsWithAnyLongest | validation | protected function startsWithAnyLongest(array &$with, $caseSensitive, &$length = null, &$content = null)
{
if (empty($with)) {
return false;
}
if (!is_array(reset($with))) {
usort($with, function ($string1, $string2) {
return mb_strlen($string2, 'UTF-... | php | {
"resource": ""
} |
q241845 | SqlTokenizer.substring | validation | protected function substring($length, $caseSensitive = true, $offset = null)
{
if ($offset === null) {
$offset = $this->offset;
}
if ($offset + $length > $this->length) {
return '';
}
$cacheKey = $offset . ',' . $length;
if (!isset($this->_sub... | php | {
"resource": ""
} |
q241846 | SqlTokenizer.indexAfter | validation | protected function indexAfter($string, $offset = null)
{
if ($offset === null) {
$offset = $this->offset;
}
if ($offset + mb_strlen($string, 'UTF-8') > $this->length) {
return $this->length;
}
$afterIndexOf = mb_strpos($this->sql, $string, $offset, 'U... | php | {
"resource": ""
} |
q241847 | SqlTokenizer.tokenizeDelimitedString | validation | private function tokenizeDelimitedString(&$length)
{
$isIdentifier = $this->isIdentifier($length, $content);
$isStringLiteral = !$isIdentifier && $this->isStringLiteral($length, $content);
if (!$isIdentifier && !$isStringLiteral) {
return false;
}
$this->addToken... | php | {
"resource": ""
} |
q241848 | SqlTokenizer.tokenizeOperator | validation | private function tokenizeOperator(&$length)
{
if (!$this->isOperator($length, $content)) {
return false;
}
$this->addTokenFromBuffer();
switch ($this->substring($length)) {
case '(':
$this->_currentToken[] = new SqlToken([
... | php | {
"resource": ""
} |
q241849 | SqlTokenizer.addTokenFromBuffer | validation | private function addTokenFromBuffer()
{
if ($this->_buffer === '') {
return;
}
$isKeyword = $this->isKeyword($this->_buffer, $content);
$this->_currentToken[] = new SqlToken([
'type' => $isKeyword ? SqlToken::TYPE_KEYWORD : SqlToken::TYPE_TOKEN,
'... | php | {
"resource": ""
} |
q241850 | AssetConverter.convert | validation | public function convert($asset, $basePath)
{
$pos = strrpos($asset, '.');
if ($pos !== false) {
$ext = substr($asset, $pos + 1);
if (isset($this->commands[$ext])) {
list($ext, $command) = $this->commands[$ext];
$result = substr($asset, 0, $pos ... | php | {
"resource": ""
} |
q241851 | Container.get | validation | public function get($class, $params = [], $config = [])
{
if (isset($this->_singletons[$class])) {
// singleton
return $this->_singletons[$class];
} elseif (!isset($this->_definitions[$class])) {
return $this->build($class, $params, $config);
}
$d... | php | {
"resource": ""
} |
q241852 | Container.set | validation | public function set($class, $definition = [], array $params = [])
{
$this->_definitions[$class] = $this->normalizeDefinition($class, $definition);
$this->_params[$class] = $params;
unset($this->_singletons[$class]);
return $this;
} | php | {
"resource": ""
} |
q241853 | Container.setSingleton | validation | public function setSingleton($class, $definition = [], array $params = [])
{
$this->_definitions[$class] = $this->normalizeDefinition($class, $definition);
$this->_params[$class] = $params;
$this->_singletons[$class] = null;
return $this;
} | php | {
"resource": ""
} |
q241854 | Container.build | validation | protected function build($class, $params, $config)
{
/* @var $reflection ReflectionClass */
list($reflection, $dependencies) = $this->getDependencies($class);
foreach ($params as $index => $param) {
$dependencies[$index] = $param;
}
$dependencies = $this->resolv... | php | {
"resource": ""
} |
q241855 | Container.getDependencies | validation | protected function getDependencies($class)
{
if (isset($this->_reflections[$class])) {
return [$this->_reflections[$class], $this->_dependencies[$class]];
}
$dependencies = [];
try {
$reflection = new ReflectionClass($class);
} catch (\ReflectionExcep... | php | {
"resource": ""
} |
q241856 | Container.resolveDependencies | validation | protected function resolveDependencies($dependencies, $reflection = null)
{
foreach ($dependencies as $index => $dependency) {
if ($dependency instanceof Instance) {
if ($dependency->id !== null) {
$dependencies[$index] = $this->get($dependency->id);
... | php | {
"resource": ""
} |
q241857 | Container.setDefinitions | validation | public function setDefinitions(array $definitions)
{
foreach ($definitions as $class => $definition) {
if (is_array($definition) && count($definition) === 2 && array_values($definition) === $definition) {
$this->set($class, $definition[0], $definition[1]);
continu... | php | {
"resource": ""
} |
q241858 | ArrayParser.parseArray | validation | private function parseArray($value, &$i = 0)
{
$result = [];
$len = strlen($value);
for (++$i; $i < $len; ++$i) {
switch ($value[$i]) {
case '{':
$result[] = $this->parseArray($value, $i);
break;
case '}':
... | php | {
"resource": ""
} |
q241859 | ArrayParser.parseString | validation | private function parseString($value, &$i)
{
$isQuoted = $value[$i] === '"';
$stringEndChars = $isQuoted ? ['"'] : [$this->delimiter, '}'];
$result = '';
$len = strlen($value);
for ($i += $isQuoted ? 1 : 0; $i < $len; ++$i) {
if (in_array($value[$i], ['\\', '"'], t... | php | {
"resource": ""
} |
q241860 | DynamicModel.validateData | validation | public static function validateData(array $data, $rules = [])
{
/* @var $model DynamicModel */
$model = new static($data);
if (!empty($rules)) {
$validators = $model->getValidators();
foreach ($rules as $rule) {
if ($rule instanceof Validator) {
... | php | {
"resource": ""
} |
q241861 | DbQueryDependency.generateDependencyData | validation | protected function generateDependencyData($cache)
{
$db = $this->db;
if ($db !== null) {
$db = Instance::ensure($db);
}
if (!$this->query instanceof QueryInterface) {
throw new InvalidConfigException('"' . get_class($this) . '::$query" should be an instance o... | php | {
"resource": ""
} |
q241862 | InConditionBuilder.splitCondition | validation | protected function splitCondition(InCondition $condition, &$params)
{
$operator = $condition->getOperator();
$values = $condition->getValues();
$column = $condition->getColumn();
if ($values instanceof \Traversable) {
$values = iterator_to_array($values);
}
... | php | {
"resource": ""
} |
q241863 | ActiveQueryTrait.with | validation | public function with()
{
$with = func_get_args();
if (isset($with[0]) && is_array($with[0])) {
// the parameter is given as an array
$with = $with[0];
}
if (empty($this->with)) {
$this->with = $with;
} elseif (!empty($with)) {
... | php | {
"resource": ""
} |
q241864 | ActiveQueryTrait.createModels | validation | protected function createModels($rows)
{
if ($this->asArray) {
return $rows;
} else {
$models = [];
/* @var $class ActiveRecord */
$class = $this->modelClass;
foreach ($rows as $row) {
$model = $class::instantiate($row);
... | php | {
"resource": ""
} |
q241865 | ActiveQueryTrait.findWith | validation | public function findWith($with, &$models)
{
$primaryModel = reset($models);
if (!$primaryModel instanceof ActiveRecordInterface) {
/* @var $modelClass ActiveRecordInterface */
$modelClass = $this->modelClass;
$primaryModel = $modelClass::instance();
}
... | php | {
"resource": ""
} |
q241866 | ErrorHandler.handleHhvmError | validation | public function handleHhvmError($code, $message, $file, $line, $context, $backtrace)
{
if ($this->handleError($code, $message, $file, $line)) {
return true;
}
if (E_ERROR & $code) {
$exception = new ErrorException($message, $code, $code, $file, $line);
$re... | php | {
"resource": ""
} |
q241867 | Command.cache | validation | public function cache($duration = null, $dependency = null)
{
$this->queryCacheDuration = $duration === null ? $this->db->queryCacheDuration : $duration;
$this->queryCacheDependency = $dependency;
return $this;
} | php | {
"resource": ""
} |
q241868 | Command.bindParam | validation | public function bindParam($name, &$value, $dataType = null, $length = null, $driverOptions = null)
{
$this->prepare();
if ($dataType === null) {
$dataType = $this->db->getSchema()->getPdoType($value);
}
if ($length === null) {
$this->pdoStatement->bindParam($... | php | {
"resource": ""
} |
q241869 | Command.bindValue | validation | public function bindValue($name, $value, $dataType = null)
{
if ($dataType === null) {
$dataType = $this->db->getSchema()->getPdoType($value);
}
$this->_pendingParams[$name] = [$value, $dataType];
$this->params[$name] = $value;
return $this;
} | php | {
"resource": ""
} |
q241870 | Command.queryScalar | validation | public function queryScalar()
{
$result = $this->queryInternal('fetchColumn', 0);
if (is_resource($result) && get_resource_type($result) === 'stream') {
return stream_get_contents($result);
}
return $result;
} | php | {
"resource": ""
} |
q241871 | Command.insert | validation | public function insert($table, $columns)
{
$params = [];
$sql = $this->db->getQueryBuilder()->insert($table, $columns, $params);
return $this->setSql($sql)->bindValues($params);
} | php | {
"resource": ""
} |
q241872 | Command.batchInsert | validation | public function batchInsert($table, $columns, $rows)
{
$table = $this->db->quoteSql($table);
$columns = array_map(function ($column) {
return $this->db->quoteSql($column);
}, $columns);
$params = [];
$sql = $this->db->getQueryBuilder()->batchInsert($table, $colum... | php | {
"resource": ""
} |
q241873 | Command.update | validation | public function update($table, $columns, $condition = '', $params = [])
{
$sql = $this->db->getQueryBuilder()->update($table, $columns, $condition, $params);
return $this->setSql($sql)->bindValues($params);
} | php | {
"resource": ""
} |
q241874 | Command.delete | validation | public function delete($table, $condition = '', $params = [])
{
$sql = $this->db->getQueryBuilder()->delete($table, $condition, $params);
return $this->setSql($sql)->bindValues($params);
} | php | {
"resource": ""
} |
q241875 | Command.createTable | validation | public function createTable($table, $columns, $options = null)
{
$sql = $this->db->getQueryBuilder()->createTable($table, $columns, $options);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241876 | Command.renameTable | validation | public function renameTable($table, $newName)
{
$sql = $this->db->getQueryBuilder()->renameTable($table, $newName);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241877 | Command.dropTable | validation | public function dropTable($table)
{
$sql = $this->db->getQueryBuilder()->dropTable($table);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241878 | Command.truncateTable | validation | public function truncateTable($table)
{
$sql = $this->db->getQueryBuilder()->truncateTable($table);
return $this->setSql($sql);
} | php | {
"resource": ""
} |
q241879 | Command.addColumn | validation | public function addColumn($table, $column, $type)
{
$sql = $this->db->getQueryBuilder()->addColumn($table, $column, $type);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241880 | Command.renameColumn | validation | public function renameColumn($table, $oldName, $newName)
{
$sql = $this->db->getQueryBuilder()->renameColumn($table, $oldName, $newName);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241881 | Command.dropPrimaryKey | validation | public function dropPrimaryKey($name, $table)
{
$sql = $this->db->getQueryBuilder()->dropPrimaryKey($name, $table);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241882 | Command.addForeignKey | validation | public function addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete = null, $update = null)
{
$sql = $this->db->getQueryBuilder()->addForeignKey($name, $table, $columns, $refTable, $refColumns, $delete, $update);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
... | php | {
"resource": ""
} |
q241883 | Command.createIndex | validation | public function createIndex($name, $table, $columns, $unique = false)
{
$sql = $this->db->getQueryBuilder()->createIndex($name, $table, $columns, $unique);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241884 | Command.addUnique | validation | public function addUnique($name, $table, $columns)
{
$sql = $this->db->getQueryBuilder()->addUnique($name, $table, $columns);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241885 | Command.addDefaultValue | validation | public function addDefaultValue($name, $table, $column, $value)
{
$sql = $this->db->getQueryBuilder()->addDefaultValue($name, $table, $column, $value);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241886 | Command.resetSequence | validation | public function resetSequence($table, $value = null)
{
$sql = $this->db->getQueryBuilder()->resetSequence($table, $value);
return $this->setSql($sql);
} | php | {
"resource": ""
} |
q241887 | Command.checkIntegrity | validation | public function checkIntegrity($check = true, $schema = '', $table = '')
{
$sql = $this->db->getQueryBuilder()->checkIntegrity($check, $schema, $table);
return $this->setSql($sql);
} | php | {
"resource": ""
} |
q241888 | Command.addCommentOnColumn | validation | public function addCommentOnColumn($table, $column, $comment)
{
$sql = $this->db->getQueryBuilder()->addCommentOnColumn($table, $column, $comment);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241889 | Command.addCommentOnTable | validation | public function addCommentOnTable($table, $comment)
{
$sql = $this->db->getQueryBuilder()->addCommentOnTable($table, $comment);
return $this->setSql($sql);
} | php | {
"resource": ""
} |
q241890 | Command.dropCommentFromColumn | validation | public function dropCommentFromColumn($table, $column)
{
$sql = $this->db->getQueryBuilder()->dropCommentFromColumn($table, $column);
return $this->setSql($sql)->requireTableSchemaRefresh($table);
} | php | {
"resource": ""
} |
q241891 | Command.dropCommentFromTable | validation | public function dropCommentFromTable($table)
{
$sql = $this->db->getQueryBuilder()->dropCommentFromTable($table);
return $this->setSql($sql);
} | php | {
"resource": ""
} |
q241892 | Command.dropView | validation | public function dropView($viewName)
{
$sql = $this->db->getQueryBuilder()->dropView($viewName);
return $this->setSql($sql)->requireTableSchemaRefresh($viewName);
} | php | {
"resource": ""
} |
q241893 | Command.execute | validation | public function execute()
{
$sql = $this->getSql();
list($profile, $rawSql) = $this->logQuery(__METHOD__);
if ($sql == '') {
return 0;
}
$this->prepare(false);
try {
$profile and Yii::beginProfile($rawSql, __METHOD__);
$this->in... | php | {
"resource": ""
} |
q241894 | Command.getCacheKey | validation | protected function getCacheKey($method, $fetchMode, $rawSql)
{
return [
__CLASS__,
$method,
$fetchMode,
$this->db->dsn,
$this->db->username,
$rawSql,
];
} | php | {
"resource": ""
} |
q241895 | Command.internalExecute | validation | protected function internalExecute($rawSql)
{
$attempt = 0;
while (true) {
try {
if (
++$attempt === 1
&& $this->_isolationLevel !== false
&& $this->db->getTransaction() === null
) {
... | php | {
"resource": ""
} |
q241896 | Command.reset | validation | protected function reset()
{
$this->_sql = null;
$this->_pendingParams = [];
$this->params = [];
$this->_refreshTableName = null;
$this->_isolationLevel = false;
$this->_retryHandler = null;
} | php | {
"resource": ""
} |
q241897 | Mutex.init | validation | public function init()
{
if ($this->autoRelease) {
$locks = &$this->_locks;
register_shutdown_function(function () use (&$locks) {
foreach ($locks as $lock) {
$this->release($lock);
}
});
}
} | php | {
"resource": ""
} |
q241898 | Mutex.release | validation | public function release($name)
{
if ($this->releaseLock($name)) {
$index = array_search($name, $this->_locks);
if ($index !== false) {
unset($this->_locks[$index]);
}
return true;
}
return false;
} | php | {
"resource": ""
} |
q241899 | Connection.cache | validation | public function cache(callable $callable, $duration = null, $dependency = null)
{
$this->_queryCacheInfo[] = [$duration === null ? $this->queryCacheDuration : $duration, $dependency];
try {
$result = call_user_func($callable, $this);
array_pop($this->_queryCacheInfo);
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.