Request information about reddisc page for redfams

To generate links to related reddisc it is necessary to get at least the
Title of the related reddisc page. As saving the same data in db is
worse, we retreive it via join from red_pages table

Related Task: [https://fs.golderweb.de/index.php?do=details&task_id=26 FS#26]
This commit is contained in:
2016-08-26 18:17:53 +02:00
parent 4055dc52d8
commit b36dc250d2
2 changed files with 19 additions and 6 deletions

View File

@@ -353,10 +353,14 @@ article7 ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? );'
cursor = type( self ).connection.cursor( mysqldb.DictCursor )
cursor.execute(
'SELECT * FROM `{prefix}_red_families` WHERE `status` = ? AND'.
format(prefix=type( self ).db_table_prefix) +
'`ending` >= ?;', ( status, ending ) )
cursor.execute( (
'SELECT * ' +
'FROM `{prefix}_red_families` `F` ' +
'INNER JOIN `{prefix}_red_pages` `P` ' +
'ON `F`.`status` = ? ' +
'AND `F`.`ending` >= ? '
'AND `F`.`red_page_id` = `P`.`page_id`;').format(
prefix=type( self ).db_table_prefix), ( status, ending ) )
while True:
res = cursor.fetchmany( 1000 )