Пример #1
0
 def executeSql(self, sql):
     try:
         self.cursor.execute(sql);
         Log.I("[I] 执行 " + sql.strip() + " 成功");
         return True; 
     except Exception as e:
         if not isinstance(e, pymysql.err.IntegrityError) or len(e.args) <= 0 or e.args[0] != 1062:
             Log.E("[I] 执行 " + sql.strip() + " 失败");
             Log.Exc(e);
     return False;
Пример #2
0
    Log.D("--test--")
    dropAllTables()
    sys.exit(0)


# 将Config.sample.py复制出一个Config.py文件
def createConfigFile():
    if not os.path.exists("Config.py"):
        fd = open("Config.sample.py", "r")
        content = fd.read()
        fd.close()
        wfd = open("Config.py", "w")
        wfd.write(content)
        wfd.flush()
        wfd.close()


if __name__ == '__main__':
    createConfigFile()
    # test();
    try:
        from src.Prepare import Prepare
        Prepare()
    except Exception, e:
        Log.E("--------异常退出--------")
        Log.Exc(e)
        Log.V(Log.traceback())
        sys.exit(0)
else:
    Log.E("-错误")
Пример #3
0
 def saveChapter(self, bookId, sectionInfo):
     if sectionInfo == None:
         Log.E(" --- sectionInfo is None when saveChapter")
         return
     self.chapterDb = ChapterDb(bookId)
     return self.chapterDb.setSectionInfoModel(sectionInfo)