Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fixed character-set detection regex #133

Merged
merged 1 commit into from

2 participants

Olivier Bilodeau Hunter Haugen
Olivier Bilodeau

Previous regex matched COLLATE value instead of CHARACTER SET. For example:

CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */

Returned utf8_bin instead of utf8 causing an unfortunate database refresh in my configuration. Fixed the regex by adding the optional presence of the COLLATE keyword.

Tested to make sure that it worked on both cases (w/ and w/o COLLATE).

Olivier Bilodeau obilodeau fixed character-set detection regex
Previous regex matched COLLATE value instead of CHARACTER SET. For
example:

> CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */

Returned utf8_bin instead of utf8 causing an unfortunate database refresh in my
configuration. Fixed the regex by adding the optional presence of the COLLATE
keyword.
8510a41
Olivier Bilodeau

For the record, the build problem isn't my code's fault:

I'm sorry but an error occured within Travis while running your build. We are continuosly working on test run stability, please email support@travis-ci.org if this error persists.

Hunter Haugen hunner merged commit 4af7950 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 11, 2012
  1. Olivier Bilodeau

    fixed character-set detection regex

    obilodeau authored
    Previous regex matched COLLATE value instead of CHARACTER SET. For
    example:
    
    > CREATE DATABASE `test` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_bin */
    
    Returned utf8_bin instead of utf8 causing an unfortunate database refresh in my
    configuration. Fixed the regex by adding the optional presence of the COLLATE
    keyword.
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/puppet/provider/database/mysql.rb
2  lib/puppet/provider/database/mysql.rb
View
@@ -22,7 +22,7 @@ def destroy
end
def charset
- mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s\*\//)[1]
+ mysql("--defaults-file=#{Facter.value(:root_home)}/.my.cnf", '-NBe', "show create database `#{resource[:name]}`").match(/.*?(\S+)\s(?:COLLATE.*)?\*\//)[1]
end
def charset=(value)
Something went wrong with that request. Please try again.