X-Git-Url: http://git.osdn.net/view?p=rec10%2Frec10-git.git;a=blobdiff_plain;f=rec10%2FdbMySQL.py;h=b40da126a1ff07e77292a97ba439ca1281b6b2c1;hp=b73dd8c500052a9aa2f140cedc3d76a7aa608889;hb=5e3efe657c7aaa3d2b2e758910343ee20c1f795a;hpb=d7f5926e68d9d12f9bc9e529948250baf4406de8 diff --git a/rec10/dbMySQL.py b/rec10/dbMySQL.py index b73dd8c..b40da12 100644 --- a/rec10/dbMySQL.py +++ b/rec10/dbMySQL.py @@ -1241,20 +1241,27 @@ vim ") CREATE TABLE auto_classify \ (\ id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,\ + title VARCHAR(1024),\ frompath VARCHAR(1024),\ topath VARCHAR(1024),\ - do BOOLEAN\ + do BOOLEAN,\ + UNIQUE key (title),\ )') except Exception, inst: if not ((type(inst)==MySQLdb.ProgrammingError and inst[0]==1007)or(type(inst)==MySQLdb.OperationalError and inst[0]==1050)): recdblist.addCommonlogEX("Error", "new_auto_classify (dbMySQL.py)", str(type(inst)),str(inst)+traceback.format_exc(),log_level=200) - def add_auto_classify(self, frompath="", topath=""): + def add_auto_classify(self,title="", frompath="", topath=""): db = self.connect_db() db[1].execute('\ INSERT IGNORE into auto_classify \ - (frompath,topath,do) \ - values (%s,%s,0)', \ - (frompath, topath)) + (title,frompath,topath,do) \ + values (%s,%s,%s,0)', \ + (title,frompath, topath)) + self.close_db(db) + def delete_refresh_auto_classify(self): + db = self.connect_db() + db[1].execute("\ + TRUNCATE TABLE auto_classify") self.close_db(db) def delete_old_auto_classify(self, frompath): db = self.connect_db() @@ -1263,6 +1270,20 @@ vim ") WHERE \ frompath == %s", (frompath)) self.close_db(db) + def select_move_auto_classify(self): + db = self.connect_db() + dbexe = db[1].execute("\ + SELECT id,title,frompath,topath \ + FROM auto_classify \ + WHERE do = 1") + dls = [] + if dbexe > 0: + dls = db[1].fetchall() + self.close_db(db) + if len(dls)>0: + return dls[0] + else: + return dls def update_db_to93(self): db = self.connect_db() self.drop_in_settings()