OSDN Git Service

fix Error char bug.
[rec10/rec10-git.git] / rec10 / trunk / src / dbMySQL.py
index 667be02..ff539f9 100644 (file)
@@ -24,7 +24,7 @@ class DB_MySQL:
         try:
             con = MySQLdb.connect(user=user, passwd=passwd)
             cur = con.cursor()
-            cur.execute('CREATE DATABASE ' + dbname + " DEFAULT CHARACTER SET utf8")
+            cur.execute('CREATE DATABASE ' + dbname + " DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;")
             cur.close()
             con.close()
         except Exception, inst:
@@ -72,6 +72,10 @@ class DB_MySQL:
         """
         con = MySQLdb.connect(db=self.dbname, host=self.dbhost, port=self.dbport, user=self.dbusr, passwd=self.dbpasswd, charset="utf8")
         cur = con.cursor()
+        try:
+            con.autocommit(1)
+        except:
+            ""
         cur.execute('set names utf8;')
         return [con, cur]
     def close_db(self, db):
@@ -1308,4 +1312,4 @@ vim         ")
         self.change_installed_in_status(1)
         self.change_version_in_status("101")
         #self.change_installed_in_status()#チャンネルスキャンをさせる
-        
\ No newline at end of file
+