Changeset 72
- Timestamp:
- 07/19/05 01:51:31 (3 years ago)
- Files:
-
- discussionplugin/trunk/discussion/core.py (modified) (5 diffs)
- discussionplugin/trunk/discussion/wiki.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
discussionplugin/trunk/discussion/core.py
r67 r72 105 105 def get_message(self, cursor, id, req): 106 106 columns = ('id', 'forum', 'topic', 'replyto', 'time', 'body', 'author') 107 cursor.execute('SELECT %s FROM message WHERE id=%s' % (', '.join(columns), id))107 cursor.execute('SELECT id, forum, topic, replyto, time, body, author FROM message WHERE id=%i', id) 108 108 row = cursor.fetchone() 109 109 if not row: return None … … 114 114 def get_topic(self, cursor, id, req): 115 115 columns = ('id', 'forum', 'time', 'subject', 'body', 'author') 116 cursor.execute('SELECT %s FROM topic WHERE id=%s' % (', '.join(columns), id))116 cursor.execute('SELECT id, forum, time, subject, body, author FROM topic WHERE id=%s', id) 117 117 row = cursor.fetchone() 118 118 if not row: return None … … 123 123 def get_forum(self, cursor, id, req): 124 124 columns = ('name', 'moderators', 'id', 'time', 'subject', 'description') 125 cursor.execute('SELECT %s FROM forum WHERE name=\'%s\'' % (', '.join(columns), id))125 cursor.execute('SELECT name, moderators, id, time, subject, description FROM forum WHERE name=%s', id) 126 126 row = cursor.fetchone() 127 127 if not row: return None … … 144 144 def get_topics(self, cursor, forum, req): 145 145 columns = ('id', 'forum', 'time', 'subject', 'body', 'author', 'replies') 146 cursor.execute('SELECT id, forum, time, subject, body, author, (SELECT COUNT(id) FROM message m WHERE m.topic = topic.id) FROM topic WHERE forum = % s ORDER BY time' % forum)146 cursor.execute('SELECT id, forum, time, subject, body, author, (SELECT COUNT(id) FROM message m WHERE m.topic = topic.id) FROM topic WHERE forum = %i ORDER BY time', int(forum)) 147 147 topics = [] 148 148 for row in cursor.fetchall(): … … 154 154 def get_messages(self, cursor, topic, req): 155 155 columns = ('id', 'replyto', 'time', 'body', 'author') 156 cursor.execute('SELECT %s FROM message WHERE topic=%s ORDER BY time' % (', '.join(columns), topic))156 cursor.execute('SELECT id, replyto, time, body, author FROM message WHERE topic=%s ORDER BY time', topic) 157 157 158 158 messagemap = {} discussionplugin/trunk/discussion/wiki.py
r66 r72 26 26 cursor = db.cursor() 27 27 if ns == 'forum': 28 cursor.execute('SELECT subject FROM forum WHERE name= \'%s\'' %id)28 cursor.execute('SELECT subject FROM forum WHERE name=%s', id) 29 29 row = cursor.fetchone() 30 30 if row: … … 34 34 return '<a href="%s/%s" class="missing">%s?</a>' % (self.env.href.discussion(), id, label) 35 35 elif ns == 'topic': 36 cursor.execute('SELECT forum, (SELECT subject FROM forum WHERE id=topic.forum), subject FROM topic WHERE id=%i' %id)36 cursor.execute('SELECT (SELECT name FROM forum WHERE id=topic.forum), (SELECT subject FROM forum WHERE id=topic.forum), subject FROM topic WHERE id=%i', id) 37 37 row = cursor.fetchone() 38 38 if row: … … 40 40 return '<a href="%s/%s/%s" title="%s: %s">%s</a>' % (self.env.href.discussion(), forum, id, forum_subject, subject, label) 41 41 elif ns == 'message': 42 cursor.execute('SELECT forum, topic, (SELECT subject FROM forum WHERE id=message.forum), (SELECT subject FROM topic WHERE id=message.topic) FROM message WHERE id=%i' %id)42 cursor.execute('SELECT (SELECT name FROM forum WHERE id=message.forum), topic, (SELECT subject FROM forum WHERE id=message.forum), (SELECT subject FROM topic WHERE id=message.topic) FROM message WHERE id=%i', id) 43 43 row = cursor.fetchone() 44 44 if row:
