import MySQLdb
import recdblist
import warnings
+import traceback
from decimal import Decimal
class DB_MySQL:
cur.execute('CREATE DATABASE ' + dbname + " DEFAULT CHARACTER SET utf8")
cur.close()
con.close()
- except:
- ""
+ except Exception, inst:
+ recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=500)
db = self.connect_db()
- #try:
- db[1].execute('\
- CREATE TABLE timeline \
- (\
- id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\
- type VARCHAR(40),\
- chtxt VARCHAR(40),\
- title VARCHAR(100),\
- btime DATETIME,\
- etime DATETIME,\
- deltatime VARCHAR(5),\
- deltaday VARCHAR(5),\
- opt VARCHAR(20),\
- epgtitle VARCHAR(100),\
- epgbtime DATETIME,\
- epgetime DATETIME,\
- epgduplicate TINYINT DEFAULT 0,\
- epgchange TINYINT DEFAULT 0,\
- epgexp VARCHAR(200),\
- counter TINYINT DEFAULT -1,\
- UNIQUE uni (type,chtxt,title,btime,deltaday)\
- )')
- #except:
- # ""
+ try:
+ db[1].execute('\
+ CREATE TABLE timeline \
+ (\
+ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\
+ type VARCHAR(40),\
+ chtxt VARCHAR(40),\
+ title VARCHAR(100),\
+ btime DATETIME,\
+ etime DATETIME,\
+ deltatime VARCHAR(5),\
+ deltaday VARCHAR(5),\
+ opt VARCHAR(20),\
+ epgtitle VARCHAR(100),\
+ epgbtime DATETIME,\
+ epgetime DATETIME,\
+ epgduplicate TINYINT DEFAULT 0,\
+ epgchange TINYINT DEFAULT 0,\
+ epgexp VARCHAR(200),\
+ counter TINYINT DEFAULT -1,\
+ UNIQUE uni (type,chtxt,title,btime,deltaday)\
+ )')
+ except Exception, inst:
+ recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=500)
self.close_db(db)
self.new_epg_timeline("")
self.new_in_timeline_log()