/** * @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}"); }
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]); }
/** * 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; }