本文整理汇总了PHP中rex_sql::setValues方法的典型用法代码示例。如果您正苦于以下问题:PHP rex_sql::setValues方法的具体用法?PHP rex_sql::setValues怎么用?PHP rex_sql::setValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex_sql
的用法示例。
在下文中一共展示了rex_sql::setValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: asd_news_addClang
function asd_news_addClang($params)
{
global $REX;
$id = $params['id'];
$name = $params['name'];
$now = new DateTime();
$error = false;
$sql = new rex_sql();
$sql->setQuery('SELECT * FROM `' . rex_asd_news_config::getTable() . '` WHERE `clang` = ' . $REX['START_CLANG_ID']);
for ($i = 1; $i <= $sql->getRows(); $i++) {
$save = new rex_sql();
$save->setTable(rex_asd_news_config::getTable());
$save->setValues($sql->getRow());
$save->setValue('clang', $id);
$save->setValue('createdAt', $now->format('Y-m-d H:i:s'));
$save->setValue('updatedAt', $now->format('Y-m-d H:i:s'));
$save->setValue('publishedAt', '0000-00-00 00:00:00');
$save->setValue('createdBy', $REX['USER']->getValue('user_id'));
$save->setValue('updatedBy', $REX['USER']->getValue('user_id'));
$save->setValue('publishedBy', 0);
$save->setValue('status', 0);
unset($save->values['news_id']);
if (!$save->insert()) {
$error = $save->getError();
}
}
if ($error) {
echo rex_warning('ASD News: Neuigkeiten in der Sprache "' . $name . '" konnten nicht angelegt werden<br />' . $error);
} else {
echo rex_info('ASD News: Neuigkeiten in der Sprache "' . $name . '" wurden angelegt');
}
}
示例2: cacheSearch
/**
* Stores a search result in the cache.
*
* @param string $_result
* @param array $_indexIds
*
* @return bool
*/
function cacheSearch($_result, $_indexIds)
{
$sql = new rex_sql();
$sql->setTable($this->tablePrefix . '587_searchcache');
$sql->setValues(array('hash' => $this->cacheHash($this->searchString), 'returnarray' => $sql->escape($_result)));
$sql->insert();
$lastId = $sql->getLastId();
$Ainsert = array();
foreach ($_indexIds as $id) {
$Ainsert[] = sprintf('(%d,%d)', $id, $lastId);
}
$sql2 = new rex_sql();
return $sql2->setQuery(sprintf('INSERT INTO `%s` (index_id,cache_id) VALUES
%s;', $this->tablePrefix . '587_searchcacheindex_ids', implode(',', $Ainsert)));
}
示例3: copyLanguageData
/**
* @param $from
* @param $to
* @return bool
*/
public static function copyLanguageData($from, $to)
{
global $REX;
$sql = new rex_sql();
$sql->setQuery('SELECT * FROM `' . $REX['TABLE_PREFIX'] . 'global_settings` WHERE `clang` = ' . (int) $from);
for ($i = 1; $i <= $sql->getRows(); $i++) {
$save = new rex_sql();
$save->setTable($REX['TABLE_PREFIX'] . 'global_settings');
$save->setValues($sql->getRow());
$save->setValue('clang', $to);
return $save->insert();
}
return false;
}
示例4: saveOverLangValues
/**
* @param rex_news_form $form
* @param $id
* @param $clang
*/
public static function saveOverLangValues(rex_news_form $form, $id, $clang)
{
global $REX;
$lang = new rex_sql();
$lang->setQuery('SELECT `id` FROM `' . $REX['TABLE_PREFIX'] . 'clang` WHERE `id` != ' . $clang);
for ($i = 1; $i <= $lang->getRows(); $i++) {
$sql = new rex_sql();
$sql->setTable($form->getTableName());
$sql->setDebug(true);
$sql->setWhere('`id` = ' . $id . ' AND `clang` = ' . $lang->getValue('id'));
$sql->select('id');
$sql->setTable($form->getTableName());
$sql->setDebug(true);
$sql->setWhere('`id` = ' . $id . ' AND `clang` = ' . $lang->getValue('id'));
if (OOAddon::isAvailable('metainfo')) {
$sql->setValues($form->getMetaValues());
}
if ($sql->getRows()) {
$sql->setValues(array_intersect_key($form->getValues(), array_flip($form->getOverSavedFields())));
$sql->setValue('clang', $lang->getValue('id'));
$sql->setValue('id', $id);
$sql->update();
} else {
$sql->setValues($form->getValues());
$sql->setValue('clang', $lang->getValue('id'));
$sql->setValue('id', $id);
$sql->insert();
}
$lang->next();
}
}