本文整理汇总了PHP中Illuminate\Database\DatabaseManager::statement方法的典型用法代码示例。如果您正苦于以下问题:PHP DatabaseManager::statement方法的具体用法?PHP DatabaseManager::statement怎么用?PHP DatabaseManager::statement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\DatabaseManager
的用法示例。
在下文中一共展示了DatabaseManager::statement方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: truncateTables
/**
* @param $tables
*/
private function truncateTables($tables)
{
$this->truncatedCount = 0;
foreach ($tables as $table) {
if (!in_array($table, $this->exclude)) {
$this->truncatedCount++;
$this->db->statement('SET FOREIGN_KEY_CHECKS=0;');
$this->db->statement("TRUNCATE TABLE {$table}");
$this->db->statement('SET FOREIGN_KEY_CHECKS=1;');
$this->info("Table {$table} successfully truncated.");
}
}
$this->info("Total table(s) truncated: {$this->truncatedCount}");
}
示例2: deleteConversation
public function deleteConversation($conv_id, $user_id)
{
$this->db->statement('
UPDATE ' . $this->tablePrefix . 'messages_status mst
SET mst.status=' . self::DELETED . '
WHERE mst.user_id=?
AND mst.msg_id IN (
SELECT msg.id
FROM messages msg
WHERE msg.conv_id=?
)
', [$user_id, $conv_id]);
}
示例3: store
/**
* Store an array
*
* @param array $values
* @return bool
*/
public function store(array $values)
{
foreach ($values as $key => $value) {
// Ensure proper type
$value = $this->forceTypes($value);
// Json to save
$jsonValue = json_encode($value);
// Update
$this->database->statement("INSERT INTO system_registries ( `key`, `value` ) VALUES ( ?, ? )\n\t\t\t\t\t\t\t\t\t\tON DUPLICATE KEY UPDATE `key` = ?, `value` = ?", array($key, $jsonValue, $key, $jsonValue));
$this->cache->add($key, $value);
}
//$this->cache->forever('torann.registry', $this->cache_storage);
return true;
}