Commit fd06f4e1 authored by mitshel's avatar mitshel
Browse files

Коммиты теперь делаются не после каждой операции добавления автора, жанра,...

Коммиты теперь делаются не после каждой операции добавления автора, жанра, книги и связей, а только один раз для каждой книги в модуле sopds-scan.py
parent 8da86550
Loading
Loading
Loading
Loading
−886 B (24.4 KiB)

File changed.

No diff preview for this file type.

+1 −0
Original line number Diff line number Diff line
@@ -156,6 +156,7 @@ def processfile(db,fb2,name,full_path,file,archive=0,file_size=0,cat_id=0):
          for l in fb2.genre.getvalue():
              opdsdb.addbgenre(book_id,opdsdb.addgenre(l.lower().strip(' \'\"')))

          opdsdb.commit()
       else:
          books_skipped+=1
          if VERBOSE:
+7 −7
Original line number Diff line number Diff line
@@ -133,7 +133,7 @@ class opdsDatabase:
    cursor=self.cnx.cursor()
    cursor.execute(sql_addbook,data_addbook)
    book_id=cursor.lastrowid
    self.cnx.commit()
#    self.cnx.commit()
    cursor.close()
    return book_id

@@ -142,7 +142,7 @@ class opdsDatabase:
    data=(fn,cover_type,book_id)
    cursor=self.cnx.cursor()
    cursor.execute(sql,data)
    self.cnx.commit()
#    self.cnx.commit()
    cursor.close()
    
  def findauthor(self,first_name,last_name):
@@ -177,7 +177,7 @@ class opdsDatabase:
    cursor=self.cnx.cursor()
    cursor.execute(sql_addauthor,data_addauthor)
    author_id=cursor.lastrowid
    self.cnx.commit()
#    self.cnx.commit()
    cursor.close()
    return author_id

@@ -188,7 +188,7 @@ class opdsDatabase:
       cursor=self.cnx.cursor()
       try:
         cursor.execute(sql_addbauthor,data_addbauthor)
         self.cnx.commit()
#         self.cnx.commit()
       except:
         pass
       finally:
@@ -225,7 +225,7 @@ class opdsDatabase:
    cursor=self.cnx.cursor()
    cursor.execute(sql,data)
    genre_id=cursor.lastrowid
    self.cnx.commit()
#    self.cnx.commit()
    cursor.close()
    return genre_id

@@ -236,7 +236,7 @@ class opdsDatabase:
       cursor=self.cnx.cursor()
       try:
         cursor.execute(sql,data)
         self.cnx.commit()
#         self.cnx.commit()
       except:
         pass
       finally:
@@ -269,7 +269,7 @@ class opdsDatabase:
    cursor=self.cnx.cursor()
    cursor.execute(sql_addcat,data_addcat)
    cat_id=cursor.lastrowid
    self.cnx.commit()
#    self.cnx.commit()
    cursor.close()
    return cat_id