recdblist.printutf8(u"DB処理に入ります")
if os.path.exists(os.path.join(path,"rec10d.py")):
try:
- import rec10d
- if rec10d.rec10db.select_version_in_status()==0 and rec10d.rec10db.select_installed_in_status()==1:
- recdblist.printutf8(u"既存のDBが見つかりました。0.9.1と仮定してアップデート処理を行います。")
- rec10d.rec10db.update_db_to93()
- else:
- rec10d.rec10db.drop_in_status()
- rec10d.rec10db.drop_in_settings()
- time.sleep(2)
- rec10d.rec10db.new_in_status()
- rec10d.rec10db.new_in_settings()
- rec10d.rec10db.change_version_in_status(version)
+ update_db_all()
except Exception, inst:
recdblist.printutf8(u"DB処理中にエラーが出ました。configファイルのDB設定を見直してください。")
print type(inst)
confp.read("/etc/rec10.conf")
tmpconf=confp.get(dbsection,key)
return tmpconf
+def update_db_all():
+ import rec10d
+ tversion=0
+ if rec10d.rec10db.select_installed_in_status()==1:
+ if rec10d.rec10db.select_version_in_status()==0:
+ tversion=0
+ recdblist.printutf8(u"既存のDBが見つかりました。0.9.1と仮定してアップデート処理を行います。")
+ update_db(0)
+ time.sleep(1)
+ else:
+ recdblist.printutf8(u"既存のDBが見つかりました。アップデート処理を行います。")
+ tversion=int(rec10d.rec10db.select_version_in_status())
+ while (recdblist.version>tversion):
+ update_db(tversion)
+ tversion=int(rec10d.rec10db.select_version_in_status())
+ else:
+ rec10d.rec10db.drop_in_status()
+ rec10d.rec10db.drop_in_settings()
+ time.sleep(2)
+ rec10d.rec10db.new_in_status()
+ rec10d.rec10db.new_in_settings()
+ rec10d.rec10db.change_version_in_status(recdblist.version)
+def update_db(version):
+ if version==0:
+ rec10d.rec10db.update_db_to93()
+ elif version==93:
+ rec10d.rec10db.update_db_93to94()
if __name__ == "__main__":
move()
\ No newline at end of file