本文整理汇总了PHP中Tygh\Registry::setChangedTables方法的典型用法代码示例。如果您正苦于以下问题:PHP Registry::setChangedTables方法的具体用法?PHP Registry::setChangedTables怎么用?PHP Registry::setChangedTables使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tygh\Registry
的用法示例。
在下文中一共展示了Registry::setChangedTables方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
/**
* Execute query
*
* @param string $query unparsed query
* @param mixed ... unlimited number of variables for placeholders
* @return mixed result set for "SELECT" statement / generated ID for an AUTO_INCREMENT field for insert statement / Affected rows count for DELETE/UPDATE statements
*/
public static function query($query)
{
if (!self::$raw) {
fn_set_hook('db_query', $query);
}
$args = func_get_args();
$query = self::process($query, array_slice($args, 1), true);
$result = false;
if (!empty($query)) {
if (!self::$raw) {
fn_set_hook('db_query_process', $query);
}
if (defined('DEBUG_QUERIES')) {
fn_print_r($query);
}
$time_start = microtime(true);
$result = self::$_db->query($query);
$a_row = self::$_db->affectedRows($result);
Debugger::set_query($query, microtime(true) - $time_start);
self::_error($result, $query);
// Get last inserted ID
$i_id = self::$_db->insertId();
if (!self::$raw) {
fn_set_hook('db_query_executed', $query, $result);
}
// "true" will be returned for Update/Delete/Insert/Replace statements. "SELECT" returns MySQLi/PDO object
if ($result === true) {
$cmd = substr($query, 0, 6);
// Check if it was insert statement with auto_increment value and return it
if (!empty($i_id)) {
$result = $i_id;
} elseif ($cmd == 'UPDATE' || $cmd == 'DELETE' || $cmd == 'INSERT') {
$result = $a_row;
}
// Check if query updated data in the database and run cache handlers
if (!empty($result) && preg_match("/^(UPDATE|INSERT INTO|REPLACE INTO|DELETE FROM) " . self::$_table_prefix . "(\\w+) /", $query, $m)) {
Registry::setChangedTables($m[2]);
}
}
}
self::$raw = false;
return $result;
}
示例2: deleteTemplatesCache
/**
* Removes compiled block templates
* @return bool
*/
public static function deleteTemplatesCache()
{
static $is_deleted = false;
if (!$is_deleted) {
// mark cache as outdated
Registry::setChangedTables('bm_blocks');
// run cache routines
Registry::save();
$is_deleted = true;
}
return $is_deleted;
}
示例3: query
/**
* Execute query
*
* @param string $query unparsed query
* @param mixed ... unlimited number of variables for placeholders
* @return mixed result set for "SELECT" statement / generated ID for an AUTO_INCREMENT field for insert statement / Affected rows count for DELETE/UPDATE statements
*/
public static function query($query)
{
if (!self::$raw) {
fn_set_hook('db_query', $query);
}
$args = func_get_args();
$query = self::process($query, array_slice($args, 1), true);
$result = false;
if (!empty($query)) {
if (!self::$raw) {
fn_set_hook('db_query_process', $query);
}
if (defined('DEBUG_QUERIES')) {
fn_print_r($query);
}
$time_start = microtime(true);
$result = self::$db->query($query);
if (!self::error($result, $query)) {
$insert_id = self::$db->insertId();
Debugger::set_query($query, microtime(true) - $time_start);
if (!self::$raw) {
fn_set_hook('db_query_executed', $query, $result);
}
// "true" will be returned for Update/Delete/Insert/Replace statements. "SELECT" returns MySQLi/PDO object
if ($result === true) {
$cmd = substr($query, 0, 6);
// Check if it was insert statement with auto_increment value and return it
if (!empty($insert_id)) {
$result = $insert_id;
} elseif ($cmd == 'UPDATE' || $cmd == 'DELETE' || $cmd == 'INSERT') {
$result = self::$db->affectedRows($result);
}
// Check if query updated data in the database and run cache handlers
if (!empty($result) && preg_match("/^(UPDATE|INSERT INTO|REPLACE INTO|DELETE FROM) " . self::$table_prefix . "(\\w+) /", $query, $m)) {
Registry::setChangedTables($m[2]);
}
}
} else {
// Lost connection, try to reconnect
if (self::tryReconnect()) {
return self::query($query);
// Assume that the table is broken
// Try to repair
} elseif (preg_match("/'(\\S+)\\.(MYI|MYD)/", self::$db->error(), $matches)) {
self::$db->query("REPAIR TABLE {$matches['1']}");
return self::query($query);
}
}
}
self::$raw = false;
return $result;
}