Commit 5ec3c793 authored by mitshel's avatar mitshel
Browse files

Исправлены найденные ошибки. Теперь вроде выборка работает.

parent 7c7df013
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -140,8 +140,6 @@ if 'search' in form:
   type_value=10
   slice_value=-1
   id_value='10&search='+searchTerm
if 'section' in form:
   section=form.getvalue("section","")

if type_value==0:
   header()
@@ -311,8 +309,8 @@ elif type_value==11:
   opdsdb.openDB()
   header()
   enc_print('<link type="application/atom+xml;profile=opds-catalog;kind=navigation" rel="start" title="'+cfg.SITE_MAINTITLE+'" href="sopds.cgi?id=00"/>')
   for (genre_section,cnt) in opdsdb.getgenres_sections():
       id='12&amp;section='+genre_section
   for (genre_id,genre_section,cnt) in opdsdb.getgenres_sections():
       id='12'+str(genre_id)
       enc_print('<entry>')
       enc_print('<title>'+genre_section+'</title>')
       enc_print('<id>sopds.cgi?id='+id_value+'</id>')
@@ -331,7 +329,7 @@ elif type_value==12:
   opdsdb.openDB()
   header()
   enc_print('<link type="application/atom+xml;profile=opds-catalog;kind=navigation" rel="start" title="'+cfg.SITE_MAINTITLE+'" href="sopds.cgi?id=00"/>')
   for (genre_id,genre_subsection,cnt) in opdsdb.getgenres_subsections(section):
   for (genre_id,genre_subsection,cnt) in opdsdb.getgenres_subsections(slice_value):
       id='13'+str(genre_id)
       enc_print('<entry>')
       enc_print('<title>'+genre_subsection+'</title>')
+3 −3
Original line number Diff line number Diff line
@@ -434,15 +434,15 @@ class opdsDatabase:
    return rows

  def getgenres_sections(self):
    sql="select a.section, count(*) as cnt from "+TBL_GENRES+" a, "+TBL_BGENRES+" b where a.genre_id=b.genre_id group by a.section order by a.section"
    sql="select min(a.genre_id), a.section, count(*) as cnt from "+TBL_GENRES+" a, "+TBL_BGENRES+" b where a.genre_id=b.genre_id group by a.section order by a.section"
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()
    cursor.close
    return rows

  def getgenres_subsections(self,section_name):
    sql="select a.genre_id, a.subsection, count(*) as cnt from "+TBL_GENRES+" a, "+TBL_BGENRES+" b where a.genre_id=b.genre_id and section='"+section_name+"' group by a.subsection order by a.subsection"
  def getgenres_subsections(self,section_id):
    sql="select a.genre_id, a.subsection, count(*) as cnt from "+TBL_GENRES+" a, "+TBL_BGENRES+" b where a.genre_id=b.genre_id and section in (select section from "+TBL_GENRES+" where genre_id="+str(section_id)+") group by a.subsection order by a.subsection"
    cursor=self.cnx.cursor()
    cursor.execute(sql)
    rows=cursor.fetchall()