cur.close()
con.close()
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
db = self.connect_db()
try:
UNIQUE uni (type,chtxt,title,btime,deltaday)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "init (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
self.new_epg_timeline("")
try:
db[1].execute('drop table epg_ch')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
recdblist.Commonlogex("Error", "new_epg_ch drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
isshow TINYINT\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_epg_ch (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
dbexe = db[1].execute("\
SELECT bctype,chtxt,ch,csch,updatetime \
FROM epg_ch \
- WHERE chtxt = %s", \
+ WHERE chtxt LIKE %s", \
(chtxt,))
ret = []
dls = []
try:
db[1].execute('drop table auto_proc_tmp')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
recdblist.Commonlogex("Error", "new_auto_proc_tmp drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
UNIQUE unibayeskey(title)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_auto_proc_tmp (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
try:
db[1].execute('INSERT INTO auto_proc SELECT * FROM auto_proc_tmp')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "update_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
try:
db[1].execute('drop table auto_proc')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
recdblist.Commonlogex("Error", "new_auto_proc drop (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
UNIQUE unibayeskey(title)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_auto_proc (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
try:
db[1].execute('drop table in_settings')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
recdblist.Commonlogex("Error", "drop_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def new_in_settings(self):
)')
db[1].execute("INSERT IGNORE into in_settings VALUE (0,0,\"H\",1)")
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_in_settings (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
UNIQUE uni (chtxt,title,btime,category)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_in_timeline_log (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
UNIQUE unijbk (keyword)\
)")
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_in_auto_jbk_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def add_in_auto_jbk_key(self,key):
try:
db[1].execute('drop table in_status')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and (inst[0]==1050 or inst[0]==1051))):
recdblist.Commonlogex("Error", "drop_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def new_in_status(self):
)")
db[1].execute("INSERT IGNORE into in_status VALUE (0,0,0,0,0,0)")
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_all_in_status(self):
r = list(dl)
version=int(str(r[0]))
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "select_version_in_status (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
return version
def change_version_in_status(self,version):
WHERE bctype = %s", \
(bctype,))
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and (inst[0]==1007 or inst[0]==1146))or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_epg_timeline delete (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
try:
db[1].execute("\
UNIQUE unitv(bctype,channel,start,stop,title)\
)")
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_epg_timeline (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
#db.commit()
self.close_db(db)
epg_ch.chtxt,title,start,stop,exp,longexp,category \
FROM epg_timeline \
INNER JOIN epg_ch \
- WHERE epg_ch.chtxt=epg_timeline.channel \
+ WHERE epg_ch.chtxt LIKE epg_timeline.channel \
AND \
start >= %s \
AND \
start <= %s \
AND \
- epg_ch.chtxt=%s"
+ epg_ch.chtxt LIKE %s"
dbcmd = db[1].execute(dbexe, (btime, etime, chtxt))
retall = []
if dbcmd > 0:
)')
db[1].execute('CREATE INDEX keycharindex ON in_auto_bayes_key(keychar)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
ON DUPLICATE KEY UPDATE \
ratio_all=CONVERT((ratio_all*%s+%s)/%s,DECIMAL(32,14))",retl)
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "change_multi_ratio_all_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def change_ratio_rec_reduce_in_auto_bayes_key(self,chtxt,beforenum,newnum):
ON DUPLICATE KEY UPDATE \
ratio_rec=CONVERT((ratio_rec*%s+%s)/%s,DECIMAL(32,14))",retl)
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "change_multi_ratio_rec_in_auto_bayes_key (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
self.close_db(db)
def select_by_key_in_auto_bayes_key(self,key,chtxt):
UNIQUE uni (chtxt,title,btime,etime)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_auto_timeline_keyword (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
def add_auto_timeline_keyword(self,chtxt="", title="", btime="", etime=""):
db = self.connect_db()
UNIQUE uni (chtxt,title,btime,etime)\
)')
except Exception, inst:
- if not (type(inst)==MySQLdb.ProgrammingError and (inst[0] == 1007 or inst[0]==1050)):
+ if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)):
recdblist.Commonlogex("Error", "new_auto_timeline_bayes (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200)
def add_auto_timeline_bayes(self,chtxt="", title="", btime="", etime="",point=""):
db = self.connect_db()
self.new_in_settings()
self.close_db(db)
self.change_version_in_status("98")
- def update_db_98to99(self):
+ def update_db_98to100(self):
+ ###ここで前のepg_chをバックアップしてchtxtの変換をする必要がある。
db = self.connect_db()
self.drop_in_settings()
self.new_in_settings()
db[1].execute("\
- ALTER TABLE epg_ch DEL ontv")
+ UPDATE timeline INNER JOIN epg_ch ON timeline.chtxt=epg_ch.chtxt SET timeline.chtxt=CONCAT(CONCAT(epg_ch.ch,'_'),epg_ch.csch)")
+ db[1].execute("\
+ ALTER TABLE epg_ch DROP ontv")
db[1].execute("\
ALTER TABLE in_auto_jbk_key ADD auto TINYINT DEFAULT 0")
db[1].execute("\
- ALTER TABLE in_auto_jbk_key ADD opt VARCHAR(20)")
+ ALTER TABLE in_auto_jbk_key ADD opt VARCHAR(20) DEFAULT \"\"")
self.close_db(db)
self.change_installed_in_status()#チャンネルスキャンをさせる
- self.change_version_in_status("99")
\ No newline at end of file
+ self.change_version_in_status("100")
\ No newline at end of file