error handling

This commit is contained in:
kc9uhi
2026-01-24 16:10:18 -07:00
committed by GitHub
parent 90ff1152ab
commit a5a34f1848

View File

@@ -14,14 +14,22 @@ class Migration_fix_dbcollate_again extends CI_Migration
'vuccgrids'
);
foreach ($tables as $table) {
$this->db->query('ALTER TABLE ' . $table . ' CONVERT TO CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix existing tables that haven't already been fixed
$this->dbtry('ALTER TABLE ' . $table . ' CONVERT TO CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix existing tables that haven't already been fixed
}
$this->db->query('ALTER DATABASE `' . $this->db->database . '` CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix the database default
$this->dbtry('ALTER DATABASE `' . $this->db->database . '` CHARACTER SET ' . $this->db->char_set . ' COLLATE ' . $this->db->dbcollat); // fix the database default
}
public function down()
{
// Not Possible
}
function dbtry($what) {
try {
$this->db->query($what);
} catch (Exception $e) {
log_message("error", "Error setting character set/collation: ".$e." // Executing: ".$this->db->last_query());
}
}
}
?>