Skip to content

Commit

Permalink
Fixed parameter in database connection to use utf8 as the default cha…
Browse files Browse the repository at this point in the history
…rset
  • Loading branch information
guilhermechapiewski committed May 11, 2009
1 parent f712f2a commit 69be98c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/simple_db_migrate/mysql.py
Expand Up @@ -22,7 +22,10 @@ def __init__(self, config=None, mysql_driver=MySQLdb):
def __mysql_connect(self, connect_using_db_name=True):
try:
conn = self.__mysql_driver.connect(host=self.__mysql_host, user=self.__mysql_user, passwd=self.__mysql_passwd)

# this should be configured in the config file, not hardcoded
conn.set_character_set('utf8')

if connect_using_db_name:
conn.select_db(self.__mysql_db)
return conn
Expand Down
1 change: 1 addition & 0 deletions tests/mysql_test.py
Expand Up @@ -27,6 +27,7 @@ def tearDown(self):

def __mock_db_init(self, mysql_driver_mock, db_mock, cursor_mock):
mysql_driver_mock.expects(at_least_once()).method("connect").will(return_value(db_mock))
db_mock.expects(at_least_once()).method("set_character_set")
db_mock.expects(at_least_once()).method("select_db")

# create db if not exists
Expand Down

0 comments on commit 69be98c

Please sign in to comment.