jforum2
jforum2 copied to clipboard
SQL Exceptions using PostgreSQL in 2.1.9
There are three SQL Exceptions in 2.1.9 when using Postgres. I have suggested fixes for each
net/jforum/dao/generic/GenericForumDao.java:
/**
* @see net.jforum.dao.ForumDAO#getModeratorList(int)
*/
public List getModeratorList(int forumId)
{
List l = new ArrayList();
PreparedStatement p = null;
ResultSet rs = null;
try {
p = JForumExecutionContext.getConnection().prepareStatement(
SystemGlobals.getSql("ForumModel.getModeratorList"));
// OLD: p.setInt(1, forumId);
p.setString(1, String.valueOf(forumId));
rs = p.executeQuery();
while (rs.next()) {
ModeratorInfo mi = new ModeratorInfo();
mi.setId(rs.getInt("id"));
mi.setName(rs.getString("name"));
l.add(mi);
}
return l;
}
catch (SQLException e) {
throw new DatabaseException(e);
}
finally {
DbUtils.close(rs, p);
}
}
WEB-INF/config/database/postgresql/postgresql.sql:
# #############
# ForumModel
# #############
ForumModel.lastGeneratedForumId = SELECT CURRVAL('jforum_forums_seq');
#
# Add the following two queries
#
ForumModel.statsFirstPostTime = SELECT MIN(post_time) FROM jforum_posts WHERE post_time > timestamp '01-01-01 00:00:00'
ForumModel.statsFirstRegisteredUserTime = SELECT MIN(user_regdate) FROM jforum_users WHERE user_regdate > timestamp '01-01-01 00:00:00'
Thanks - this works great. I appreciate it.
I can't find the 2.1.9 source code. Do you have class file I can download for the fix? Thanks in advance!
Don't bother, I found the code. Cheers
Muchas gracias, me pasaba lo mismo