EllisLab/CodeIgniter — pull request #1083 by narfbg (2012-02-27 10:34:59+00:00)
Title: Fixed a db_set_charset() bug

It used to ignore its parameters and always use `$this->char_set` and `$this->dbcollat` instead, which made it useless if somebody wants to manually call it.

Also made the second parameter (collation) to be optional. Currently, only MySQL supports dynamic setting of the character set and collation, but most (if not all) of the other drivers have only one setting for this and if it becomes needed in the future - it's pretty much pointless to require collation.

And another improvement, not related to the issue itself but still ... all of the database drivers currently override the `db_set_charset()` method and just return TRUE. So, I've added a `method_exist()` check, to see if `_db_set_charset()` exists prior to calling it and if it doesn't - return TRUE. This allows for `db_set_charset()` overrides to be removed from the drivers (as seen in the diff).