elifalpha==2:having=" having INSTR('0123456789',letters)>0 and letters!=''"
elifalpha==3:having=" having INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZ',letters)>0 and letters!=''"
elifalpha==4:having=" having INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЬЫЪЭЮЯ0123456789',letters)=0 and letters!=''"
ifhaving=="":having=" having "+period
else:having=having+""+period
sql="select UPPER(substring(trim(title),1,"+str(lc)+")) as letters, count(*) as cnt from "+TBL_BOOKS+" where substring(trim(title),1,"+str(lc-1)+")='"+letters+"'"+dstr+" and avail!=0 group by 1"+having+" order by 1"
cursor=self.cnx.cursor()
@@ -620,10 +622,9 @@ class opdsDatabase:
returnrows
defgetdbinfo(self,doublicates=True):
ifdoublicates:
dstr=''
else:
dstr='and doublicat=0'
ifdoublicates:dstr=''
else:dstr='and doublicat=0'
sql="select 1 s, count(avail) from %s where avail!=0 %s union all select 2 s, count(author_id) from %s union all select 3 s, count(cat_id) from %s union all select 4 s, count(genre_id) from %s union all select 5 s, count(ser_id) from %s order by s"%(TBL_BOOKS,dstr,TBL_AUTHORS,TBL_CATALOGS,TBL_GENRES,TBL_SERIES)