jv2222/ezSQL — pull request #16 by Lwangaman (2013-01-26 22:27:46+00:00)
Title: Added intelligent check for valid CHARSET value against current mysql resource

I have added a check against the current mysql recource for a valid CHARSET value. If the $encoding parameter contains a valid value, then the SET NAMES statement will be called. Otherwise the SET NAMES statement will simply be skipped over.

I figured it'd be nice to do an "intelligent" check. Since mysql refers to CHARSETS as lowercase and without dashes, this could lead to confusion if someone tries to set the $encoding parameter for example to "UTF-8". Since that would fail, we take care of that by automatically converting to lowercase and removing dashes. So "UTF-8" will automatically become "utf8".

Also I took out the default "utf8", perhaps it's more unobtrusive to not enforce an encoding. It will be completely up to the user to choose the encoding if required.