OSDN Git Service

implement MySQL using function.
[rec10/rec10-git.git] / rec10 / trunk / src / rec10d.py
index 058cbe8..16935c4 100644 (file)
@@ -5,19 +5,20 @@
 import os
 import timerec
 import dbSQLite
-#import dbMySQL
+import dbMySQL
 import configreader
 path=str(os.path.dirname(os.path.abspath(__file__)))+"/"
 global rec10db
 db=configreader.getpath("db")
 if db=="MySQL":
     dbn=configreader.getpath("mysql_dbname")
-    dbh=configreader.getpath("mysql_dbhost")
-    dbu=configreader.getpath("")
-    dbpwd=configreader.getpath("")
-    dbport=int(configreader.getpath(""))
-    #rec10db=dbMySQL.DB_MySQL(dbname,host="localhost",user,passwd,port=3306)
-rec10db=dbSQLite.DB_SQLite(path+"ch.db")
+    dbh=configreader.getpath("mysql_host")
+    dbu=configreader.getpath("mysql_user")
+    dbpwd=configreader.getpath("mysql_passwd")
+    dbport=int(configreader.getpath("mysql_port"))
+    rec10db=dbMySQL.DB_MySQL(dbname=dbn,host=dbh,user=dbu,passwd=dbpwd,port=dbport)
+else:
+    rec10db=dbSQLite.DB_SQLite(path+"ch.db")
 if __name__ == "__main__":
     timerec.task()